OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 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 #include "gm.h" | 9 #include "gm.h" |
10 #include "SkTArray.h" | 10 #include "SkTArray.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 fMatrices.push_back(m); | 118 fMatrices.push_back(m); |
119 } | 119 } |
120 | 120 |
121 { | 121 { |
122 SkMatrix m; | 122 SkMatrix m; |
123 m.setRotate(SkIntToScalar(60)); | 123 m.setRotate(SkIntToScalar(60)); |
124 fMatrices.push_back(m); | 124 fMatrices.push_back(m); |
125 } | 125 } |
126 } | 126 } |
127 | 127 |
128 SkColor genColor(SkMWCRandom* rand) { | 128 SkColor genColor(SkRandom* rand) { |
129 SkScalar hsv[3]; | 129 SkScalar hsv[3]; |
130 hsv[0] = SkFloatToScalar(rand->nextRangeF(0.0f, 360.0f)); | 130 hsv[0] = SkFloatToScalar(rand->nextRangeF(0.0f, 360.0f)); |
131 hsv[1] = SkFloatToScalar(rand->nextRangeF(0.75f, 1.0f)); | 131 hsv[1] = SkFloatToScalar(rand->nextRangeF(0.75f, 1.0f)); |
132 hsv[2] = SkFloatToScalar(rand->nextRangeF(0.75f, 1.0f)); | 132 hsv[2] = SkFloatToScalar(rand->nextRangeF(0.75f, 1.0f)); |
133 | 133 |
134 return SkHSVToColor(hsv); | 134 return SkHSVToColor(hsv); |
135 } | 135 } |
136 | 136 |
137 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 137 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
138 SkMWCRandom rand(1); | 138 SkRandom rand(1); |
139 canvas->translate(20 * SK_Scalar1, 20 * SK_Scalar1); | 139 canvas->translate(20 * SK_Scalar1, 20 * SK_Scalar1); |
140 SkRect oval = SkRect::MakeLTRB(-20, -30, 20, 30); | 140 SkRect oval = SkRect::MakeLTRB(-20, -30, 20, 30); |
141 | 141 |
142 const SkScalar kXStart = 60.0f; | 142 const SkScalar kXStart = 60.0f; |
143 const SkScalar kYStart = 80.0f; | 143 const SkScalar kYStart = 80.0f; |
144 const int kXStep = 150; | 144 const int kXStep = 150; |
145 const int kYStep = 160; | 145 const int kYStep = 160; |
146 int maxX = fMatrices.count(); | 146 int maxX = fMatrices.count(); |
147 | 147 |
148 SkPaint rectPaint; | 148 SkPaint rectPaint; |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 | 278 |
279 typedef GM INHERITED; | 279 typedef GM INHERITED; |
280 }; | 280 }; |
281 | 281 |
282 ////////////////////////////////////////////////////////////////////////////// | 282 ////////////////////////////////////////////////////////////////////////////// |
283 | 283 |
284 static GM* MyFactory(void*) { return new OvalGM; } | 284 static GM* MyFactory(void*) { return new OvalGM; } |
285 static GMRegistry reg(MyFactory); | 285 static GMRegistry reg(MyFactory); |
286 | 286 |
287 } | 287 } |
OLD | NEW |