[gtk/path-work-rebased: 35/36] contour: Fix winding for circle contour
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/path-work-rebased: 35/36] contour: Fix winding for circle contour
- Date: Thu, 7 Apr 2022 03:51:36 +0000 (UTC)
commit 86c1493b4b44294d310292eb6155f294e20cbdc6
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Mar 27 15:15:44 2022 -0400
contour: Fix winding for circle contour
Test included.
gsk/gskcontour.c | 4 ++--
testsuite/gsk/path-special-cases.c | 4 ++++
2 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/gsk/gskcontour.c b/gsk/gskcontour.c
index 330183af04..c978e91401 100644
--- a/gsk/gskcontour.c
+++ b/gsk/gskcontour.c
@@ -904,9 +904,9 @@ gsk_circle_contour_get_winding (const GskContour *contour,
if (fabs (self->start_angle - self->end_angle) >= 360)
{
if (self->start_angle < self->end_angle)
- return -1;
- else
return 1;
+ else
+ return -1;
}
return 0;
diff --git a/testsuite/gsk/path-special-cases.c b/testsuite/gsk/path-special-cases.c
index 79389b5c1a..d4431419ff 100644
--- a/testsuite/gsk/path-special-cases.c
+++ b/testsuite/gsk/path-special-cases.c
@@ -321,6 +321,10 @@ test_path_winding (void)
{ "M 100 100 L 200 100 L 300 200 L 300 0 Z", GRAPHENE_POINT_INIT (150, 100), TRUE },
{ "M 100 100 L 200 100 L 300 200 L 300 0 Z", GRAPHENE_POINT_INIT (250, 100), TRUE },
{ "M 100 100 L 200 100 L 300 200 L 300 0 Z", GRAPHENE_POINT_INIT (400, 100), FALSE },
+ /* the following check that our elementary contours wind as expected.
+ * our rect contour is clockwise, our circle contour is counterclockwise
+ */
+ { "M100,100h100v100h-100z M200,150A50,50,0,1,0,100,150A50,50,0,1,0,200,150z", GRAPHENE_POINT_INIT
(150,150), FALSE },
};
GskPath *path;
GskPathMeasure *measure;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]