From 2a1bf63f9eb2ad4efd4d7d11641cc7cd5fa6f5a8 Mon Sep 17 00:00:00 2001 From: MacDue Date: Sat, 15 Jul 2023 15:58:31 +0100 Subject: [PATCH] LibGfx: Use AK::sincos() and AK::Pi in Path::elliptical_arc_to() --- Userland/Libraries/LibGfx/Path.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Userland/Libraries/LibGfx/Path.cpp b/Userland/Libraries/LibGfx/Path.cpp index 12a5859a3a..ea10da1a0e 100644 --- a/Userland/Libraries/LibGfx/Path.cpp +++ b/Userland/Libraries/LibGfx/Path.cpp @@ -21,8 +21,9 @@ void Path::elliptical_arc_to(FloatPoint point, FloatSize radii, float x_axis_rot double rx = radii.width(); double ry = radii.height(); - double x_axis_rotation_c = AK::cos(static_cast(x_axis_rotation)); - double x_axis_rotation_s = AK::sin(static_cast(x_axis_rotation)); + double x_axis_rotation_s; + double x_axis_rotation_c; + AK::sincos(static_cast(x_axis_rotation), x_axis_rotation_s, x_axis_rotation_c); // Find the last point FloatPoint last_point { 0, 0 }; @@ -99,9 +100,9 @@ void Path::elliptical_arc_to(FloatPoint point, FloatSize radii, float x_axis_rot auto theta_delta = theta_2 - theta_1; if (!sweep && theta_delta > 0.0) { - theta_delta -= 2 * M_PI; + theta_delta -= 2 * AK::Pi; } else if (sweep && theta_delta < 0) { - theta_delta += 2 * M_PI; + theta_delta += 2 * AK::Pi; } elliptical_arc_to(