From 595d957ae3aca9b97a4f5727768846866f49e73c Mon Sep 17 00:00:00 2001 From: Raphael Amorim Date: Thu, 6 Jun 2024 21:16:21 +0200 Subject: [PATCH] clean whenever advanced compositor is equal --- sugarloaf/src/sugarloaf/compositors/advanced.rs | 3 ++- sugarloaf/src/sugarloaf/state.rs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sugarloaf/src/sugarloaf/compositors/advanced.rs b/sugarloaf/src/sugarloaf/compositors/advanced.rs index 8b2b374135..fa75d1732c 100644 --- a/sugarloaf/src/sugarloaf/compositors/advanced.rs +++ b/sugarloaf/src/sugarloaf/compositors/advanced.rs @@ -39,7 +39,8 @@ impl Advanced { #[inline] pub fn clean(&mut self) { - self.layout_context.clear_cache(); + self.content_builder = ContentBuilder::default(); + self.render_data = RenderData::default(); } #[inline] diff --git a/sugarloaf/src/sugarloaf/state.rs b/sugarloaf/src/sugarloaf/state.rs index 4698afbc29..fb3ebb0eed 100644 --- a/sugarloaf/src/sugarloaf/state.rs +++ b/sugarloaf/src/sugarloaf/state.rs @@ -53,7 +53,7 @@ impl SugarState { pub fn compute_layout_rescale(&mut self, scale: f32) { // In rescale case, we actually need to clean cache from the compositors // because it's based on sugarline hash which only consider the font size - self.compositors.advanced.clean(); + self.compositors.advanced.reset(); self.next.layout.rescale(scale).update(); } @@ -148,6 +148,7 @@ impl SugarState { context: &mut super::Context, ) -> bool { if !self.is_dirty && self.latest_change == SugarTreeDiff::Equal { + self.compositors.advanced.clean(); return false; }