[gtk/path-ops: 6/25] curve: Small improvement




commit 7fe589756670678b79ee8dfd724c75e953d5c66d
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Mar 21 00:14:40 2022 -0400

    curve: Small improvement

 gsk/gskcurve.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/gsk/gskcurve.c b/gsk/gskcurve.c
index f72ad89e00..1e6673062e 100644
--- a/gsk/gskcurve.c
+++ b/gsk/gskcurve.c
@@ -863,8 +863,10 @@ gsk_curve_curve_get_curvature (const GskCurve *curve,
   get_derivatives (curve, t, &d, &dd);
 
   num = cross (&d, &dd);
-  denom = pow3 (graphene_vec2_length (&d));
+  if (num == 0)
+    return 0;
 
+  denom = pow3 (graphene_vec2_length (&d));
   if (denom == 0)
     return 0;
 
@@ -1584,8 +1586,10 @@ gsk_conic_curve_get_curvature (const GskCurve *curve,
   get_conic_derivatives (curve, t, &d, &dd);
 
   num = cross (&d, &dd);
-  denom = pow3 (graphene_vec2_length (&d));
+  if (num == 0)
+    return 0;
 
+  denom = pow3 (graphene_vec2_length (&d));
   if (denom == 0)
     return 0;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]