mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-03 16:16:43 +00:00
LibWeb: Support elliptical background corners
This commit is contained in:
parent
0e7aa1e98c
commit
2b40dbfb30
Notes:
sideshowbarker
2024-07-17 10:17:46 +09:00
Author: https://github.com/MacDue
Commit: 2b40dbfb30
Pull-request: https://github.com/SerenityOS/serenity/pull/14265
Reviewed-by: https://github.com/linusg
1 changed files with 8 additions and 1 deletions
|
@ -42,9 +42,16 @@ void paint_background(PaintContext& context, Layout::NodeWithStyleAndBoxModelMet
|
||||||
if (background_layers && !background_layers->is_empty())
|
if (background_layers && !background_layers->is_empty())
|
||||||
color_rect = get_box(background_layers->last().clip);
|
color_rect = get_box(background_layers->last().clip);
|
||||||
|
|
||||||
|
auto border_radius_to_corner = [&](BorderRadiusData const& border_radius) {
|
||||||
|
return Gfx::AntiAliasingPainter::CornerRadius {
|
||||||
|
static_cast<int>(border_radius.horizontal_radius),
|
||||||
|
static_cast<int>(border_radius.vertical_radius)
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
Gfx::AntiAliasingPainter aa_painter { painter };
|
Gfx::AntiAliasingPainter aa_painter { painter };
|
||||||
aa_painter.fill_rect_with_rounded_corners(color_rect.to_rounded<int>(),
|
aa_painter.fill_rect_with_rounded_corners(color_rect.to_rounded<int>(),
|
||||||
background_color, border_radii.top_left.horizontal_radius, border_radii.top_right.horizontal_radius, border_radii.bottom_right.horizontal_radius, border_radii.bottom_left.horizontal_radius);
|
background_color, border_radius_to_corner(border_radii.top_left), border_radius_to_corner(border_radii.top_right), border_radius_to_corner(border_radii.bottom_right), border_radius_to_corner(border_radii.bottom_left));
|
||||||
|
|
||||||
if (!background_layers)
|
if (!background_layers)
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue