| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 #include "gm.h" | 8 #include "gm.h" |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 //#include "SkParsePath.h" | 10 //#include "SkParsePath.h" |
| 11 #include "SkPath.h" | 11 #include "SkPath.h" |
| 12 //#include "SkRandom.h" | 12 //#include "SkRandom.h" |
| 13 | 13 |
| 14 namespace skiagm { | 14 namespace skiagm { |
| 15 | 15 |
| 16 static const SkColor gPathColor = SK_ColorBLACK; | 16 static const SkColor gPathColor = SK_ColorBLACK; |
| 17 static const SkColor gClipAColor = SK_ColorBLUE; | 17 static const SkColor gClipAColor = SK_ColorBLUE; |
| 18 static const SkColor gClipBColor = SK_ColorRED; | 18 static const SkColor gClipBColor = SK_ColorRED; |
| 19 | 19 |
| 20 class ComplexClipGM : public GM { | 20 class ComplexClipGM : public GM { |
| 21 public: | 21 public: |
| 22 ComplexClipGM(bool aaclip, bool saveLayer, bool invertDraw) | 22 ComplexClipGM(bool aaclip, bool saveLayer, bool invertDraw) |
| 23 : fDoAAClip(aaclip) | 23 : fDoAAClip(aaclip) |
| 24 , fDoSaveLayer(saveLayer) | 24 , fDoSaveLayer(saveLayer) |
| 25 , fInvertDraw(invertDraw) { | 25 , fInvertDraw(invertDraw) { |
| 26 this->setBGColor(0xFFDDDDDD); | 26 this->setBGColor(0xFFDEDFDE); |
| 27 } | 27 } |
| 28 | 28 |
| 29 protected: | 29 protected: |
| 30 | 30 |
| 31 | 31 |
| 32 SkString onShortName() { | 32 SkString onShortName() { |
| 33 SkString str; | 33 SkString str; |
| 34 str.printf("complexclip_%s%s%s", | 34 str.printf("complexclip_%s%s%s", |
| 35 fDoAAClip ? "aa" : "bw", | 35 fDoAAClip ? "aa" : "bw", |
| 36 fDoSaveLayer ? "_layer" : "", | 36 fDoSaveLayer ? "_layer" : "", |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 SkPath clipB; | 76 SkPath clipB; |
| 77 clipB.moveTo(SkIntToScalar(40), SkIntToScalar(10)); | 77 clipB.moveTo(SkIntToScalar(40), SkIntToScalar(10)); |
| 78 clipB.lineTo(SkIntToScalar(190), SkIntToScalar(15)); | 78 clipB.lineTo(SkIntToScalar(190), SkIntToScalar(15)); |
| 79 clipB.lineTo(SkIntToScalar(195), SkIntToScalar(190)); | 79 clipB.lineTo(SkIntToScalar(195), SkIntToScalar(190)); |
| 80 clipB.lineTo(SkIntToScalar(40), SkIntToScalar(185)); | 80 clipB.lineTo(SkIntToScalar(40), SkIntToScalar(185)); |
| 81 clipB.lineTo(SkIntToScalar(155), SkIntToScalar(100)); | 81 clipB.lineTo(SkIntToScalar(155), SkIntToScalar(100)); |
| 82 clipB.close(); | 82 clipB.close(); |
| 83 | 83 |
| 84 SkPaint paint; | 84 SkPaint paint; |
| 85 paint.setAntiAlias(true); | 85 paint.setAntiAlias(true); |
| 86 sk_tool_utils::set_portable_typeface(&paint); | 86 sk_tool_utils::set_portable_typeface_always(&paint); |
| 87 paint.setTextSize(SkIntToScalar(20)); | 87 paint.setTextSize(SkIntToScalar(20)); |
| 88 | 88 |
| 89 static const struct { | 89 static const struct { |
| 90 SkRegion::Op fOp; | 90 SkRegion::Op fOp; |
| 91 const char* fName; | 91 const char* fName; |
| 92 } gOps[] = { //extra spaces in names for measureText | 92 } gOps[] = { //extra spaces in names for measureText |
| 93 {SkRegion::kIntersect_Op, "Isect "}, | 93 {SkRegion::kIntersect_Op, "Isect "}, |
| 94 {SkRegion::kDifference_Op, "Diff " }, | 94 {SkRegion::kDifference_Op, "Diff " }, |
| 95 {SkRegion::kUnion_Op, "Union "}, | 95 {SkRegion::kUnion_Op, "Union "}, |
| 96 {SkRegion::kXOR_Op, "Xor " }, | 96 {SkRegion::kXOR_Op, "Xor " }, |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 DEF_GM( return SkNEW_ARGS(ComplexClipGM, (false, false, false)); ) | 203 DEF_GM( return SkNEW_ARGS(ComplexClipGM, (false, false, false)); ) |
| 204 DEF_GM( return SkNEW_ARGS(ComplexClipGM, (false, false, true)); ) | 204 DEF_GM( return SkNEW_ARGS(ComplexClipGM, (false, false, true)); ) |
| 205 DEF_GM( return SkNEW_ARGS(ComplexClipGM, (false, true, false)); ) | 205 DEF_GM( return SkNEW_ARGS(ComplexClipGM, (false, true, false)); ) |
| 206 DEF_GM( return SkNEW_ARGS(ComplexClipGM, (false, true, true)); ) | 206 DEF_GM( return SkNEW_ARGS(ComplexClipGM, (false, true, true)); ) |
| 207 DEF_GM( return SkNEW_ARGS(ComplexClipGM, (true, false, false)); ) | 207 DEF_GM( return SkNEW_ARGS(ComplexClipGM, (true, false, false)); ) |
| 208 DEF_GM( return SkNEW_ARGS(ComplexClipGM, (true, false, true)); ) | 208 DEF_GM( return SkNEW_ARGS(ComplexClipGM, (true, false, true)); ) |
| 209 DEF_GM( return SkNEW_ARGS(ComplexClipGM, (true, true, false)); ) | 209 DEF_GM( return SkNEW_ARGS(ComplexClipGM, (true, true, false)); ) |
| 210 DEF_GM( return SkNEW_ARGS(ComplexClipGM, (true, true, true)); ) | 210 DEF_GM( return SkNEW_ARGS(ComplexClipGM, (true, true, true)); ) |
| 211 | 211 |
| 212 } | 212 } |
| OLD | NEW |