From 6220baf230ebd3325d4408c7f3da543a5cb6a480 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 9 Aug 2023 15:06:58 -0400 Subject: [PATCH] get_closest_point: Prefer earlier points Only switch to a later point if it is strictly closer than the existing match. This fixes start- vs endpoint confusion in the rectangle tests. --- gsk/gskcontour.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gsk/gskcontour.c b/gsk/gskcontour.c index 31b974f964..d49bd8cd3c 100644 --- a/gsk/gskcontour.c +++ b/gsk/gskcontour.c @@ -451,7 +451,8 @@ gsk_standard_contour_get_closest_point (const GskContour *contour, continue; gsk_curve_init (&c, self->ops[i]); - if (gsk_curve_get_closest_point (&c, point, threshold, &distance, &t)) + if (gsk_curve_get_closest_point (&c, point, threshold, &distance, &t) && + distance < threshold) { best_idx = i; best_t = t;