diff options
author | Andreas Kling <kling@serenityos.org> | 2023-02-10 10:52:14 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-02-10 23:33:16 +0100 |
commit | 7c607462a499de2966ccc6b8eb2fc8f6e7cb6f53 (patch) | |
tree | 25e2bb3a8bc931ccf9a9ba3607acbfef2a12c390 /Userland/Libraries/LibWeb/SVG | |
parent | e9078e216d44b7b401250247be921ce51a2d69ea (diff) | |
download | serenity-7c607462a499de2966ccc6b8eb2fc8f6e7cb6f53.zip |
LibGfx+LibWeb: Store radii as FloatSize rather than FloatPoint
Radii are sizes, not points. This becomes important when mapping them
through a 2D transform.
Diffstat (limited to 'Userland/Libraries/LibWeb/SVG')
-rw-r--r-- | Userland/Libraries/LibWeb/SVG/SVGEllipseElement.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/SVG/SVGRectElement.cpp | 8 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/SVG/SVGRectElement.h | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/Userland/Libraries/LibWeb/SVG/SVGEllipseElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGEllipseElement.cpp index 40399ae507..4f4a93de00 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGEllipseElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGEllipseElement.cpp @@ -60,7 +60,7 @@ Gfx::Path& SVGEllipseElement::get_path() return m_path.value(); } - Gfx::FloatPoint radii = { rx, ry }; + Gfx::FloatSize radii = { rx, ry }; double x_axis_rotation = 0; bool large_arc = false; bool sweep = true; // Note: Spec says it should be false, but it's wrong. https://github.com/w3c/svgwg/issues/765 diff --git a/Userland/Libraries/LibWeb/SVG/SVGRectElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGRectElement.cpp index e6ac9adab7..3cce1d9522 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGRectElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGRectElement.cpp @@ -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 diff --git a/Userland/Libraries/LibWeb/SVG/SVGRectElement.h b/Userland/Libraries/LibWeb/SVG/SVGRectElement.h index aca0ce65dd..90e228a74e 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGRectElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGRectElement.h @@ -33,7 +33,7 @@ private: virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; - Gfx::FloatPoint calculate_used_corner_radius_values(); + Gfx::FloatSize calculate_used_corner_radius_values() const; Optional<Gfx::Path> m_path; |