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: gm/cubicpaths.cpp

Issue 1299243002: subdivide path when side-clipping fails (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add init to avoid warning Created 5 years, 4 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/SkEdgeClipper.cpp » ('j') | src/core/SkEdgeClipper.cpp » ('J')
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 74fbe8d58b376b56b144d6d3beaedb49aaa26563..ca6c057ec02f70761252655659d2232b098b7fb2 100644
--- a/gm/cubicpaths.cpp
+++ b/gm/cubicpaths.cpp
@@ -53,6 +53,58 @@ private:
typedef skiagm::GM INHERITED;
};
+
+class ClippedCubic2GM : public skiagm::GM {
+public:
+ ClippedCubic2GM() {}
+
+protected:
+
+ SkString onShortName() {
+ return SkString("clippedcubic2");
+ }
+
+ SkISize onISize() { return SkISize::Make(1240, 390); }
+
+ void onDraw(SkCanvas* canvas) override {
+ canvas->save();
+ canvas->translate(-2, 20);
+ drawOne(canvas, fPath, SkRect::MakeLTRB(0, 0, 80, 150));
+ canvas->translate(0, 170);
+ drawOne(canvas, fPath, SkRect::MakeLTRB(0, 0, 80, 100));
+ canvas->translate(0, 170);
+ drawOne(canvas, fPath, SkRect::MakeLTRB(0, 0, 30, 150));
+ canvas->translate(0, 170);
+ drawOne(canvas, fPath, SkRect::MakeLTRB(0, 0, 10, 150));
+ canvas->restore();
+ }
+
+ void drawOne(SkCanvas* canvas, const SkPath& path, const SkRect& clip) {
+ SkPaint framePaint, fillPaint;
+ framePaint.setStyle(SkPaint::kStroke_Style);
+ canvas->drawRect(clip, framePaint);
+ canvas->drawPath(path, framePaint);
+ canvas->save();
+ canvas->clipRect(clip);
+ canvas->drawPath(path, fillPaint);
+ canvas->restore();
+ }
+
+ void onOnceBeforeDraw() override {
+ fPath.moveTo(69.7030518991886f, 0);
+ fPath.cubicTo( 69.7030518991886f, 21.831149999999997f,
+ 58.08369508178456f, 43.66448333333333f, 34.8449814469765f, 65.5f);
+ fPath.cubicTo( 11.608591683531916f, 87.33115f, -0.010765133872116195f, 109.16448333333332f,
+ -0.013089005235602302f, 131);
+ fPath.close();
+ }
+
+ SkPath fPath;
+private:
+ typedef skiagm::GM INHERITED;
+};
+
+
class CubicPathGM : public skiagm::GM {
public:
CubicPathGM() {}
@@ -347,3 +399,4 @@ private:
DEF_GM( return new CubicPathGM; )
DEF_GM( return new CubicClosePathGM; )
DEF_GM( return new ClippedCubicGM; )
+DEF_GM( return new ClippedCubic2GM; )
« no previous file with comments | « no previous file | src/core/SkEdgeClipper.cpp » ('j') | src/core/SkEdgeClipper.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698