| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 #include "SampleCode.h" | 7 #include "SampleCode.h" |
| 8 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
| 9 #include "SkPath.h" | 9 #include "SkPath.h" |
| 10 #include "SkView.h" | 10 #include "SkView.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 paint.setStrokeWidth(0); | 72 paint.setStrokeWidth(0); |
| 73 | 73 |
| 74 canvas->translate(SkIntToScalar(10),SkIntToScalar(10)); | 74 canvas->translate(SkIntToScalar(10),SkIntToScalar(10)); |
| 75 canvas->drawPath(path, pathPaint); | 75 canvas->drawPath(path, pathPaint); |
| 76 paint.setColor(colorA); | 76 paint.setColor(colorA); |
| 77 canvas->drawPath(clipA, paint); | 77 canvas->drawPath(clipA, paint); |
| 78 paint.setColor(colorB); | 78 paint.setColor(colorB); |
| 79 canvas->drawPath(clipB, paint); | 79 canvas->drawPath(clipB, paint); |
| 80 | 80 |
| 81 static const struct { | 81 static const struct { |
| 82 SkRegion::Op fOp; | 82 SkCanvas::ClipOp fOp; |
| 83 const char* fName; | 83 const char* fName; |
| 84 } gOps[] = { //extra spaces in names for measureText | 84 } gOps[] = { //extra spaces in names for measureText |
| 85 {SkRegion::kIntersect_Op, "Isect "}, | 85 {SkCanvas::kIntersect_Op, "Isect "}, |
| 86 {SkRegion::kDifference_Op, "Diff " }, | 86 {SkCanvas::kDifference_Op, "Diff " }, |
| 87 {SkRegion::kUnion_Op, "Union "}, | 87 {SkCanvas::kUnion_Op, "Union "}, |
| 88 {SkRegion::kXOR_Op, "Xor " }, | 88 {SkCanvas::kXOR_Op, "Xor " }, |
| 89 {SkRegion::kReverseDifference_Op, "RDiff "} | 89 {SkCanvas::kReverseDifference_Op, "RDiff "} |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 canvas->translate(0, SkIntToScalar(40)); | 92 canvas->translate(0, SkIntToScalar(40)); |
| 93 canvas->scale(3 * SK_Scalar1 / 4, 3 * SK_Scalar1 / 4); | 93 canvas->scale(3 * SK_Scalar1 / 4, 3 * SK_Scalar1 / 4); |
| 94 canvas->save(); | 94 canvas->save(); |
| 95 | 95 |
| 96 for (int invA = 0; invA < 2; ++invA) { | 96 for (int invA = 0; invA < 2; ++invA) { |
| 97 for (size_t op = 0; op < SK_ARRAY_COUNT(gOps); ++op) { | 97 for (size_t op = 0; op < SK_ARRAY_COUNT(gOps); ++op) { |
| 98 size_t idx = invA * SK_ARRAY_COUNT(gOps) + op; | 98 size_t idx = invA * SK_ARRAY_COUNT(gOps) + op; |
| 99 if (!(idx % 3)) { | 99 if (!(idx % 3)) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 } | 143 } |
| 144 | 144 |
| 145 private: | 145 private: |
| 146 typedef SampleView INHERITED; | 146 typedef SampleView INHERITED; |
| 147 }; | 147 }; |
| 148 | 148 |
| 149 ////////////////////////////////////////////////////////////////////////////// | 149 ////////////////////////////////////////////////////////////////////////////// |
| 150 | 150 |
| 151 static SkView* MyFactory() { return new ComplexClipView; } | 151 static SkView* MyFactory() { return new ComplexClipView; } |
| 152 static SkViewRegister reg(MyFactory); | 152 static SkViewRegister reg(MyFactory); |
| OLD | NEW |