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