[gtk/matthiasc/lottie2] Fix gsk_rect_contour_get_closest_point




commit c43a06e6df7d5b672f364f915f94d511599e6ad7
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Nov 25 19:26:47 2020 -0500

    Fix gsk_rect_contour_get_closest_point
    
    The idea of roundf was good, the execution was imperfect.

 gsk/gskpath.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/gsk/gskpath.c b/gsk/gskpath.c
index 8bc81e23f1..e87d8ca4c2 100644
--- a/gsk/gskpath.c
+++ b/gsk/gskpath.c
@@ -315,11 +315,10 @@ gsk_rect_contour_get_closest_point (const GskContour       *contour,
   t.y = CLAMP (t.y, 0.f, 1.f);
   if (t.x > 0 && t.x < 1 && t.y > 0 && t.y < 1)
     {
-      if (roundf (t.x) * ABS (self->width) < 
-          roundf (t.y) * ABS (self->height))
-        t.x = roundf (1 - t.x);
+      if (MIN (t.x, 1.f - t.x) * self->width < MIN (t.y, 1.f - t.y) * self->height)
+        t.x = roundf (t.x);
       else
-        t.y = roundf (1 - t.y);
+        t.y = roundf (t.y);
     }
 
   p = GRAPHENE_POINT_INIT (self->x + t.x * self->width,


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