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

Unified Diff: trunk/gm/cubicpaths.cpp

Issue 12567006: fix handling of stroked cubics when we exhaust our recursion limit. (Closed) Base URL: http://skia.googlecode.com/svn/
Patch Set: Created 7 years, 9 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 | trunk/src/core/SkStroke.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/gm/cubicpaths.cpp
===================================================================
--- trunk/gm/cubicpaths.cpp (revision 8048)
+++ trunk/gm/cubicpaths.cpp (working copy)
@@ -296,8 +296,60 @@
typedef skiagm::GM INHERITED;
};
+#include "SkGeometry.h"
+
+class TrickyStrokeCubicGM : public skiagm::GM {
+public:
+ TrickyStrokeCubicGM() {}
+
+protected:
+ SkString onShortName() {
+ return SkString("strokecubic");
+ }
+
+ SkISize onISize() { return SkISize::Make(640, 480); }
+
+ virtual void onDraw(SkCanvas* canvas) {
+ const SkPoint pts[] = {{10,20}, {0,40}, {10,0}, {50,10}};
+ SkPath path;
+
+ path.moveTo(pts[0]);
+ path.cubicTo(pts[1], pts[2], pts[3]);
+
+ SkRect srcR;
+ // hone in on the interesting part of the cubic
+ srcR.set(6, 23, 9, 27);
+
+ SkMatrix matrix;
+ matrix.setRectToRect(srcR, SkRect::MakeLTRB(10, 10, 630, 470),
+ SkMatrix::kCenter_ScaleToFit);
+ canvas->concat(matrix);
+
+ SkPaint paint;
+ paint.setStyle(SkPaint::kStroke_Style);
+ paint.setStrokeWidth(0.15f);
+ SkPath stroke;
+ paint.getFillPath(path, &stroke);
+
+ paint.setAntiAlias(true);
+ paint.setColor(SK_ColorLTGRAY);
+ canvas->drawPath(path, paint);
+
+ paint.setStrokeWidth(0);
+ paint.setColor(SK_ColorBLUE);
+ canvas->drawPath(path, paint);
+
+ paint.setColor(SK_ColorRED);
+ canvas->drawPath(stroke, paint);
+ }
+
+private:
+ typedef skiagm::GM INHERITED;
+};
+
//////////////////////////////////////////////////////////////////////////////
DEF_GM( return new CubicPathGM; )
DEF_GM( return new CubicClosePathGM; )
+DEF_GM( return new TrickyStrokeCubicGM; )
« no previous file with comments | « no previous file | trunk/src/core/SkStroke.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698