Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: gm/ovals.cpp

Issue 23576015: Change old PRG to be SkLCGRandom; change new one to SkRandom (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix some spurious SkMWCRandoms Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gm/nested.cpp ('k') | gm/points.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « gm/nested.cpp ('k') | gm/points.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698