1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:57:35 +00:00

LibGfx+LibWeb: Store radii as FloatSize rather than FloatPoint

Radii are sizes, not points. This becomes important when mapping them
through a 2D transform.
This commit is contained in:
Andreas Kling 2023-02-10 10:52:14 +01:00
parent e9078e216d
commit 7c607462a4
10 changed files with 26 additions and 26 deletions

View file

@ -69,8 +69,8 @@ Gfx::Path& SVGRectElement::get_path()
}
auto corner_radii = calculate_used_corner_radius_values();
float rx = corner_radii.x();
float ry = corner_radii.y();
float rx = corner_radii.width();
float ry = corner_radii.height();
// 1. perform an absolute moveto operation to location (x+rx,y);
path.move_to({ x + rx, y });
@ -120,7 +120,7 @@ Gfx::Path& SVGRectElement::get_path()
return m_path.value();
}
Gfx::FloatPoint SVGRectElement::calculate_used_corner_radius_values()
Gfx::FloatSize SVGRectElement::calculate_used_corner_radius_values() const
{
// 1. Let rx and ry be length values.
float rx = 0;
@ -158,7 +158,7 @@ Gfx::FloatPoint SVGRectElement::calculate_used_corner_radius_values()
ry = half_height;
// 8. The effective values of rx and ry are rx and ry, respectively.
return Gfx::FloatPoint { rx, ry };
return { rx, ry };
}
// https://www.w3.org/TR/SVG11/shapes.html#RectElementXAttribute