diff options
author | MacDue <macdue@dueutil.tech> | 2022-06-28 11:09:08 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-06-30 11:16:22 +0200 |
commit | eb3bbb1ddf0ea2a94afaf74c0a7f7faa149596c3 (patch) | |
tree | 09490b6479425268bba1d85eb0f54ac0a75ac37a | |
parent | 7f8cf81f7a1d37aa57cd9e24418b7ffd4a095c65 (diff) | |
download | serenity-eb3bbb1ddf0ea2a94afaf74c0a7f7faa149596c3.zip |
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.
-rw-r--r-- | Userland/Libraries/LibWeb/Painting/ShadowPainting.cpp | 11 |
1 files 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 <LibGfx/DisjointRectSet.h> -#include <LibGfx/Filters/FastBoxBlurFilter.h> +#include <LibGfx/Filters/StackBlurFilter.h> #include <LibGfx/Painter.h> #include <LibWeb/Layout/LineBoxFragment.h> #include <LibWeb/Painting/BorderPainting.h> @@ -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 { |