1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:27:46 +00:00

LibWeb: Use FillRect command in RecordingPainter if corners radius is 0

This change makes RecordingPainter to emit a FillRect command instead
of FillRectWithRoundedCorners if all corners have a radius = 0.

`fill_rect_with_rounded_corners()` in LibGfx already has a similar
optimization. But now when we also have LibAccelGfx, which does not
support painting rectangles with rounded corners yet, it makes sense to
emit FillRect whenever possible.
This commit is contained in:
Aliaksandr Kalenik 2023-10-27 17:30:12 +02:00 committed by Andreas Kling
parent b6732b0234
commit 92461a2618

View file

@ -352,6 +352,11 @@ void RecordingPainter::paint_text_shadow(int blur_radius, Gfx::IntRect bounding_
void RecordingPainter::fill_rect_with_rounded_corners(Gfx::IntRect const& rect, Color color, Gfx::AntiAliasingPainter::CornerRadius top_left_radius, Gfx::AntiAliasingPainter::CornerRadius top_right_radius, Gfx::AntiAliasingPainter::CornerRadius bottom_right_radius, Gfx::AntiAliasingPainter::CornerRadius bottom_left_radius)
{
if (!top_left_radius && !top_right_radius && !bottom_right_radius && !bottom_left_radius) {
fill_rect(rect, color);
return;
}
push_command(FillRectWithRoundedCorners {
.rect = state().translation.map(rect),
.color = color,