From ff0e7d03f4420bde17bda1038ee38f59cea44b10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hubert=20G=C5=82uchowski?= Date: Tue, 1 Apr 2025 15:43:47 +0200 Subject: [PATCH] Don't add merged `Galley` to galley cache --- crates/epaint/src/text/fonts.rs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/crates/epaint/src/text/fonts.rs b/crates/epaint/src/text/fonts.rs index eebda16be..ead608851 100644 --- a/crates/epaint/src/text/fonts.rs +++ b/crates/epaint/src/text/fonts.rs @@ -783,15 +783,10 @@ impl GalleyCache { let job = Arc::new(job); if allow_split_paragraphs && should_cache_each_paragraph_individually(&job) { let galley = self.layout_each_paragraph_individuallly(fonts, job); - let galley = Arc::new(galley); - self.cache.insert( - hash, - CachedGalley { - last_used: self.generation, - galley: galley.clone(), - }, - ); - galley + // TODO(afishhh): This Galley cannot be added directly into the cache without taking + // extra precautions to make sure all component paragraph Galleys are not invalidated + // immediately next frame (since their `last_used` will not be updated). + Arc::new(galley) } else { let galley = super::layout(fonts, job); let galley = Arc::new(galley); @@ -850,8 +845,6 @@ impl GalleyCache { format, } = section; - // dbg!(section_index, section_range); - // `start` and `end` are the byte range of the current paragraph. // How does the current section overlap with the paragraph range?