1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-26 22:53:14 -04:00

Optimize concat

This commit is contained in:
Emil Ernerfeldt
2025-03-30 19:48:10 +02:00
parent d74bee536f
commit 22ea9e91bd

View File

@@ -842,9 +842,13 @@ impl Galley {
}
for placed in &mut merged_galley.rows {
let row = Arc::make_mut(&mut placed.row);
if let Some(first_glyph) = row.glyphs.first_mut() {
row.section_index_at_start = first_glyph.section_index;
let section_index_at_start = placed.row.glyphs.first().map(|g| g.section_index);
if let Some(section_index_at_start) = section_index_at_start {
if placed.row.section_index_at_start != section_index_at_start {
// This `make_mut` is slow, so only do it when necessary.
let row = Arc::make_mut(&mut placed.row);
row.section_index_at_start = section_index_at_start;
}
}
}