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

Side by Side Diff: gm/roundrects.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/quadpaths.cpp ('k') | gm/strokerects.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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW
« no previous file with comments | « gm/quadpaths.cpp ('k') | gm/strokerects.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698