Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Unified Diff: gm/dashcubics.cpp

Issue 948043002: break out of cubic stroker loop on degenerate case (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: find root cause for dash cubic failure; add more tests Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkStroke.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/dashcubics.cpp
diff --git a/gm/dashcubics.cpp b/gm/dashcubics.cpp
index 9a7d6d7482662a15de7be0101fd2d3c18980dad7..246d0548ca41835dc51b25cf05f4f4b0a8b3df74 100644
--- a/gm/dashcubics.cpp
+++ b/gm/dashcubics.cpp
@@ -26,30 +26,16 @@ protected:
}
virtual SkISize onISize() {
- return SkISize::Make(640, 480);
+ return SkISize::Make(860, 700);
}
- virtual void onDraw(SkCanvas* canvas) {
- SkPath path;
- const char* d = "M 337,98 C 250,141 250,212 250,212 C 250,212 250,212 250,212"
- "C 250,212 250,212 250,212 C 250,212 250,141 163,98 C 156,195 217,231 217,231"
- "C 217,231 217,231 217,231 C 217,231 217,231 217,231 C 217,231 156,195 75,250"
- "C 156,305 217,269 217,269 C 217,269 217,269 217,269 C 217,269 217,269 217,269"
- "C 217,269 156,305 163,402 C 250,359 250,288 250,288 C 250,288 250,288 250,288"
- "C 250,288 250,288 250,288 C 250,288 250,359 338,402 C 345,305 283,269 283,269"
- "C 283,269 283,269 283,269 C 283,269 283,269 283,269 C 283,269 345,305 425,250"
- "C 344,195 283,231 283,231 C 283,231 283,231 283,231 C 283,231 283,231 283,231"
- "C 283,231 344,195 338,98";
-
- SkParsePath::FromSVGString(d, &path);
-
- SkScalar intervals[] = { 5, 10 };
+ void flower(SkCanvas* canvas, const SkPath& path, SkScalar intervals[2], SkPaint::Join join) {
SkPathEffect* pe = SkDashPathEffect::Create(intervals, 2, 0);
SkPaint paint;
paint.setAntiAlias(true);
paint.setStyle(SkPaint::kStroke_Style);
-
+ paint.setStrokeJoin(join);
paint.setStrokeWidth(42);
canvas->drawPath(path, paint);
@@ -64,6 +50,31 @@ protected:
canvas->drawPath(path, paint);
}
+ virtual void onDraw(SkCanvas* canvas) {
+ SkPath path;
+ const char* d = "M 337,98 C 250,141 250,212 250,212 C 250,212 250,212 250,212"
+ "C 250,212 250,212 250,212 C 250,212 250,141 163,98 C 156,195 217,231 217,231"
+ "C 217,231 217,231 217,231 C 217,231 217,231 217,231 C 217,231 156,195 75,250"
+ "C 156,305 217,269 217,269 C 217,269 217,269 217,269 C 217,269 217,269 217,269"
+ "C 217,269 156,305 163,402 C 250,359 250,288 250,288 C 250,288 250,288 250,288"
+ "C 250,288 250,288 250,288 C 250,288 250,359 338,402 C 345,305 283,269 283,269"
+ "C 283,269 283,269 283,269 C 283,269 283,269 283,269 C 283,269 345,305 425,250"
+ "C 344,195 283,231 283,231 C 283,231 283,231 283,231 C 283,231 283,231 283,231"
+ "C 283,231 344,195 338,98";
+
+ SkParsePath::FromSVGString(d, &path);
+ canvas->translate(-35.f, -55.f);
+ for (int x = 0; x < 2; ++x) {
+ for (int y = 0; y < 2; ++y) {
+ canvas->save();
+ canvas->translate(x * 430.f, y * 355.f);
+ SkScalar intervals[] = { 5 + (x ? 0 : 0.0001f + 0.0001f), 10 };
+ flower(canvas, path, intervals, y ? SkPaint::kDefault_Join : SkPaint::kRound_Join);
+ canvas->restore();
+ }
+ }
+ }
+
private:
typedef GM INHERITED;
};
« no previous file with comments | « no previous file | src/core/SkStroke.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698