[gtk/matthiasc/lottie] Optimize a little bit



commit 51959711a1e02c138671d6343d7d0d693586e35d
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Nov 22 15:56:25 2020 -0500

    Optimize a little bit

 tests/curve-editor.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
---
diff --git a/tests/curve-editor.c b/tests/curve-editor.c
index be034f1aee..cca537de3c 100644
--- a/tests/curve-editor.c
+++ b/tests/curve-editor.c
@@ -214,25 +214,23 @@ find_line_point (graphene_point_t *a,
 
   tt = graphene_vec2_dot (&ap, &n) / graphene_vec2_dot (&n, &n);
 
-  if (tt < 0)
+  if (tt <= 0)
     {
       *pp = *a;
       *t = 0;
-      *d = graphene_point_distance (a, p, NULL, NULL);
     }
-  else if (tt > 1)
+  else if (tt >= 1)
     {
       *pp = *b;
       *t = 1;
-      *d = graphene_point_distance (b, p, NULL, NULL);
     }
   else
     {
       pp->x = a->x + tt * (b->x - a->x);
       pp->y = a->y + tt * (b->y - a->y);
       *t = tt;
-      *d = graphene_point_distance (pp, p, NULL, NULL);
     }
+  *d = graphene_point_distance (pp, p, NULL, NULL);
 }
 
 static void


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