mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
LibWeb: Use ScopedCornerRadiusClip for background painting
This commit is contained in:
parent
b7fd844c9d
commit
22e2e1dc93
Notes:
sideshowbarker
2024-07-17 09:42:57 +09:00
Author: https://github.com/MacDue Commit: https://github.com/SerenityOS/serenity/commit/22e2e1dc93 Pull-request: https://github.com/SerenityOS/serenity/pull/14482
1 changed files with 1 additions and 11 deletions
|
@ -89,17 +89,10 @@ void paint_background(PaintContext& context, Layout::NodeWithStyleAndBoxModelMet
|
|||
auto& image = *layer.image->bitmap();
|
||||
|
||||
// Clip
|
||||
Optional<BorderRadiusCornerClipper> corner_radius_clipper {};
|
||||
auto clip_box = get_box(layer.clip);
|
||||
auto clip_rect = clip_box.rect.to_rounded<int>();
|
||||
if (clip_box.radii.has_any_radius()) {
|
||||
auto clipper = BorderRadiusCornerClipper::create(clip_rect, clip_box.radii);
|
||||
if (!clipper.is_error()) {
|
||||
corner_radius_clipper = clipper.release_value();
|
||||
corner_radius_clipper->sample_under_corners(painter);
|
||||
}
|
||||
}
|
||||
painter.add_clip_rect(clip_rect);
|
||||
ScopedCornerRadiusClip corner_clip { painter, clip_rect, clip_box.radii };
|
||||
|
||||
Gfx::FloatRect background_positioning_area;
|
||||
|
||||
|
@ -292,9 +285,6 @@ void paint_background(PaintContext& context, Layout::NodeWithStyleAndBoxModelMet
|
|||
break;
|
||||
image_y += y_step;
|
||||
}
|
||||
|
||||
if (corner_radius_clipper.has_value())
|
||||
corner_radius_clipper->blit_corner_clipping(painter);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue