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

LibWeb: Implement draw_glyph_run in PaintingCommandExecutorGPU

This commit is contained in:
Aliaksandr Kalenik 2023-11-05 00:59:53 +01:00 committed by Andreas Kling
parent ee28ba0c93
commit b6da9abfb2
5 changed files with 31 additions and 2 deletions

View file

@ -417,6 +417,21 @@ static Optional<Gfx::IntRect> command_bounding_rectangle(PaintingCommand const&
void RecordingPainter::execute(PaintingCommandExecutor& executor)
{
if (executor.needs_prepare_glyphs_texture()) {
HashMap<Gfx::Font const*, HashTable<u32>> unique_glyphs;
for (auto& command : m_painting_commands) {
if (command.has<DrawGlyphRun>()) {
for (auto const& glyph_or_emoji : command.get<DrawGlyphRun>().glyph_run) {
if (glyph_or_emoji.has<Gfx::DrawGlyph>()) {
auto const& glyph = glyph_or_emoji.get<Gfx::DrawGlyph>();
unique_glyphs.ensure(glyph.font, [] { return HashTable<u32> {}; }).set(glyph.code_point);
}
}
}
}
executor.prepare_glyph_texture(unique_glyphs);
}
size_t next_command_index = 0;
while (next_command_index < m_painting_commands.size()) {
auto& command = m_painting_commands[next_command_index++];