diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-11-22 15:56:25 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-11-22 15:56:25 -0500 |
commit | 51959711a1e02c138671d6343d7d0d693586e35d (patch) | |
tree | 7ba173dbcf474fdf44716d82fd64ad2696b094fb | |
parent | 7c72d3c19d5a95a5ee3e2c9b1f80b837012f03ef (diff) | |
download | gtk+-51959711a1e02c138671d6343d7d0d693586e35d.tar.gz |
Optimize a little bit
-rw-r--r-- | tests/curve-editor.c | 8 |
1 files 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 |