more path is rect bugs
More edge cases found; clean up the logic a bit
to make more clear where the rectangle points
start and stop.
R=robertphillips@google.com,brianosman@google.com
Bug: 824145,skia:7792
Change-Id: Ie24dfd1519f30875f44ffac68e20d777490b00b9
Reviewed-on: https://skia-review.googlesource.com/120422
Commit-Queue: Cary Clark <caryclark@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/gm/pathfill.cpp b/gm/pathfill.cpp
index d96f356..af91b84 100644
--- a/gm/pathfill.cpp
+++ b/gm/pathfill.cpp
@@ -432,3 +432,70 @@
DEF_GM( return new PathFillGM; )
DEF_GM( return new PathInverseFillGM; )
+
+DEF_SIMPLE_GM(bug7792, canvas, 800, 200) {
+ // from skbug.com/7792 bug description
+ SkPaint p;
+ SkPath path;
+ path.moveTo(10, 10);
+ path.moveTo(75, 75);
+ path.lineTo(150, 75);
+ path.lineTo(150, 150);
+ path.lineTo(75, 150);
+ canvas->drawPath(path, p);
+ // from skbug.com/7792 comment 3
+ canvas->translate(200, 0);
+ path.reset();
+ path.moveTo(75, 50);
+ path.moveTo(100, 75);
+ path.lineTo(150, 75);
+ path.lineTo(150, 150);
+ path.lineTo(75, 150);
+ path.lineTo(75, 50);
+ path.close();
+ canvas->drawPath(path, p);
+ // from skbug.com/7792 comment 9
+ canvas->translate(200, 0);
+ path.reset();
+ path.moveTo(10, 10);
+ path.moveTo(75, 75);
+ path.lineTo(150, 75);
+ path.lineTo(150, 150);
+ path.lineTo(75, 150);
+ path.close();
+ canvas->drawPath(path, p);
+ // from skbug.com/7792 comment 11
+ canvas->translate(-200 * 2, 200);
+ path.reset();
+ path.moveTo(75, 150);
+ path.lineTo(75, 75);
+ path.lineTo(150, 75);
+ path.lineTo(150, 150);
+ path.lineTo(75, 150);
+ path.moveTo(75, 150);
+ canvas->drawPath(path, p);
+ // from skbug.com/7792 comment 14
+ canvas->translate(200, 0);
+ path.reset();
+ path.moveTo(250, 75);
+ path.moveTo(250, 75);
+ path.moveTo(250, 75);
+ path.moveTo(100, 75);
+ path.lineTo(150, 75);
+ path.lineTo(150, 150);
+ path.lineTo(75, 150);
+ path.lineTo(75, 75);
+ path.close();
+ path.lineTo(0, 0);
+ path.close();
+ canvas->drawPath(path, p);
+ // from skbug.com/7792 comment 15
+ canvas->translate(200, 0);
+ path.reset();
+ path.moveTo(75, 75);
+ path.lineTo(150, 75);
+ path.lineTo(150, 150);
+ path.lineTo(75, 150);
+ path.moveTo(250, 75);
+ canvas->drawPath(path, p);
+}