mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:27:35 +00:00
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.
This commit is contained in:
parent
7f8cf81f7a
commit
eb3bbb1ddf
1 changed files with 5 additions and 6 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue