aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/pathinterior.cpp
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-12-05 05:34:51 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-12-05 05:34:51 +0000
commit3b8f472307fd01c8768d493121c57f7cf999734f (patch)
tree1447343be2511eb206becec5dc0d7f2a13ddac2a /gm/pathinterior.cpp
parent73b140a9f668c189b0682cc5f82d9fb57ff8bc15 (diff)
add test for adding outer contour first and second
git-svn-id: http://skia.googlecode.com/svn/trunk@6670 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gm/pathinterior.cpp')
-rw-r--r--gm/pathinterior.cpp62
1 files changed, 33 insertions, 29 deletions
diff --git a/gm/pathinterior.cpp b/gm/pathinterior.cpp
index fbae9f68be..2fde16259b 100644
--- a/gm/pathinterior.cpp
+++ b/gm/pathinterior.cpp
@@ -26,7 +26,7 @@ public:
protected:
virtual SkISize onISize() {
- return SkISize::Make(960, 480);
+ return SkISize::Make(770, 770);
}
virtual SkString onShortName() SK_OVERRIDE {
@@ -58,39 +58,43 @@ protected:
}
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
- canvas->translate(8, 8);
+ canvas->translate(8.5f, 8.5f);
- const SkRect rect = { 0, 0, 100, 100 };
+ const SkRect rect = { 0, 0, 80, 80 };
const SkScalar RAD = rect.width()/8;
int i = 0;
- for (int doEvenOdd = 0; doEvenOdd <= 1; ++doEvenOdd) {
- for (int outerRR = 0; outerRR <= 1; ++outerRR) {
- for (int innerRR = 0; innerRR <= 1; ++innerRR) {
- for (int outerCW = 0; outerCW <= 1; ++outerCW) {
- for (int innerCW = 0; innerCW <= 1; ++innerCW) {
- SkPath path;
- path.setFillType(doEvenOdd ? SkPath::kEvenOdd_FillType : SkPath::kWinding_FillType);
- SkPath::Direction outerDir = outerCW ? SkPath::kCW_Direction : SkPath::kCCW_Direction;
- SkPath::Direction innerDir = innerCW ? SkPath::kCW_Direction : SkPath::kCCW_Direction;
- if (outerRR) {
- path.addRoundRect(rect, RAD, RAD, outerDir);
- } else {
- path.addRect(rect, outerDir);
+ for (int insetFirst = 0; insetFirst <= 1; ++insetFirst) {
+ for (int doEvenOdd = 0; doEvenOdd <= 1; ++doEvenOdd) {
+ for (int outerRR = 0; outerRR <= 1; ++outerRR) {
+ for (int innerRR = 0; innerRR <= 1; ++innerRR) {
+ for (int outerCW = 0; outerCW <= 1; ++outerCW) {
+ for (int innerCW = 0; innerCW <= 1; ++innerCW) {
+ SkPath path;
+ path.setFillType(doEvenOdd ? SkPath::kEvenOdd_FillType : SkPath::kWinding_FillType);
+ SkPath::Direction outerDir = outerCW ? SkPath::kCW_Direction : SkPath::kCCW_Direction;
+ SkPath::Direction innerDir = innerCW ? SkPath::kCW_Direction : SkPath::kCCW_Direction;
+
+ SkRect r = insetFirst ? inset(rect) : rect;
+ if (outerRR) {
+ path.addRoundRect(r, RAD, RAD, outerDir);
+ } else {
+ path.addRect(r, outerDir);
+ }
+ r = insetFirst ? rect : inset(rect);
+ if (innerRR) {
+ path.addRoundRect(r, RAD, RAD, innerDir);
+ } else {
+ path.addRect(r, innerDir);
+ }
+
+ SkScalar dx = (i / 8) * rect.width() * 6 / 5;
+ SkScalar dy = (i % 8) * rect.height() * 6 / 5;
+ i++;
+ path.offset(dx, dy);
+
+ this->show(canvas, path);
}
- SkRect inner = inset(rect);
- if (innerRR) {
- path.addRoundRect(inner, RAD, RAD, innerDir);
- } else {
- path.addRect(inner, innerDir);
- }
-
- SkScalar dx = (i / 4) * rect.width() * 6 / 5;
- SkScalar dy = (i % 4) * rect.height() * 6 / 5;
- i++;
- path.offset(dx, dy);
-
- this->show(canvas, path);
}
}
}