mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
LibWeb: Tiebreak corner color on existence of corresponding borders
This fixes the blue border (that should be white/black -- depending on the theme) between avatars on GitHub commits.
This commit is contained in:
parent
cfea934cc8
commit
72a37e5292
Notes:
sideshowbarker
2024-07-17 09:33:17 +09:00
Author: https://github.com/MacDue Commit: https://github.com/SerenityOS/serenity/commit/72a37e5292 Pull-request: https://github.com/SerenityOS/serenity/pull/14532
1 changed files with 11 additions and 4 deletions
|
@ -361,18 +361,25 @@ void paint_all_borders(PaintContext& context, Gfx::FloatRect const& bordered_rec
|
|||
});
|
||||
};
|
||||
|
||||
// FIXME: Corners should actually split between the two colors, if both are provided (and differ)
|
||||
auto pick_corner_color = [](auto const& border, auto const& adjacent_border) {
|
||||
if (border.width > 0)
|
||||
return border.color;
|
||||
return adjacent_border.color;
|
||||
};
|
||||
|
||||
// Blit the corners into to their corresponding locations:
|
||||
if (top_left)
|
||||
blit_corner(border_rect.top_left(), top_left.as_rect(), borders_data.top.color);
|
||||
blit_corner(border_rect.top_left(), top_left.as_rect(), pick_corner_color(borders_data.top, borders_data.left));
|
||||
|
||||
if (top_right)
|
||||
blit_corner(border_rect.top_right().translated(-top_right.horizontal_radius + 1, 0), top_right.as_rect().translated(corner_mask_rect.width() - top_right.horizontal_radius, 0), borders_data.top.color);
|
||||
blit_corner(border_rect.top_right().translated(-top_right.horizontal_radius + 1, 0), top_right.as_rect().translated(corner_mask_rect.width() - top_right.horizontal_radius, 0), pick_corner_color(borders_data.top, borders_data.right));
|
||||
|
||||
if (bottom_right)
|
||||
blit_corner(border_rect.bottom_right().translated(-bottom_right.horizontal_radius + 1, -bottom_right.vertical_radius + 1), bottom_right.as_rect().translated(corner_mask_rect.width() - bottom_right.horizontal_radius, corner_mask_rect.height() - bottom_right.vertical_radius), borders_data.bottom.color);
|
||||
blit_corner(border_rect.bottom_right().translated(-bottom_right.horizontal_radius + 1, -bottom_right.vertical_radius + 1), bottom_right.as_rect().translated(corner_mask_rect.width() - bottom_right.horizontal_radius, corner_mask_rect.height() - bottom_right.vertical_radius), pick_corner_color(borders_data.bottom, borders_data.right));
|
||||
|
||||
if (bottom_left)
|
||||
blit_corner(border_rect.bottom_left().translated(0, -bottom_left.vertical_radius + 1), bottom_left.as_rect().translated(0, corner_mask_rect.height() - bottom_left.vertical_radius), borders_data.bottom.color);
|
||||
blit_corner(border_rect.bottom_left().translated(0, -bottom_left.vertical_radius + 1), bottom_left.as_rect().translated(0, corner_mask_rect.height() - bottom_left.vertical_radius), pick_corner_color(borders_data.bottom, borders_data.left));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue