| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 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 "SkPath.h" | 10 #include "SkPath.h" |
| 11 | 11 |
| 12 namespace skiagm { | 12 namespace skiagm { |
| 13 | 13 |
| 14 static const SkColor gPathColor = SK_ColorYELLOW; | 14 static const SkColor gPathColor = SK_ColorYELLOW; |
| 15 | 15 |
| 16 class ComplexClip3GM : public GM { | 16 class ComplexClip3GM : public GM { |
| 17 public: | 17 public: |
| 18 ComplexClip3GM(bool doSimpleClipFirst) | 18 ComplexClip3GM(bool doSimpleClipFirst) |
| 19 : fDoSimpleClipFirst(doSimpleClipFirst) { | 19 : fDoSimpleClipFirst(doSimpleClipFirst) { |
| 20 this->setBGColor(0xFFDDDDDD); | 20 this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); |
| 21 } | 21 } |
| 22 | 22 |
| 23 protected: | 23 protected: |
| 24 | 24 |
| 25 SkString onShortName() { | 25 SkString onShortName() { |
| 26 SkString str; | 26 SkString str; |
| 27 str.printf("complexclip3_%s", fDoSimpleClipFirst ? "simple" : "complex")
; | 27 str.printf("complexclip3_%s", fDoSimpleClipFirst ? "simple" : "complex")
; |
| 28 return str; | 28 return str; |
| 29 } | 29 } |
| 30 | 30 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 42 | 42 |
| 43 SkPath* firstClip = &clipSimple; | 43 SkPath* firstClip = &clipSimple; |
| 44 SkPath* secondClip = &clipComplex; | 44 SkPath* secondClip = &clipComplex; |
| 45 | 45 |
| 46 if (!fDoSimpleClipFirst) { | 46 if (!fDoSimpleClipFirst) { |
| 47 SkTSwap<SkPath*>(firstClip, secondClip); | 47 SkTSwap<SkPath*>(firstClip, secondClip); |
| 48 } | 48 } |
| 49 | 49 |
| 50 SkPaint paint; | 50 SkPaint paint; |
| 51 paint.setAntiAlias(true); | 51 paint.setAntiAlias(true); |
| 52 sk_tool_utils::set_portable_typeface(&paint); | 52 sk_tool_utils::set_portable_typeface_always(&paint); |
| 53 paint.setTextSize(SkIntToScalar(20)); | 53 paint.setTextSize(SkIntToScalar(20)); |
| 54 | 54 |
| 55 static const struct { | 55 static const struct { |
| 56 SkRegion::Op fOp; | 56 SkRegion::Op fOp; |
| 57 const char* fName; | 57 const char* fName; |
| 58 } gOps[] = { | 58 } gOps[] = { |
| 59 {SkRegion::kIntersect_Op, "I"}, | 59 {SkRegion::kIntersect_Op, "I"}, |
| 60 {SkRegion::kDifference_Op, "D" }, | 60 {SkRegion::kDifference_Op, "D" }, |
| 61 {SkRegion::kUnion_Op, "U"}, | 61 {SkRegion::kUnion_Op, "U"}, |
| 62 {SkRegion::kXOR_Op, "X" }, | 62 {SkRegion::kXOR_Op, "X" }, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 typedef GM INHERITED; | 124 typedef GM INHERITED; |
| 125 }; | 125 }; |
| 126 | 126 |
| 127 ////////////////////////////////////////////////////////////////////////////// | 127 ////////////////////////////////////////////////////////////////////////////// |
| 128 | 128 |
| 129 // Simple clip first | 129 // Simple clip first |
| 130 DEF_GM( return new ComplexClip3GM(true); ) | 130 DEF_GM( return new ComplexClip3GM(true); ) |
| 131 // Complex clip first | 131 // Complex clip first |
| 132 DEF_GM( return new ComplexClip3GM(false); ) | 132 DEF_GM( return new ComplexClip3GM(false); ) |
| 133 } | 133 } |
| OLD | NEW |