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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 fMatrices.push_back(m); | 119 fMatrices.push_back(m); |
120 } | 120 } |
121 | 121 |
122 { | 122 { |
123 SkMatrix m; | 123 SkMatrix m; |
124 m.setRotate(SkIntToScalar(60)); | 124 m.setRotate(SkIntToScalar(60)); |
125 fMatrices.push_back(m); | 125 fMatrices.push_back(m); |
126 } | 126 } |
127 } | 127 } |
128 | 128 |
129 SkColor genColor(SkMWCRandom* rand) { | 129 SkColor genColor(SkRandom* rand) { |
130 SkScalar hsv[3]; | 130 SkScalar hsv[3]; |
131 hsv[0] = SkFloatToScalar(rand->nextRangeF(0.0f, 360.0f)); | 131 hsv[0] = SkFloatToScalar(rand->nextRangeF(0.0f, 360.0f)); |
132 hsv[1] = SkFloatToScalar(rand->nextRangeF(0.75f, 1.0f)); | 132 hsv[1] = SkFloatToScalar(rand->nextRangeF(0.75f, 1.0f)); |
133 hsv[2] = SkFloatToScalar(rand->nextRangeF(0.75f, 1.0f)); | 133 hsv[2] = SkFloatToScalar(rand->nextRangeF(0.75f, 1.0f)); |
134 | 134 |
135 return SkHSVToColor(hsv); | 135 return SkHSVToColor(hsv); |
136 } | 136 } |
137 | 137 |
138 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 138 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
139 SkMWCRandom rand(1); | 139 SkRandom rand(1); |
140 canvas->translate(20 * SK_Scalar1, 20 * SK_Scalar1); | 140 canvas->translate(20 * SK_Scalar1, 20 * SK_Scalar1); |
141 SkRect rect = SkRect::MakeLTRB(-20, -30, 20, 30); | 141 SkRect rect = SkRect::MakeLTRB(-20, -30, 20, 30); |
142 SkRRect circleRect; | 142 SkRRect circleRect; |
143 circleRect.setRectXY(rect, 5, 5); | 143 circleRect.setRectXY(rect, 5, 5); |
144 | 144 |
145 const SkScalar kXStart = 60.0f; | 145 const SkScalar kXStart = 60.0f; |
146 const SkScalar kYStart = 80.0f; | 146 const SkScalar kYStart = 80.0f; |
147 const int kXStep = 150; | 147 const int kXStep = 150; |
148 const int kYStep = 160; | 148 const int kYStep = 160; |
149 int maxX = fMatrices.count(); | 149 int maxX = fMatrices.count(); |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 | 330 |
331 typedef GM INHERITED; | 331 typedef GM INHERITED; |
332 }; | 332 }; |
333 | 333 |
334 ////////////////////////////////////////////////////////////////////////////// | 334 ////////////////////////////////////////////////////////////////////////////// |
335 | 335 |
336 static GM* MyFactory(void*) { return new RoundRectGM; } | 336 static GM* MyFactory(void*) { return new RoundRectGM; } |
337 static GMRegistry reg(MyFactory); | 337 static GMRegistry reg(MyFactory); |
338 | 338 |
339 } | 339 } |
OLD | NEW |