From 8d4f90df4e6910364db686d1f2e7676cc4c12483 Mon Sep 17 00:00:00 2001 From: MacDue Date: Sun, 16 Jul 2023 00:09:11 +0100 Subject: [PATCH] LibGfx: Pass angles as floats to Path::elliptical_arc_to() These are stored as floats internally and other parameters are FloatPoints, so taking doubles is a little inconsistent. Doubles are needed for the endpoint -> center parametrization conversion, but that does not need exposing in the API. --- Userland/Libraries/LibGfx/Path.cpp | 6 +++--- Userland/Libraries/LibGfx/Path.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Userland/Libraries/LibGfx/Path.cpp b/Userland/Libraries/LibGfx/Path.cpp index ff849c3a4e..12a5859a3a 100644 --- a/Userland/Libraries/LibGfx/Path.cpp +++ b/Userland/Libraries/LibGfx/Path.cpp @@ -14,15 +14,15 @@ namespace Gfx { -void Path::elliptical_arc_to(FloatPoint point, FloatSize radii, double x_axis_rotation, bool large_arc, bool sweep) +void Path::elliptical_arc_to(FloatPoint point, FloatSize radii, float x_axis_rotation, bool large_arc, bool sweep) { auto next_point = point; double rx = radii.width(); double ry = radii.height(); - double x_axis_rotation_c = AK::cos(x_axis_rotation); - double x_axis_rotation_s = AK::sin(x_axis_rotation); + double x_axis_rotation_c = AK::cos(static_cast(x_axis_rotation)); + double x_axis_rotation_s = AK::sin(static_cast(x_axis_rotation)); // Find the last point FloatPoint last_point { 0, 0 }; diff --git a/Userland/Libraries/LibGfx/Path.h b/Userland/Libraries/LibGfx/Path.h index e23c9348fa..444ad7df28 100644 --- a/Userland/Libraries/LibGfx/Path.h +++ b/Userland/Libraries/LibGfx/Path.h @@ -184,14 +184,14 @@ public: invalidate_split_lines(); } - void elliptical_arc_to(FloatPoint point, FloatSize radii, double x_axis_rotation, bool large_arc, bool sweep); + void elliptical_arc_to(FloatPoint point, FloatSize radii, float x_axis_rotation, bool large_arc, bool sweep); void arc_to(FloatPoint point, float radius, bool large_arc, bool sweep) { elliptical_arc_to(point, { radius, radius }, 0, large_arc, sweep); } // Note: This does not do any sanity checks! - void elliptical_arc_to(FloatPoint endpoint, FloatPoint center, FloatSize radii, double x_axis_rotation, double theta, double theta_delta, bool large_arc, bool sweep) + void elliptical_arc_to(FloatPoint endpoint, FloatPoint center, FloatSize radii, float x_axis_rotation, float theta, float theta_delta, bool large_arc, bool sweep) { append_segment( endpoint,