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 | 8 |
9 | 9 |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 paint->setColor(rand.nextU()); | 32 paint->setColor(rand.nextU()); |
33 paint->setAlpha(0xFF); | 33 paint->setAlpha(0xFF); |
34 } | 34 } |
35 | 35 |
36 | 36 |
37 class StrokesGM : public skiagm::GM { | 37 class StrokesGM : public skiagm::GM { |
38 public: | 38 public: |
39 StrokesGM() {} | 39 StrokesGM() {} |
40 | 40 |
41 protected: | 41 protected: |
42 uint32_t onGetFlags() const SK_OVERRIDE { | |
43 return kSkipTiled_Flag; | |
44 } | |
45 | 42 |
46 SkString onShortName() SK_OVERRIDE { | 43 SkString onShortName() SK_OVERRIDE { |
47 return SkString("strokes_round"); | 44 return SkString("strokes_round"); |
48 } | 45 } |
49 | 46 |
50 SkISize onISize() SK_OVERRIDE { | 47 SkISize onISize() SK_OVERRIDE { |
51 return SkISize::Make(W, H*2); | 48 return SkISize::Make(W, H*2); |
52 } | 49 } |
53 | 50 |
54 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 51 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 SkRandom rand; | 85 SkRandom rand; |
89 fPath.moveTo(0, 0); | 86 fPath.moveTo(0, 0); |
90 for (int i = 0; i < 13; i++) { | 87 for (int i = 0; i < 13; i++) { |
91 SkScalar x = rand.nextUScalar1() * (W >> 1); | 88 SkScalar x = rand.nextUScalar1() * (W >> 1); |
92 SkScalar y = rand.nextUScalar1() * (H >> 1); | 89 SkScalar y = rand.nextUScalar1() * (H >> 1); |
93 fPath.lineTo(x, y); | 90 fPath.lineTo(x, y); |
94 } | 91 } |
95 } | 92 } |
96 | 93 |
97 protected: | 94 protected: |
98 uint32_t onGetFlags() const SK_OVERRIDE { | |
99 return kSkipTiled_Flag; | |
100 } | |
101 | 95 |
102 SkString onShortName() SK_OVERRIDE { | 96 SkString onShortName() SK_OVERRIDE { |
103 return SkString("strokes_poly"); | 97 return SkString("strokes_poly"); |
104 } | 98 } |
105 | 99 |
106 SkISize onISize() SK_OVERRIDE { | 100 SkISize onISize() SK_OVERRIDE { |
107 return SkISize::Make(W, H*2); | 101 return SkISize::Make(W, H*2); |
108 } | 102 } |
109 | 103 |
110 static void rotate(SkScalar angle, SkScalar px, SkScalar py, SkCanvas* canva
s) { | 104 static void rotate(SkScalar angle, SkScalar px, SkScalar py, SkCanvas* canva
s) { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 SkRect r = bounds; | 183 SkRect r = bounds; |
190 r.inset(bounds.width() / 10, -bounds.height() / 10); | 184 r.inset(bounds.width() / 10, -bounds.height() / 10); |
191 path->addOval(r, SkPath::kCCW_Direction); | 185 path->addOval(r, SkPath::kCCW_Direction); |
192 title->set("CW CCW"); | 186 title->set("CW CCW"); |
193 } | 187 } |
194 | 188 |
195 public: | 189 public: |
196 Strokes3GM() {} | 190 Strokes3GM() {} |
197 | 191 |
198 protected: | 192 protected: |
199 uint32_t onGetFlags() const SK_OVERRIDE { | |
200 return kSkipTiled_Flag; | |
201 } | |
202 | 193 |
203 SkString onShortName() SK_OVERRIDE { | 194 SkString onShortName() SK_OVERRIDE { |
204 return SkString("strokes3"); | 195 return SkString("strokes3"); |
205 } | 196 } |
206 | 197 |
207 SkISize onISize() SK_OVERRIDE { | 198 SkISize onISize() SK_OVERRIDE { |
208 return SkISize::Make(W, H*2); | 199 return SkISize::Make(W, H*2); |
209 } | 200 } |
210 | 201 |
211 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 202 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 | 244 |
254 ////////////////////////////////////////////////////////////////////////////// | 245 ////////////////////////////////////////////////////////////////////////////// |
255 | 246 |
256 static skiagm::GM* F0(void*) { return new StrokesGM; } | 247 static skiagm::GM* F0(void*) { return new StrokesGM; } |
257 static skiagm::GM* F1(void*) { return new Strokes2GM; } | 248 static skiagm::GM* F1(void*) { return new Strokes2GM; } |
258 static skiagm::GM* F2(void*) { return new Strokes3GM; } | 249 static skiagm::GM* F2(void*) { return new Strokes3GM; } |
259 | 250 |
260 static skiagm::GMRegistry R0(F0); | 251 static skiagm::GMRegistry R0(F0); |
261 static skiagm::GMRegistry R1(F1); | 252 static skiagm::GMRegistry R1(F1); |
262 static skiagm::GMRegistry R2(F2); | 253 static skiagm::GMRegistry R2(F2); |
OLD | NEW |