rendernode: Simplify conic gradient code
authorBenjamin Otte <otte@redhat.com>
Sun, 28 Nov 2021 07:00:52 +0000 (08:00 +0100)
committerBenjamin Otte <otte@redhat.com>
Tue, 30 Nov 2021 13:12:10 +0000 (14:12 +0100)
gsk/gskrendernodeimpl.c

index 76592973a2b845596f107e2841d1822b3fc08fcf..207e3e68de02745a5e8c072a8f96ebc2e5d98f8c 100644 (file)
@@ -828,18 +828,14 @@ project (double  angle,
 {
   double x, y;
 
-  x = radius * cos (angle);
-  y = radius * sin (angle);
-  if (copysign (x, 1.0) > copysign (y, 1.0))
-    {
-      *x_out = copysign (radius, x);
-      *y_out = y * radius / copysign (x, 1.0);
-    }
-  else
-    {
-      *x_out = x * radius / copysign (y, 1.0);
-      *y_out = copysign (radius, y);
-    }
+#ifdef HAVE_SINCOS
+  sincos (angle, &y, &x);
+#else
+  x = cos (angle);
+  y = sin (angle);
+#endif
+  *x_out = radius * x;
+  *y_out = radius * y;
 }
 
 static void