From 51959711a1e02c138671d6343d7d0d693586e35d Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 22 Nov 2020 15:56:25 -0500 Subject: 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 -- cgit v1.2.1