From 41a33a1aa19cfcf864f21a02d66a395c801670dc Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Mon, 12 Oct 2015 00:27:34 -0400 Subject: [PATCH] Fixed the failing test. --- darwin/draw.m | 4 +++- test/drawtests.c | 19 ++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/darwin/draw.m b/darwin/draw.m index 6a7f6c25..644ada9e 100644 --- a/darwin/draw.m +++ b/darwin/draw.m @@ -160,7 +160,9 @@ void uiDrawStroke(uiDrawContext *c, uiDrawPath *path, uiDrawBrush *b, uiDrawStro cap, join, p->MiterLimit); - p2.fillMode = path->fillMode; + // always draw stroke fills using the winding rule + // otherwise intersecting figures won't draw correctly + p2.fillMode = uiDrawFillModeWinding; p2.ended = path->ended; uiDrawFill(c, &p2, b); // and clean up diff --git a/test/drawtests.c b/test/drawtests.c index 6d1004b6..7d3669ff 100644 --- a/test/drawtests.c +++ b/test/drawtests.c @@ -1154,27 +1154,28 @@ static void drawCSFillStyle(uiAreaDrawParams *p) uiDrawMatrix m; crsourcergba(&source, 0, 0, 0, 1); + sp.Cap = uiDrawLineCapFlat; sp.Join = uiDrawLineJoinMiter; sp.MiterLimit = uiDrawDefaultMiterLimit; sp.Thickness = 6; path = uiDrawNewPath(uiDrawFillModeAlternate); -// uiDrawPathAddRectangle(path, 12, 12, 232, 70); + uiDrawPathAddRectangle(path, 12, 12, 232, 70); uiDrawPathNewFigureWithArc(path, 64, 64, 40, 0, 2*M_PI, 0); -/* uiDrawPathNewFigureWithArc(path, + uiDrawPathNewFigureWithArc(path, 192, 64, 40, 0, -2*M_PI, 1); -*/ uiDrawPathEnd(path); + uiDrawPathEnd(path); crsourcergba(&source, 0, 0.7, 0, 1); -// uiDrawFill(p->Context, path, &source); + uiDrawFill(p->Context, path, &source); crsourcergba(&source, 0, 0, 0, 1); uiDrawStroke(p->Context, path, &source, &sp); uiDrawFreePath(path); @@ -1184,8 +1185,8 @@ static void drawCSFillStyle(uiAreaDrawParams *p) uiDrawTransform(p->Context, &m); path = uiDrawNewPath(uiDrawFillModeWinding); -// uiDrawPathAddRectangle(path, 12, 12, 232, 70); -/* uiDrawPathNewFigureWithArc(path, + uiDrawPathAddRectangle(path, 12, 12, 232, 70); + uiDrawPathNewFigureWithArc(path, 64, 64, 40, 0, 2*M_PI, @@ -1195,12 +1196,12 @@ static void drawCSFillStyle(uiAreaDrawParams *p) 40, 0, -2*M_PI, 1); -*/ uiDrawPathEnd(path); + uiDrawPathEnd(path); crsourcergba(&source, 0, 0, 0.9, 1); -// uiDrawFill(p->Context, path, &source); + uiDrawFill(p->Context, path, &source); crsourcergba(&source, 0, 0, 0, 1); -// uiDrawStroke(p->Context, path, &source, &sp); + uiDrawStroke(p->Context, path, &source, &sp); uiDrawFreePath(path); }