mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-19 07:33:20 +00:00
LibGfx: Add Rect::unite()
The existing `::unite_horizontally()` and `::unite_vertically()` tests did not properly test the edge cases where left/top in the Rect were updated, so they get re-arranged a bit.
This commit is contained in:
parent
c0e861e2fa
commit
7eb4f3da37
Notes:
github-actions[bot]
2025-01-23 08:34:31 +00:00
Author: https://github.com/gmta
Commit: 7eb4f3da37
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3276
Reviewed-by: https://github.com/kalenikaliaksandr ✅
7 changed files with 51 additions and 38 deletions
|
@ -271,15 +271,11 @@ void paint_background(PaintContext& context, PaintableBox const& paintable_box,
|
|||
// However, we must first figure out the real coverage area, taking repeat etc into account.
|
||||
|
||||
// FIXME: This could be written in a far more efficient way.
|
||||
auto fill_rect = Optional<DevicePixelRect> {};
|
||||
DevicePixelRect fill_rect;
|
||||
for_each_image_device_rect([&](auto const& image_device_rect) {
|
||||
if (!fill_rect.has_value()) {
|
||||
fill_rect = image_device_rect;
|
||||
} else {
|
||||
fill_rect = fill_rect->united(image_device_rect);
|
||||
}
|
||||
fill_rect.unite(image_device_rect);
|
||||
});
|
||||
display_list_recorder.fill_rect(fill_rect->to_type<int>(), color.value());
|
||||
display_list_recorder.fill_rect(fill_rect.to_type<int>(), color.value());
|
||||
} else if (is<CSS::ImageStyleValue>(image) && repeat_x && repeat_y && !repeat_x_has_gap && !repeat_y_has_gap) {
|
||||
// Use a dedicated painting command for repeated images instead of recording a separate command for each instance
|
||||
// of a repeated background, so the painter has the opportunity to optimize the painting of repeated images.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue