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

Unified Diff: gm/cubicpaths.cpp

Issue 15790006: add comment (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 7 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/cubicpaths.cpp
diff --git a/gm/cubicpaths.cpp b/gm/cubicpaths.cpp
index 9ab710a7ae9d441e28a45d14b77e179bca665dea..00a741234d30e6d55aaaa1ff0a9c006e189f1045 100644
--- a/gm/cubicpaths.cpp
+++ b/gm/cubicpaths.cpp
@@ -9,6 +9,47 @@
#include "SkPaint.h"
#include "SkRandom.h"
+// skbug.com/1316 shows that this cubic, when slightly clipped, creates big
+// (incorrect) changes to its control points.
+class ClippedCubicGM : public skiagm::GM {
+public:
+ ClippedCubicGM() {}
+
+protected:
+ SkString onShortName() {
+ return SkString("cubicpath");
+ }
+
+ SkISize onISize() { return SkISize::Make(1240, 390); }
+
+ virtual void onDraw(SkCanvas* canvas) {
+ SkPath path;
+ path.moveTo(0, 0);
+ path.cubicTo(140, 150, 40, 10, 170, 150);
+
+ SkPaint paint;
+ SkRect bounds = path.getBounds();
+
+ for (int dy = -1; dy <= 1; ++dy) {
+ canvas->save();
+ for (int dx = -1; dx <= 1; ++dx) {
+ canvas->save();
+ canvas->clipRect(bounds);
+ canvas->translate(dx, dy);
+ canvas->drawPath(path, paint);
+ canvas->restore();
+
+ canvas->translate(bounds.width(), 0);
+ }
+ canvas->restore();
+ canvas->translate(0, bounds.height());
+ }
+ }
+
+private:
+ typedef skiagm::GM INHERITED;
+};
+
class CubicPathGM : public skiagm::GM {
public:
CubicPathGM() {}
@@ -300,3 +341,4 @@ private:
DEF_GM( return new CubicPathGM; )
DEF_GM( return new CubicClosePathGM; )
+DEF_GM( return new ClippedCubicGM; )
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698