iris: eliminate retained-frame heap churn

This commit is contained in:
iris committed 2026-09-12 22:44:03 -04:00
1 parent acf206ef19
commit 32f6ad8c79
20 files changed
+518 -195

No files matched your search

+17 -2
View File
@@ -617,6 +617,15 @@ impl From<&TextAttrs> for TextShapeAttrs {
}
}
impl TextShapeAttrs {
fn matches(&self, attrs: &TextAttrs) -> bool {
self.color == attrs.color
&& self.font_size == attrs.font_size
&& self.line_height == attrs.line_height
&& self.family == attrs.family
}
}
pub const LINE_HEIGHT_MULT: f32 = 1.1;
impl Default for TextAttrs {
@@ -701,10 +710,16 @@ impl TextBuffer {
width: Option<f32>,
density: f32,
) {
let shape_attrs = TextShapeAttrs::from(attrs);
if self.shaped.as_ref() == Some(&(shape_attrs.clone(), width, density)) {
if self
.shaped
.as_ref()
.is_some_and(|(old, old_width, old_density)| {
old.matches(attrs) && *old_width == width && *old_density == density
})
{
return;
}
let shape_attrs = TextShapeAttrs::from(attrs);
let base_family = data.resolve_family(&attrs.family);
let span_families: Vec<Option<String>> = self
.spans