mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 21:29:06 +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:
parent
cf6999f5f3
commit
06c176bbfb
Notes:
sideshowbarker
2024-07-18 22:57:59 +09:00
Author: https://github.com/kalenikaliaksandr
Commit: 06c176bbfb
Pull-request: https://github.com/SerenityOS/serenity/pull/23419
9 changed files with 32 additions and 15 deletions
|
@ -49,7 +49,7 @@ void CommandList::execute(CommandExecutor& executor)
|
|||
auto& command = command_with_scroll_id.command;
|
||||
if (command.has<DrawGlyphRun>()) {
|
||||
auto scale = command.get<DrawGlyphRun>().scale;
|
||||
for (auto const& glyph_or_emoji : command.get<DrawGlyphRun>().glyph_run) {
|
||||
for (auto const& glyph_or_emoji : command.get<DrawGlyphRun>().glyph_run->glyphs()) {
|
||||
if (glyph_or_emoji.has<Gfx::DrawGlyph>()) {
|
||||
auto const& glyph = glyph_or_emoji.get<Gfx::DrawGlyph>();
|
||||
auto const& font = *glyph.font->with_size(glyph.font->point_size() * static_cast<float>(scale));
|
||||
|
@ -89,7 +89,7 @@ void CommandList::execute(CommandExecutor& executor)
|
|||
|
||||
auto result = command.visit(
|
||||
[&](DrawGlyphRun const& command) {
|
||||
return executor.draw_glyph_run(command.glyph_run, command.color, command.translation, command.scale);
|
||||
return executor.draw_glyph_run(command.glyph_run->glyphs(), command.color, command.translation, command.scale);
|
||||
},
|
||||
[&](DrawText const& command) {
|
||||
return executor.draw_text(command.rect, command.raw_text, command.alignment, command.color,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue