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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 } | 73 } |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 private: | 77 private: |
78 typedef skiagm::GM INHERITED; | 78 typedef skiagm::GM INHERITED; |
79 }; | 79 }; |
80 | 80 |
81 class Strokes2GM : public skiagm::GM { | 81 class Strokes2GM : public skiagm::GM { |
82 SkPath fPath; | 82 SkPath fPath; |
83 public: | 83 protected: |
84 Strokes2GM() { | 84 void onOnceBeforeDraw() SK_OVERRIDE { |
85 SkRandom rand; | 85 SkRandom rand; |
86 fPath.moveTo(0, 0); | 86 fPath.moveTo(0, 0); |
87 for (int i = 0; i < 13; i++) { | 87 for (int i = 0; i < 13; i++) { |
88 SkScalar x = rand.nextUScalar1() * (W >> 1); | 88 SkScalar x = rand.nextUScalar1() * (W >> 1); |
89 SkScalar y = rand.nextUScalar1() * (H >> 1); | 89 SkScalar y = rand.nextUScalar1() * (H >> 1); |
90 fPath.lineTo(x, y); | 90 fPath.lineTo(x, y); |
91 } | 91 } |
92 } | 92 } |
93 | 93 |
94 protected: | |
95 | 94 |
96 SkString onShortName() SK_OVERRIDE { | 95 SkString onShortName() SK_OVERRIDE { |
97 return SkString("strokes_poly"); | 96 return SkString("strokes_poly"); |
98 } | 97 } |
99 | 98 |
100 SkISize onISize() SK_OVERRIDE { | 99 SkISize onISize() SK_OVERRIDE { |
101 return SkISize::Make(W, H*2); | 100 return SkISize::Make(W, H*2); |
102 } | 101 } |
103 | 102 |
104 static void rotate(SkScalar angle, SkScalar px, SkScalar py, SkCanvas* canva
s) { | 103 static void rotate(SkScalar angle, SkScalar px, SkScalar py, SkCanvas* canva
s) { |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 | 243 |
245 ////////////////////////////////////////////////////////////////////////////// | 244 ////////////////////////////////////////////////////////////////////////////// |
246 | 245 |
247 static skiagm::GM* F0(void*) { return new StrokesGM; } | 246 static skiagm::GM* F0(void*) { return new StrokesGM; } |
248 static skiagm::GM* F1(void*) { return new Strokes2GM; } | 247 static skiagm::GM* F1(void*) { return new Strokes2GM; } |
249 static skiagm::GM* F2(void*) { return new Strokes3GM; } | 248 static skiagm::GM* F2(void*) { return new Strokes3GM; } |
250 | 249 |
251 static skiagm::GMRegistry R0(F0); | 250 static skiagm::GMRegistry R0(F0); |
252 static skiagm::GMRegistry R1(F1); | 251 static skiagm::GMRegistry R1(F1); |
253 static skiagm::GMRegistry R2(F2); | 252 static skiagm::GMRegistry R2(F2); |
OLD | NEW |