LibWeb: Remove fragment_baseline from PaintTextShadow

Translate text_rect instead, so the struct doesn't have to carry
additional member.
This commit is contained in:
Aliaksandr Kalenik 2024-06-28 16:46:10 +02:00 committed by Andreas Kling
parent ebc282207b
commit b27cf1be49
Notes: sideshowbarker 2024-07-17 07:31:31 +09:00
6 changed files with 5 additions and 7 deletions

View file

@ -145,7 +145,6 @@ struct PaintTextShadow {
NonnullRefPtr<Gfx::GlyphRun> glyph_run;
double glyph_run_scale { 1 };
Color color;
int fragment_baseline;
Gfx::IntPoint draw_location;
[[nodiscard]] Gfx::IntRect bounding_rect() const { return { draw_location, shadow_bounding_rect.size() }; }

View file

@ -270,7 +270,7 @@ CommandResult DisplayListPlayerCPU::paint_text_shadow(PaintTextShadow const& com
Gfx::Painter shadow_painter { *shadow_bitmap };
// FIXME: "Spread" the shadow somehow.
Gfx::IntPoint const baseline_start(command.text_rect.x(), command.text_rect.y() + command.fragment_baseline);
Gfx::IntPoint const baseline_start(command.text_rect.x(), command.text_rect.y());
shadow_painter.translate(baseline_start);
auto const& glyphs = command.glyph_run->glyphs();
for (auto const& glyph_or_emoji : glyphs) {

View file

@ -190,7 +190,7 @@ CommandResult DisplayListPlayerGPU::paint_text_shadow(PaintTextShadow const& com
text_shadow_painter->clear(command.color.with_alpha(0));
Gfx::FloatRect const shadow_location { command.draw_location, command.shadow_bounding_rect.size() };
Gfx::IntPoint const baseline_start(command.text_rect.x(), command.text_rect.y() + command.fragment_baseline);
Gfx::IntPoint const baseline_start(command.text_rect.x(), command.text_rect.y());
text_shadow_painter->translate(baseline_start.to_type<float>());
text_shadow_painter->draw_glyph_run(command.glyph_run->glyphs(), command.color);
if (command.blur_radius == 0) {

View file

@ -344,7 +344,7 @@ void DisplayListRecorder::paint_inner_box_shadow_params(PaintBoxShadowParams par
append(PaintInnerBoxShadow { .box_shadow_params = params });
}
void DisplayListRecorder::paint_text_shadow(int blur_radius, Gfx::IntRect bounding_rect, Gfx::IntRect text_rect, Gfx::GlyphRun const& glyph_run, double glyph_run_scale, Color color, int fragment_baseline, Gfx::IntPoint draw_location)
void DisplayListRecorder::paint_text_shadow(int blur_radius, Gfx::IntRect bounding_rect, Gfx::IntRect text_rect, Gfx::GlyphRun const& glyph_run, double glyph_run_scale, Color color, Gfx::IntPoint draw_location)
{
append(PaintTextShadow {
.blur_radius = blur_radius,
@ -353,7 +353,6 @@ void DisplayListRecorder::paint_text_shadow(int blur_radius, Gfx::IntRect boundi
.glyph_run = glyph_run,
.glyph_run_scale = glyph_run_scale,
.color = color,
.fragment_baseline = fragment_baseline,
.draw_location = state().translation.map(draw_location) });
}

View file

@ -127,7 +127,7 @@ public:
void paint_outer_box_shadow_params(PaintBoxShadowParams params);
void paint_inner_box_shadow_params(PaintBoxShadowParams params);
void paint_text_shadow(int blur_radius, Gfx::IntRect bounding_rect, Gfx::IntRect text_rect, Gfx::GlyphRun const&, double glyph_run_scale, Color color, int fragment_baseline, Gfx::IntPoint draw_location);
void paint_text_shadow(int blur_radius, Gfx::IntRect bounding_rect, Gfx::IntRect text_rect, Gfx::GlyphRun const&, double glyph_run_scale, Color color, Gfx::IntPoint draw_location);
void fill_rect_with_rounded_corners(Gfx::IntRect const& rect, Color color, Gfx::AntiAliasingPainter::CornerRadius top_left_radius, Gfx::AntiAliasingPainter::CornerRadius top_right_radius, Gfx::AntiAliasingPainter::CornerRadius bottom_right_radius, Gfx::AntiAliasingPainter::CornerRadius bottom_left_radius, Vector<Gfx::Path> const& clip_paths = {});
void fill_rect_with_rounded_corners(Gfx::IntRect const& a_rect, Color color, int radius, Vector<Gfx::Path> const& clip_paths = {});

View file

@ -610,7 +610,7 @@ void paint_text_shadow(PaintContext& context, PaintableFragment const& fragment,
draw_rect.y() + offset_y - margin
};
context.display_list_recorder().paint_text_shadow(blur_radius, bounding_rect, text_rect, fragment.glyph_run(), context.device_pixels_per_css_pixel(), layer.color, fragment_baseline, draw_location);
context.display_list_recorder().paint_text_shadow(blur_radius, bounding_rect, text_rect.translated(0, fragment_baseline), fragment.glyph_run(), context.device_pixels_per_css_pixel(), layer.color, draw_location);
}
}