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 | 7 |
8 #include "gm.h" | 8 #include "gm.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkPath.h" | 10 #include "SkPathPriv.h" |
11 #include "SkTypeface.h" | 11 #include "SkTypeface.h" |
12 | 12 |
13 namespace skiagm { | 13 namespace skiagm { |
14 | 14 |
15 class StrokeFillGM : public GM { | 15 class StrokeFillGM : public GM { |
16 public: | 16 public: |
17 StrokeFillGM() { | 17 StrokeFillGM() { |
18 | 18 |
19 } | 19 } |
20 | 20 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 SkPath path2; | 63 SkPath path2; |
64 path2.setFillType(SkPath::kWinding_FillType); | 64 path2.setFillType(SkPath::kWinding_FillType); |
65 path2.addCircle(x + SkIntToScalar(120), y + SkIntToScalar(200), SkIntToS
calar(50), SkPath::kCCW_Direction); | 65 path2.addCircle(x + SkIntToScalar(120), y + SkIntToScalar(200), SkIntToS
calar(50), SkPath::kCCW_Direction); |
66 path2.addCircle(x + SkIntToScalar(120), y + SkIntToScalar(200), SkIntToS
calar(40), SkPath::kCW_Direction); | 66 path2.addCircle(x + SkIntToScalar(120), y + SkIntToScalar(200), SkIntToS
calar(40), SkPath::kCW_Direction); |
67 canvas->drawPath(path2, paint); | 67 canvas->drawPath(path2, paint); |
68 | 68 |
69 path2.reset(); | 69 path2.reset(); |
70 path2.addCircle(x + SkIntToScalar(240), y + SkIntToScalar(200), SkIntToS
calar(50), SkPath::kCCW_Direction); | 70 path2.addCircle(x + SkIntToScalar(240), y + SkIntToScalar(200), SkIntToS
calar(50), SkPath::kCCW_Direction); |
71 canvas->drawPath(path2, paint); | 71 canvas->drawPath(path2, paint); |
72 SkASSERT(path2.cheapIsDirection(SkPath::kCCW_Direction)); | 72 SkASSERT(SkPathPriv::CheapIsFirstDirection(path2, SkPathPriv::kCCW_First
Direction)); |
73 | 73 |
74 path2.reset(); | 74 path2.reset(); |
75 SkASSERT(!path2.cheapComputeDirection(NULL)); | 75 SkASSERT(!SkPathPriv::CheapComputeFirstDirection(path2, NULL)); |
76 path2.addCircle(x + SkIntToScalar(360), y + SkIntToScalar(200), SkIntToS
calar(50), SkPath::kCW_Direction); | 76 path2.addCircle(x + SkIntToScalar(360), y + SkIntToScalar(200), SkIntToS
calar(50), SkPath::kCW_Direction); |
77 SkASSERT(path2.cheapIsDirection(SkPath::kCW_Direction)); | 77 SkASSERT(SkPathPriv::CheapIsFirstDirection(path2, SkPathPriv::kCW_FirstD
irection)); |
78 canvas->drawPath(path2, paint); | 78 canvas->drawPath(path2, paint); |
79 | 79 |
80 SkRect r = SkRect::MakeXYWH(x - SkIntToScalar(50), y + SkIntToScalar(280
), | 80 SkRect r = SkRect::MakeXYWH(x - SkIntToScalar(50), y + SkIntToScalar(280
), |
81 SkIntToScalar(100), SkIntToScalar(100)); | 81 SkIntToScalar(100), SkIntToScalar(100)); |
82 SkPath path3; | 82 SkPath path3; |
83 path3.setFillType(SkPath::kWinding_FillType); | 83 path3.setFillType(SkPath::kWinding_FillType); |
84 path3.addRect(r, SkPath::kCW_Direction); | 84 path3.addRect(r, SkPath::kCW_Direction); |
85 r.inset(SkIntToScalar(10), SkIntToScalar(10)); | 85 r.inset(SkIntToScalar(10), SkIntToScalar(10)); |
86 path3.addRect(r, SkPath::kCCW_Direction); | 86 path3.addRect(r, SkPath::kCCW_Direction); |
87 canvas->drawPath(path3, paint); | 87 canvas->drawPath(path3, paint); |
88 | 88 |
89 r = SkRect::MakeXYWH(x + SkIntToScalar(70), y + SkIntToScalar(280), | 89 r = SkRect::MakeXYWH(x + SkIntToScalar(70), y + SkIntToScalar(280), |
90 SkIntToScalar(100), SkIntToScalar(100)); | 90 SkIntToScalar(100), SkIntToScalar(100)); |
91 SkPath path4; | 91 SkPath path4; |
92 path4.setFillType(SkPath::kWinding_FillType); | 92 path4.setFillType(SkPath::kWinding_FillType); |
93 path4.addRect(r, SkPath::kCCW_Direction); | 93 path4.addRect(r, SkPath::kCCW_Direction); |
94 r.inset(SkIntToScalar(10), SkIntToScalar(10)); | 94 r.inset(SkIntToScalar(10), SkIntToScalar(10)); |
95 path4.addRect(r, SkPath::kCW_Direction); | 95 path4.addRect(r, SkPath::kCW_Direction); |
96 canvas->drawPath(path4, paint); | 96 canvas->drawPath(path4, paint); |
97 | 97 |
98 r = SkRect::MakeXYWH(x + SkIntToScalar(190), y + SkIntToScalar(280), | 98 r = SkRect::MakeXYWH(x + SkIntToScalar(190), y + SkIntToScalar(280), |
99 SkIntToScalar(100), SkIntToScalar(100)); | 99 SkIntToScalar(100), SkIntToScalar(100)); |
100 path4.reset(); | 100 path4.reset(); |
101 SkASSERT(!path4.cheapComputeDirection(NULL)); | 101 SkASSERT(!SkPathPriv::CheapComputeFirstDirection(path4, NULL)); |
102 path4.addRect(r, SkPath::kCCW_Direction); | 102 path4.addRect(r, SkPath::kCCW_Direction); |
103 SkASSERT(path4.cheapIsDirection(SkPath::kCCW_Direction)); | 103 SkASSERT(SkPathPriv::CheapIsFirstDirection(path4, SkPathPriv::kCCW_First
Direction)); |
104 path4.moveTo(0, 0); // test for crbug.com/247770 | 104 path4.moveTo(0, 0); // test for crbug.com/247770 |
105 canvas->drawPath(path4, paint); | 105 canvas->drawPath(path4, paint); |
106 | 106 |
107 r = SkRect::MakeXYWH(x + SkIntToScalar(310), y + SkIntToScalar(280), | 107 r = SkRect::MakeXYWH(x + SkIntToScalar(310), y + SkIntToScalar(280), |
108 SkIntToScalar(100), SkIntToScalar(100)); | 108 SkIntToScalar(100), SkIntToScalar(100)); |
109 path4.reset(); | 109 path4.reset(); |
110 SkASSERT(!path4.cheapComputeDirection(NULL)); | 110 SkASSERT(!SkPathPriv::CheapComputeFirstDirection(path4, NULL)); |
111 path4.addRect(r, SkPath::kCW_Direction); | 111 path4.addRect(r, SkPath::kCW_Direction); |
112 SkASSERT(path4.cheapIsDirection(SkPath::kCW_Direction)); | 112 SkASSERT(SkPathPriv::CheapIsFirstDirection(path4, SkPathPriv::kCW_FirstD
irection)); |
113 path4.moveTo(0, 0); // test for crbug.com/247770 | 113 path4.moveTo(0, 0); // test for crbug.com/247770 |
114 canvas->drawPath(path4, paint); | 114 canvas->drawPath(path4, paint); |
115 } | 115 } |
116 | 116 |
117 private: | 117 private: |
118 typedef GM INHERITED; | 118 typedef GM INHERITED; |
119 }; | 119 }; |
120 | 120 |
121 ////////////////////////////////////////////////////////////////////////////// | 121 ////////////////////////////////////////////////////////////////////////////// |
122 | 122 |
123 DEF_GM(return SkNEW(StrokeFillGM);) | 123 DEF_GM(return SkNEW(StrokeFillGM);) |
124 | 124 |
125 } | 125 } |
OLD | NEW |