1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:27:43 +00:00

LibWeb: Skip empty paint borders commands in RecordingPainter

With this change, we create substantially fewer border painting
commands, which means fewer reallocations of the vector that stores
commands.

This makes the rendering of
https://html.spec.whatwg.org/multipage/browsing-the-web.html visibly
faster, where we allocated ~10 of such commands now vs ~8000 before.
This commit is contained in:
Aliaksandr Kalenik 2023-12-30 16:04:48 +01:00 committed by Andreas Kling
parent f7a1f28d7f
commit c7e22c7a72

View file

@ -411,6 +411,8 @@ void RecordingPainter::draw_triangle_wave(Gfx::IntPoint a_p1, Gfx::IntPoint a_p2
void RecordingPainter::paint_borders(DevicePixelRect const& border_rect, CornerRadii const& corner_radii, BordersDataDevicePixels const& borders_data)
{
if (borders_data.top.width == 0 && borders_data.right.width == 0 && borders_data.bottom.width == 0 && borders_data.left.width == 0)
return;
push_command(PaintBorders { border_rect, corner_radii, borders_data });
}