From eb3bbb1ddf0ea2a94afaf74c0a7f7faa149596c3 Mon Sep 17 00:00:00 2001 From: MacDue Date: Tue, 28 Jun 2022 11:09:08 +0100 Subject: LibWeb: Switch to using StackBlurFilter for shadow painting With this change the blur no longer dominates the profile. On my PC it is down to 27% (which is the same as the AA ellipse painting). The box-shadow.html test page now also feels more responsive. --- Userland/Libraries/LibWeb/Painting/ShadowPainting.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Userland/Libraries/LibWeb/Painting/ShadowPainting.cpp b/Userland/Libraries/LibWeb/Painting/ShadowPainting.cpp index 38792e0d98..b4bc87d257 100644 --- a/Userland/Libraries/LibWeb/Painting/ShadowPainting.cpp +++ b/Userland/Libraries/LibWeb/Painting/ShadowPainting.cpp @@ -7,7 +7,7 @@ */ #include -#include +#include #include #include #include @@ -146,9 +146,8 @@ void paint_box_shadow(PaintContext& context, Gfx::IntRect const& content_rect, B Gfx::AntiAliasingPainter aa_corner_painter { corner_painter }; 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); - // FIXME: Make fast box blur faster - Gfx::FastBoxBlurFilter filter(*shadow_bitmap); - filter.apply_three_passes(box_shadow_data.blur_radius); + Gfx::StackBlurFilter filter(*shadow_bitmap); + filter.process_rgba(box_shadow_data.blur_radius); auto paint_shadow_infill = [&] { if (!border_radii.has_any_radius()) @@ -342,8 +341,8 @@ void paint_text_shadow(PaintContext& context, Layout::LineBoxFragment const& fra shadow_painter.draw_text_run(baseline_start, Utf8View(fragment.text()), context.painter().font(), layer.color); // Blur - Gfx::FastBoxBlurFilter filter(*shadow_bitmap); - filter.apply_three_passes(layer.blur_radius); + Gfx::StackBlurFilter filter(*shadow_bitmap); + filter.process_rgba(layer.blur_radius); auto draw_rect = Gfx::enclosing_int_rect(fragment.absolute_rect()); Gfx::IntPoint draw_location { -- cgit v1.2.3