1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:57:35 +00:00

LibGfx+LibWeb: Use ref-counted object to store glyph run

...to avoid allocating a copy of glyph run for painting commands. We
can't simply save pointers to a glyph run in layout/paintable tree
because it should be safe to deallocate layout and paintable trees
after painting commands are recorded, if in the future we decide to
move command execution to a separate thread.
This commit is contained in:
Aliaksandr Kalenik 2024-03-01 16:37:44 +01:00 committed by Andreas Kling
parent cf6999f5f3
commit 06c176bbfb
9 changed files with 32 additions and 15 deletions

View file

@ -26,7 +26,7 @@ void LineBox::add_fragment(Node const& layout_node, int start, int length, CSSPi
m_fragments.last().set_width(m_fragments.last().width() + content_width);
for (auto glyph : glyph_run) {
glyph.visit([&](auto& glyph) { glyph.position.translate_by(fragment_width.to_float(), 0); });
m_fragments.last().m_glyph_run.append(glyph);
m_fragments.last().m_glyph_run->append(glyph);
}
} else {
Vector<Gfx::DrawGlyphOrEmoji> glyph_run_copy { glyph_run };