1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 09:37:34 +00:00

LibWeb+LibGfx: Fix 'halo' effect around the fringes of shadows

This now allows passing a 'fill_color' to the blur, any fully
transparent pixels will be replaced with this color (with the alpha
set to 0).

For box-shadows, if this color is set to the same as the shadow,
the issues around the fringes are fixed. This also fixes some places
where dark shadows appeared light / the wrong color.
This commit is contained in:
MacDue 2022-06-28 11:17:12 +01:00 committed by Andreas Kling
parent eb3bbb1ddf
commit cb010fd1f8
3 changed files with 8 additions and 8 deletions

View file

@ -147,7 +147,7 @@ void paint_box_shadow(PaintContext& context, Gfx::IntRect const& content_rect, B
aa_corner_painter.fill_rect_with_rounded_corners(shadow_bitmap_rect.shrunken(double_radius, double_radius, double_radius, double_radius), box_shadow_data.color, top_left_shadow_corner, top_right_shadow_corner, bottom_right_shadow_corner, bottom_left_shadow_corner);
Gfx::StackBlurFilter filter(*shadow_bitmap);
filter.process_rgba(box_shadow_data.blur_radius);
filter.process_rgba(box_shadow_data.blur_radius, box_shadow_data.color);
auto paint_shadow_infill = [&] {
if (!border_radii.has_any_radius())
@ -342,7 +342,7 @@ void paint_text_shadow(PaintContext& context, Layout::LineBoxFragment const& fra
// Blur
Gfx::StackBlurFilter filter(*shadow_bitmap);
filter.process_rgba(layer.blur_radius);
filter.process_rgba(layer.blur_radius, layer.color);
auto draw_rect = Gfx::enclosing_int_rect(fragment.absolute_rect());
Gfx::IntPoint draw_location {