mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:37:35 +00:00
LibWeb: Use glyph run to represent text in PaintTextShadow command
Given that we have a glyph run where the position of each glyph is calculated for text fragments during layout, we can reuse it to avoid this work during painting.
This commit is contained in:
parent
9f01e0f826
commit
b5f9c1d003
8 changed files with 33 additions and 17 deletions
|
@ -344,14 +344,13 @@ void RecordingPainter::paint_inner_box_shadow_params(PaintOuterBoxShadowParams p
|
|||
});
|
||||
}
|
||||
|
||||
void RecordingPainter::paint_text_shadow(int blur_radius, Gfx::IntRect bounding_rect, Gfx::IntRect text_rect, Utf8View text, Gfx::Font const& font, Color color, int fragment_baseline, Gfx::IntPoint draw_location)
|
||||
void RecordingPainter::paint_text_shadow(int blur_radius, Gfx::IntRect bounding_rect, Gfx::IntRect text_rect, Span<Gfx::DrawGlyphOrEmoji const> glyph_run, Color color, int fragment_baseline, Gfx::IntPoint draw_location)
|
||||
{
|
||||
push_command(PaintTextShadow {
|
||||
.blur_radius = blur_radius,
|
||||
.shadow_bounding_rect = bounding_rect,
|
||||
.text_rect = text_rect,
|
||||
.text = String::from_utf8(text.as_string()).release_value_but_fixme_should_propagate_errors(),
|
||||
.font = font,
|
||||
.glyph_run = Vector<Gfx::DrawGlyphOrEmoji> { glyph_run },
|
||||
.color = color,
|
||||
.fragment_baseline = fragment_baseline,
|
||||
.draw_location = state().translation.map(draw_location) });
|
||||
|
@ -497,7 +496,7 @@ void RecordingPainter::execute(PaintingCommandExecutor& executor)
|
|||
return executor.paint_inner_box_shadow(command.outer_box_shadow_params);
|
||||
},
|
||||
[&](PaintTextShadow const& command) {
|
||||
return executor.paint_text_shadow(command.blur_radius, command.shadow_bounding_rect, command.text_rect, command.text, command.font, command.color, command.fragment_baseline, command.draw_location);
|
||||
return executor.paint_text_shadow(command.blur_radius, command.shadow_bounding_rect, command.text_rect, command.glyph_run, command.color, command.fragment_baseline, command.draw_location);
|
||||
},
|
||||
[&](FillRectWithRoundedCorners const& command) {
|
||||
return executor.fill_rect_with_rounded_corners(command.rect, command.color, command.top_left_radius, command.top_right_radius, command.bottom_left_radius, command.bottom_right_radius, command.aa_translation);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue