diff options
author | robertphillips <robertphillips@google.com> | 2015-05-19 04:35:38 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-19 04:35:39 -0700 |
commit | 2e5b4c52c59f838af0e0a2e5550dcffa4d3756cd (patch) | |
tree | 967fa9bbae25a644b6b1174eb28b6dcb686a8afa /gm/nested.cpp | |
parent | 50b58e6fbcc50785ceffacb2c51b22c6e67a7ab7 (diff) |
Fix GrAARectRenderer's handling of unsorted nested rects
What is going on here is that, after the mapPoints in fillAANestedRects, devInside was upside down so the isEmpty check was always firing. I don't see why we need to avoid having devInside sorted.
BUG=488103
Review URL: https://codereview.chromium.org/1135753004
Diffstat (limited to 'gm/nested.cpp')
-rw-r--r-- | gm/nested.cpp | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/gm/nested.cpp b/gm/nested.cpp index 3dd2c2c27e..518a864613 100644 --- a/gm/nested.cpp +++ b/gm/nested.cpp @@ -14,7 +14,7 @@ namespace skiagm { // Test out various combinations of nested rects, ovals and rrects. class NestedGM : public GM { public: - NestedGM(bool doAA) : fDoAA(doAA) { + NestedGM(bool doAA, bool flipped) : fDoAA(doAA), fFlipped(flipped) { this->setBGColor(0xFFDDDDDD); } @@ -22,6 +22,9 @@ protected: SkString onShortName() override { SkString name("nested"); + if (fFlipped) { + name.append("_flipY"); + } if (fDoAA) { name.append("_aa"); } else { @@ -87,9 +90,8 @@ protected: } } - canvas->translate(2, 2); + SkScalar xOff = 2, yOff = 2; for (int outerShape = 0; outerShape < kShapeCount; ++outerShape) { - canvas->save(); for (int innerShape = 0; innerShape < kShapeCount; ++innerShape) { for (size_t innerRect = 0; innerRect < SK_ARRAY_COUNT(innerRects); ++innerRect) { SkPath path; @@ -98,12 +100,23 @@ protected: AddShape(&path, innerRects[innerRect], (Shapes) innerShape, SkPath::kCCW_Direction); + canvas->save(); + if (fFlipped) { + canvas->scale(1.0f, -1.0f); + canvas->translate(xOff, -yOff - 40.0f); + } else { + canvas->translate(xOff, yOff); + } + canvas->drawPath(path, shapePaint); - canvas->translate(45, 0); + canvas->restore(); + + xOff += 45; } } - canvas->restore(); - canvas->translate(0, 45); + + xOff = 2; + yOff += 45; } } @@ -113,14 +126,16 @@ private: static const int kImageHeight = 134; bool fDoAA; + bool fFlipped; typedef GM INHERITED; }; /////////////////////////////////////////////////////////////////////////////// -DEF_GM( return new NestedGM(true); ) -DEF_GM( return new NestedGM(false); ) - +DEF_GM( return new NestedGM(/* doAA = */ true, /* flipped = */ false); ) +DEF_GM( return new NestedGM(/* doAA = */ false, /* flipped = */ false); ) +DEF_GM( return new NestedGM(/* doAA = */ true, /* flipped = */ true); ) +DEF_GM( return new NestedGM(/* doAA = */ false, /* flipped = */ true); ) } |