[gtk/matthiasc/lottie2] Fix gsk_rect_contour_get_closest_point
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/lottie2] Fix gsk_rect_contour_get_closest_point
- Date: Thu, 26 Nov 2020 00:28:04 +0000 (UTC)
commit 66231e7e2653204a78c63e7a5f9b0ca5932359ce
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..079b5ef128 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) < MIN (t.y, 1.f - t.y))
+ 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]