diff options
author | caryclark <caryclark@google.com> | 2016-05-12 07:07:05 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-12 07:07:05 -0700 |
commit | 4cba202b7162fb5f364235dd29f0bdbd53a8e33c (patch) | |
tree | 61cfed4f6a515925bc6622c4a0bc1222d14c36a5 /gm/bug5252.cpp | |
parent | 9a9a7b29e5e5916a7b6453cd124ca437f14b9da4 (diff) |
fix hairline clip
Don't remove inner clip if it's non-rectangular.
Add cubic hairline clip code to quad and conic cases.
R=reed@google.com
BUG=skia:5252
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1943403006
Review-Url: https://codereview.chromium.org/1943403006
Diffstat (limited to 'gm/bug5252.cpp')
-rw-r--r-- | gm/bug5252.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/gm/bug5252.cpp b/gm/bug5252.cpp new file mode 100644 index 0000000000..981aab5b5a --- /dev/null +++ b/gm/bug5252.cpp @@ -0,0 +1,43 @@ +/* +* Copyright 2016 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 "SkCanvas.h" +#include "SkRect.h" +#include "SkPath.h" + +DEF_SIMPLE_GM(bug5252, canvas, 500, 500) { + canvas->translate(SkIntToScalar(10), SkIntToScalar(20)); + + SkPath clip1; + clip1.addOval(SkRect::MakeWH(225, 200)); + canvas->clipPath(clip1); // bug + + SkPath clip2; + clip2.addRect(SkRect::MakeWH(220, 200)); + //canvas->clipPath(clip2); // ok + + SkPaint pa; + pa.setStyle(SkPaint::kStroke_Style); + pa.setAntiAlias(true); + pa.setStrokeWidth(1.0f); + for (int i = 0; i < 15; i++) + { + for (int j = 0; j < 10; j++) + { + SkAutoCanvasRestore acs(canvas, true); + + canvas->translate(i * 15.f, j * 20.f); + canvas->drawRect(SkRect::MakeXYWH(5, 5, 10, 15),pa); + SkPath path; + path.moveTo(6, 6); + path.cubicTo(14, 10, 13, 12, 10, 12); + path.cubicTo(7, 15, 8, 17, 14, 18); + canvas->drawPath(path, pa); + } + } +} |