mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 13:17:44 +00:00
LibWeb: Use ScopedCornerRadiusClip for background painting
This commit is contained in:
parent
b7fd844c9d
commit
22e2e1dc93
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();
|
auto& image = *layer.image->bitmap();
|
||||||
|
|
||||||
// Clip
|
// Clip
|
||||||
Optional<BorderRadiusCornerClipper> corner_radius_clipper {};
|
|
||||||
auto clip_box = get_box(layer.clip);
|
auto clip_box = get_box(layer.clip);
|
||||||
auto clip_rect = clip_box.rect.to_rounded<int>();
|
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);
|
painter.add_clip_rect(clip_rect);
|
||||||
|
ScopedCornerRadiusClip corner_clip { painter, clip_rect, clip_box.radii };
|
||||||
|
|
||||||
Gfx::FloatRect background_positioning_area;
|
Gfx::FloatRect background_positioning_area;
|
||||||
|
|
||||||
|
@ -292,9 +285,6 @@ void paint_background(PaintContext& context, Layout::NodeWithStyleAndBoxModelMet
|
||||||
break;
|
break;
|
||||||
image_y += y_step;
|
image_y += y_step;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (corner_radius_clipper.has_value())
|
|
||||||
corner_radius_clipper->blit_corner_clipping(painter);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue