Skip to content

Commit 2a1bf63

Browse files
MacDueawesomekling
authored andcommitted
LibGfx: Use AK::sincos() and AK::Pi<double> in Path::elliptical_arc_to()
1 parent 8d4f90d commit 2a1bf63

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Userland/Libraries/LibGfx/Path.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ void Path::elliptical_arc_to(FloatPoint point, FloatSize radii, float x_axis_rot
2121
double rx = radii.width();
2222
double ry = radii.height();
2323

24-
double x_axis_rotation_c = AK::cos(static_cast<double>(x_axis_rotation));
25-
double x_axis_rotation_s = AK::sin(static_cast<double>(x_axis_rotation));
24+
double x_axis_rotation_s;
25+
double x_axis_rotation_c;
26+
AK::sincos(static_cast<double>(x_axis_rotation), x_axis_rotation_s, x_axis_rotation_c);
2627

2728
// Find the last point
2829
FloatPoint last_point { 0, 0 };
@@ -99,9 +100,9 @@ void Path::elliptical_arc_to(FloatPoint point, FloatSize radii, float x_axis_rot
99100
auto theta_delta = theta_2 - theta_1;
100101

101102
if (!sweep && theta_delta > 0.0) {
102-
theta_delta -= 2 * M_PI;
103+
theta_delta -= 2 * AK::Pi<double>;
103104
} else if (sweep && theta_delta < 0) {
104-
theta_delta += 2 * M_PI;
105+
theta_delta += 2 * AK::Pi<double>;
105106
}
106107

107108
elliptical_arc_to(

0 commit comments

Comments
 (0)