diff options
author | caryclark <caryclark@google.com> | 2015-08-21 13:47:06 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-21 13:47:06 -0700 |
commit | 21b998b181bedcd92c3a0460d29492312c0cdc89 (patch) | |
tree | 6eb2e1aa25ee22ae2488e28b84cd983c1f90b072 /gm | |
parent | dd3c165828fffb369d0f4b13b48381169a0249a9 (diff) |
Revert of experiment with zero-length round capped line segments (patchset #4 id:60001 of https://codereview.chromium.org/1309753002/ )
Reason for revert:
More GMs changed than I expected. Will probably affect layout tests as well; reverting until I can verify that the changes are correct.
Original issue's description:
> experiment with zero-length round capped line segments
>
> If the endcap is not butt, draw the endcaps even when the line
> has zero length.
>
> If the dash length is zero, generate a zero length line segment.
>
> Treat a move followed by a close as a move followed by a zero-length
> line.
>
> R=reed@google.com,schenney@google.com
> BUG=422974
>
> Committed: https://skia.googlesource.com/skia/+/dd3c165828fffb369d0f4b13b48381169a0249a9
TBR=reed@google.com,schenney@google.com,schenney@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=422974
Review URL: https://codereview.chromium.org/1304163008
Diffstat (limited to 'gm')
-rw-r--r-- | gm/strokes.cpp | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/gm/strokes.cpp b/gm/strokes.cpp index e914d0a0b7..73823907a3 100644 --- a/gm/strokes.cpp +++ b/gm/strokes.cpp @@ -8,8 +8,6 @@ #include "gm.h" #include "SkPath.h" #include "SkRandom.h" -#include "SkDashPathEffect.h" -#include "SkParsePath.h" #define W 400 #define H 400 @@ -78,76 +76,6 @@ private: typedef skiagm::GM INHERITED; }; -/* See - https://code.google.com/p/chromium/issues/detail?id=422974 and - http://jsfiddle.net/1xnku3sg/2/ - */ -class ZeroLenStrokesGM : public skiagm::GM { - SkPath fMoveHfPath, fMoveZfPath, fDashedfPath, fRefPath[4]; -protected: - void onOnceBeforeDraw() override { - - SkAssertResult(SkParsePath::FromSVGString("M0,0h0M10,0h0M20,0h0", &fMoveHfPath)); - SkAssertResult(SkParsePath::FromSVGString("M0,0zM10,0zM20,0z", &fMoveZfPath)); - SkAssertResult(SkParsePath::FromSVGString("M0,0h25", &fDashedfPath)); - - for (int i = 0; i < 3; ++i) { - fRefPath[0].addCircle(i * 10.f, 0, 5); - fRefPath[1].addCircle(i * 10.f, 0, 10); - fRefPath[2].addRect(i * 10.f - 4, -2, i * 10.f + 4, 6); - fRefPath[3].addRect(i * 10.f - 10, -10, i * 10.f + 10, 10); - } - } - - SkString onShortName() override { - return SkString("zeroPath"); - } - - SkISize onISize() override { - return SkISize::Make(W, H*2); - } - - void onDraw(SkCanvas* canvas) override { - SkPaint fillPaint, strokePaint, dashPaint; - fillPaint.setAntiAlias(true); - strokePaint = fillPaint; - strokePaint.setStyle(SkPaint::kStroke_Style); - for (int i = 0; i < 2; ++i) { - fillPaint.setAlpha(255); - strokePaint.setAlpha(255); - strokePaint.setStrokeWidth(i ? 8.f : 10.f); - strokePaint.setStrokeCap(i ? SkPaint::kSquare_Cap : SkPaint::kRound_Cap); - canvas->save(); - canvas->translate(10 + i * 100.f, 10); - canvas->drawPath(fMoveHfPath, strokePaint); - canvas->translate(0, 20); - canvas->drawPath(fMoveZfPath, strokePaint); - dashPaint = strokePaint; - const SkScalar intervals[] = { 0, 10 }; - dashPaint.setPathEffect(SkDashPathEffect::Create(intervals, 2, 0))->unref(); - SkPath fillPath; - dashPaint.getFillPath(fDashedfPath, &fillPath); - canvas->translate(0, 20); - canvas->drawPath(fDashedfPath, dashPaint); - canvas->translate(0, 20); - canvas->drawPath(fRefPath[i * 2], fillPaint); - strokePaint.setStrokeWidth(20); - strokePaint.setAlpha(127); - canvas->translate(0, 50); - canvas->drawPath(fMoveHfPath, strokePaint); - canvas->translate(0, 30); - canvas->drawPath(fMoveZfPath, strokePaint); - canvas->translate(0, 30); - fillPaint.setAlpha(127); - canvas->drawPath(fRefPath[1 + i * 2], fillPaint); - canvas->restore(); - } - } - -private: - typedef skiagm::GM INHERITED; -}; - class Strokes2GM : public skiagm::GM { SkPath fPath; protected: @@ -350,5 +278,3 @@ static skiagm::GMRegistry R0(F0); static skiagm::GMRegistry R1(F1); static skiagm::GMRegistry R2(F2); static skiagm::GMRegistry R3(F3); - -DEF_GM(return SkNEW(ZeroLenStrokesGM);) |