diff options
author | 2015-11-18 06:21:35 -0800 | |
---|---|---|
committer | 2015-11-18 06:21:35 -0800 | |
commit | 9c08b9d3f0616b24d1d378ef6212dde08112f06c (patch) | |
tree | fd676a0733bc1094fbe09835139827e95fad563c | |
parent | 059dbe1a319f28646f33a92d6a2f17fc721f2b16 (diff) |
Revert of Parametric contour start GM (patchset #1 id:1 of https://codereview.chromium.org/1457503002/ )
Reason for revert:
Breaks unit test across various platforms:
../../../src/gpu/batches/GrStencilAndCoverPathRenderer.cpp:75: failed assertion "path->isEqualTo(skPath, stroke)"
Original issue's description:
> Parametric contour start GM
>
> A GM to capture the newly added SkPath API.
>
> BUG=chromium:315277
> R=caryclark@google.com,reed@google.com
>
> Committed: https://skia.googlesource.com/skia/+/56847a65648af4d06da9c26c55242949a1bf31ab
TBR=caryclark@google.com,reed@google.com,fmalita@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:315277
Review URL: https://codereview.chromium.org/1456973002
-rw-r--r-- | gm/pathcontourstart.cpp | 133 |
1 files changed, 0 insertions, 133 deletions
diff --git a/gm/pathcontourstart.cpp b/gm/pathcontourstart.cpp deleted file mode 100644 index de3644c9f1..0000000000 --- a/gm/pathcontourstart.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "gm.h" - -#include "SkDashPathEffect.h" -#include "SkPaint.h" -#include "SkPath.h" -#include "SkRRect.h" - -namespace skiagm { - -class ContourStartGM : public GM { -public: - ContourStartGM() { - const SkScalar kMaxDashLen = 100; - const SkScalar kDashGrowth = 1.2f; - - SkSTArray<100, SkScalar> intervals; - for (SkScalar len = 1; len < kMaxDashLen; len *= kDashGrowth) { - intervals.push_back(len); - intervals.push_back(len); - } - - SkAutoTUnref<SkPathEffect> effect( - SkDashPathEffect::Create(intervals.begin(), intervals.count(), 0)); - - fDashPaint.setAntiAlias(true); - fDashPaint.setStyle(SkPaint::kStroke_Style); - fDashPaint.setStrokeWidth(6); - fDashPaint.setColor(0xff008000); - fDashPaint.setPathEffect(effect); - - fPointsPaint.setColor(0xff800000); - fPointsPaint.setStrokeWidth(3); - - fRect = SkRect::MakeLTRB(10, 10, 100, 70); - } - -protected: - SkString onShortName() override { - return SkString("contour_start"); - } - - SkISize onISize() override { return SkISize::Make(kImageWidth, kImageHeight); } - - void onDraw(SkCanvas* canvas) override { - - drawDirs(canvas, [](const SkRect& rect, SkPath::Direction dir, unsigned startIndex) { - SkPath path; - path.addRect(rect, dir, startIndex); - return path; - }); - - drawDirs(canvas, [](const SkRect& rect, SkPath::Direction dir, unsigned startIndex) { - SkPath path; - path.addOval(rect, dir, startIndex); - return path; - }); - - drawDirs(canvas, [](const SkRect& rect, SkPath::Direction dir, unsigned startIndex) { - SkRRect rrect; - const SkVector radii[4] = { {15, 15}, {15, 15}, {15, 15}, {15, 15}}; - rrect.setRectRadii(rect, radii); - - SkPath path; - path.addRRect(rrect, dir, startIndex); - return path; - }); - - drawDirs(canvas, [](const SkRect& rect, SkPath::Direction dir, unsigned startIndex) { - SkRRect rrect; - rrect.setRect(rect); - - SkPath path; - path.addRRect(rrect, dir, startIndex); - return path; - }); - - drawDirs(canvas, [](const SkRect& rect, SkPath::Direction dir, unsigned startIndex) { - SkRRect rrect; - rrect.setOval(rect); - - SkPath path; - path.addRRect(rrect, dir, startIndex); - return path; - }); - - } - -private: - static const int kImageWidth = 1200; - static const int kImageHeight = 600; - - SkPaint fDashPaint, fPointsPaint; - SkRect fRect; - - void drawDirs(SkCanvas* canvas, - SkPath (*makePath)(const SkRect&, SkPath::Direction, unsigned)) const { - drawOneColumn(canvas, SkPath::kCW_Direction, makePath); - canvas->translate(kImageWidth / 10, 0); - drawOneColumn(canvas, SkPath::kCCW_Direction, makePath); - canvas->translate(kImageWidth / 10, 0); - } - - void drawOneColumn(SkCanvas* canvas, SkPath::Direction dir, - SkPath (*makePath)(const SkRect&, SkPath::Direction, unsigned)) const { - SkAutoCanvasRestore acr(canvas, true); - - for (unsigned i = 0; i < 8; ++i) { - const SkPath path = makePath(fRect, dir, i); - canvas->drawPath(path, fDashPaint); - - const int n = path.countPoints(); - SkAutoTArray<SkPoint> points(n); - path.getPoints(points.get(), n); - canvas->drawPoints(SkCanvas::kPoints_PointMode, n, points.get(), fPointsPaint); - - canvas->translate(0, kImageHeight / 8); - } - } - - typedef GM INHERITED; -}; - -DEF_GM( return new ContourStartGM(); ) - -} // namespace skiagm - |