Skip to content

Commit

Permalink
clean whenever advanced compositor is equal
Browse files Browse the repository at this point in the history
  • Loading branch information
raphamorim committed Jun 6, 2024
1 parent c0eef60 commit 595d957
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion sugarloaf/src/sugarloaf/compositors/advanced.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
3 changes: 2 additions & 1 deletion sugarloaf/src/sugarloaf/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 595d957

Please sign in to comment.