aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/strokefill.cpp
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2014-12-29 14:06:51 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-12-29 14:06:51 -0800
commit4f662e62cd44e302ef689fabdb2c0ae8d9471b02 (patch)
treefe32ac5d0e93b9137bc2f38ba0b6cbd06d4eecf7 /gm/strokefill.cpp
parentfe7c427e3d1c2c98bce7a3fa0ae6b5864527f169 (diff)
Update stroke path to use rect returned from isRect (to fix trailing moveTo bug)
This basically recreates what was done in: https://codereview.chromium.org/16950021/ (add rect-output parameter to isRect, allowing us to return the correct bounds even if a rectagular path has a trailing moveTo) with the addition of GM representation BUG=skia:247770 Review URL: https://codereview.chromium.org/834503002
Diffstat (limited to 'gm/strokefill.cpp')
-rw-r--r--gm/strokefill.cpp39
1 files changed, 37 insertions, 2 deletions
diff --git a/gm/strokefill.cpp b/gm/strokefill.cpp
index 85d7b6d5c4..4a29100e62 100644
--- a/gm/strokefill.cpp
+++ b/gm/strokefill.cpp
@@ -79,6 +79,42 @@ protected:
path2.addCircle(x + SkIntToScalar(360), y + SkIntToScalar(200), SkIntToScalar(50), SkPath::kCW_Direction);
SkASSERT(path2.cheapIsDirection(SkPath::kCW_Direction));
canvas->drawPath(path2, paint);
+
+ SkRect r = SkRect::MakeXYWH(x - SkIntToScalar(50), y + SkIntToScalar(280),
+ SkIntToScalar(100), SkIntToScalar(100));
+ SkPath path3;
+ path3.setFillType(SkPath::kWinding_FillType);
+ path3.addRect(r, SkPath::kCW_Direction);
+ r.inset(SkIntToScalar(10), SkIntToScalar(10));
+ path3.addRect(r, SkPath::kCCW_Direction);
+ canvas->drawPath(path3, paint);
+
+ r = SkRect::MakeXYWH(x + SkIntToScalar(70), y + SkIntToScalar(280),
+ SkIntToScalar(100), SkIntToScalar(100));
+ SkPath path4;
+ path4.setFillType(SkPath::kWinding_FillType);
+ path4.addRect(r, SkPath::kCCW_Direction);
+ r.inset(SkIntToScalar(10), SkIntToScalar(10));
+ path4.addRect(r, SkPath::kCW_Direction);
+ canvas->drawPath(path4, paint);
+
+ r = SkRect::MakeXYWH(x + SkIntToScalar(190), y + SkIntToScalar(280),
+ SkIntToScalar(100), SkIntToScalar(100));
+ path4.reset();
+ SkASSERT(!path4.cheapComputeDirection(NULL));
+ path4.addRect(r, SkPath::kCCW_Direction);
+ SkASSERT(path4.cheapIsDirection(SkPath::kCCW_Direction));
+ path4.moveTo(0, 0); // test for crbug.com/247770
+ canvas->drawPath(path4, paint);
+
+ r = SkRect::MakeXYWH(x + SkIntToScalar(310), y + SkIntToScalar(280),
+ SkIntToScalar(100), SkIntToScalar(100));
+ path4.reset();
+ SkASSERT(!path4.cheapComputeDirection(NULL));
+ path4.addRect(r, SkPath::kCW_Direction);
+ SkASSERT(path4.cheapIsDirection(SkPath::kCW_Direction));
+ path4.moveTo(0, 0); // test for crbug.com/247770
+ canvas->drawPath(path4, paint);
}
private:
@@ -87,7 +123,6 @@ private:
//////////////////////////////////////////////////////////////////////////////
-static GM* MyFactory(void*) { return new StrokeFillGM; }
-static GMRegistry reg(MyFactory);
+DEF_GM(return SkNEW(StrokeFillGM);)
}