mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:57:44 +00:00
LibWeb: Implement draw_glyph_run in PaintingCommandExecutorGPU
This commit is contained in:
parent
ee28ba0c93
commit
b6da9abfb2
5 changed files with 31 additions and 2 deletions
|
@ -48,6 +48,9 @@ public:
|
||||||
|
|
||||||
bool would_be_fully_clipped_by_painter(Gfx::IntRect) const override;
|
bool would_be_fully_clipped_by_painter(Gfx::IntRect) const override;
|
||||||
|
|
||||||
|
bool needs_prepare_glyphs_texture() const override { return false; }
|
||||||
|
void prepare_glyph_texture(HashMap<Gfx::Font const*, HashTable<u32>> const&) override {};
|
||||||
|
|
||||||
PaintingCommandExecutorCPU(Gfx::Bitmap& bitmap);
|
PaintingCommandExecutorCPU(Gfx::Bitmap& bitmap);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -18,9 +18,9 @@ PaintingCommandExecutorGPU::~PaintingCommandExecutorGPU()
|
||||||
m_painter.flush();
|
m_painter.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult PaintingCommandExecutorGPU::draw_glyph_run(Vector<Gfx::DrawGlyphOrEmoji> const&, Color const&)
|
CommandResult PaintingCommandExecutorGPU::draw_glyph_run(Vector<Gfx::DrawGlyphOrEmoji> const& glyph_run, Color const& color)
|
||||||
{
|
{
|
||||||
// FIXME
|
painter().draw_glyph_run(glyph_run, color);
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,4 +238,9 @@ bool PaintingCommandExecutorGPU::would_be_fully_clipped_by_painter(Gfx::IntRect)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PaintingCommandExecutorGPU::prepare_glyph_texture(HashMap<Gfx::Font const*, HashTable<u32>> const& unique_glyphs)
|
||||||
|
{
|
||||||
|
m_painter.prepare_glyph_texture(unique_glyphs);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,9 @@ public:
|
||||||
|
|
||||||
bool would_be_fully_clipped_by_painter(Gfx::IntRect) const override;
|
bool would_be_fully_clipped_by_painter(Gfx::IntRect) const override;
|
||||||
|
|
||||||
|
virtual bool needs_prepare_glyphs_texture() const override { return true; }
|
||||||
|
void prepare_glyph_texture(HashMap<Gfx::Font const*, HashTable<u32>> const&) override;
|
||||||
|
|
||||||
PaintingCommandExecutorGPU(AccelGfx::Painter& painter);
|
PaintingCommandExecutorGPU(AccelGfx::Painter& painter);
|
||||||
~PaintingCommandExecutorGPU() override;
|
~PaintingCommandExecutorGPU() override;
|
||||||
|
|
||||||
|
|
|
@ -417,6 +417,21 @@ static Optional<Gfx::IntRect> command_bounding_rectangle(PaintingCommand const&
|
||||||
|
|
||||||
void RecordingPainter::execute(PaintingCommandExecutor& executor)
|
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;
|
size_t next_command_index = 0;
|
||||||
while (next_command_index < m_painting_commands.size()) {
|
while (next_command_index < m_painting_commands.size()) {
|
||||||
auto& command = m_painting_commands[next_command_index++];
|
auto& command = m_painting_commands[next_command_index++];
|
||||||
|
|
|
@ -376,6 +376,9 @@ public:
|
||||||
virtual CommandResult blit_corner_clipping(BorderRadiusCornerClipper&) = 0;
|
virtual CommandResult blit_corner_clipping(BorderRadiusCornerClipper&) = 0;
|
||||||
|
|
||||||
virtual bool would_be_fully_clipped_by_painter(Gfx::IntRect) const = 0;
|
virtual bool would_be_fully_clipped_by_painter(Gfx::IntRect) const = 0;
|
||||||
|
|
||||||
|
virtual bool needs_prepare_glyphs_texture() const { return false; }
|
||||||
|
virtual void prepare_glyph_texture(HashMap<Gfx::Font const*, HashTable<u32>> const& unique_glyphs) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RecordingPainter {
|
class RecordingPainter {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue