#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() {}
DEF_GM( return new CubicPathGM; )
DEF_GM( return new CubicClosePathGM; )
+DEF_GM( return new ClippedCubicGM; )