mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 01:20:25 +00:00
LibWeb: Use ScopedCornerRadiusClip for shadow painting
This commit is contained in:
parent
22e2e1dc93
commit
af21ee8717
Notes:
sideshowbarker
2024-07-17 09:42:53 +09:00
Author: https://github.com/MacDue Commit: https://github.com/SerenityOS/serenity/commit/af21ee8717 Pull-request: https://github.com/SerenityOS/serenity/pull/14482
1 changed files with 1 additions and 13 deletions
|
@ -29,16 +29,7 @@ void paint_box_shadow(PaintContext& context, Gfx::IntRect const& content_rect, B
|
|||
auto bottom_right_corner = border_radii.bottom_right.as_corner();
|
||||
auto bottom_left_corner = border_radii.bottom_left.as_corner();
|
||||
|
||||
Optional<BorderRadiusCornerClipper> corner_radius_clipper {};
|
||||
|
||||
if (border_radii.has_any_radius()) {
|
||||
auto clipper = BorderRadiusCornerClipper::create(content_rect, border_radii, CornerClip::Inside);
|
||||
if (!clipper.is_error())
|
||||
corner_radius_clipper = clipper.release_value();
|
||||
}
|
||||
|
||||
if (corner_radius_clipper.has_value())
|
||||
corner_radius_clipper->sample_under_corners(painter);
|
||||
ScopedCornerRadiusClip corner_clipper { painter, content_rect, border_radii, CornerClip::Inside };
|
||||
|
||||
// Note: Box-shadow layers are ordered front-to-back, so we paint them in reverse
|
||||
for (auto& box_shadow_data : box_shadow_layers.in_reverse()) {
|
||||
|
@ -326,9 +317,6 @@ void paint_box_shadow(PaintContext& context, Gfx::IntRect const& content_rect, B
|
|||
paint_shadow(bottom_left);
|
||||
}
|
||||
}
|
||||
|
||||
if (corner_radius_clipper.has_value())
|
||||
corner_radius_clipper->blit_corner_clipping(painter);
|
||||
}
|
||||
|
||||
void paint_text_shadow(PaintContext& context, Layout::LineBoxFragment const& fragment, Vector<ShadowData> const& shadow_layers)
|
||||
|
|
Loading…
Reference in a new issue