Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1068)

Unified Diff: gm/nested.cpp

Issue 1135753004: Fix GrAARectRenderer's handling of unsorted nested rects (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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/gpu/GrAARectRenderer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/nested.cpp
diff --git a/gm/nested.cpp b/gm/nested.cpp
index 3dd2c2c27e3e584331d838219639905dadd9e73e..518a864613faed5d278425e04548f5f64a6c36c0 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); )
}
« no previous file with comments | « no previous file | src/gpu/GrAARectRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698