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

Side by Side Diff: gm/convexpaths.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/complexclip2.cpp ('k') | gm/cubicpaths.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 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 #include "gm.h" 8 #include "gm.h"
9 #include "SkRandom.h" 9 #include "SkRandom.h"
10 #include "SkTArray.h" 10 #include "SkTArray.h"
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 // small circle. This is listed last so that it has device coords far 254 // small circle. This is listed last so that it has device coords far
255 // from the origin (small area relative to x,y values). 255 // from the origin (small area relative to x,y values).
256 fPaths.push_back().addCircle(0, 0, SkFloatToScalar(1.2f)); 256 fPaths.push_back().addCircle(0, 0, SkFloatToScalar(1.2f));
257 } 257 }
258 258
259 virtual void onDraw(SkCanvas* canvas) { 259 virtual void onDraw(SkCanvas* canvas) {
260 this->makePaths(); 260 this->makePaths();
261 261
262 SkPaint paint; 262 SkPaint paint;
263 paint.setAntiAlias(true); 263 paint.setAntiAlias(true);
264 SkRandom rand; 264 SkLCGRandom rand;
265 canvas->translate(20 * SK_Scalar1, 20 * SK_Scalar1); 265 canvas->translate(20 * SK_Scalar1, 20 * SK_Scalar1);
266 266
267 // As we've added more paths this has gotten pretty big. Scale the whole thi ng down. 267 // As we've added more paths this has gotten pretty big. Scale the whole thi ng down.
268 canvas->scale(2 * SK_Scalar1 / 3, 2 * SK_Scalar1 / 3); 268 canvas->scale(2 * SK_Scalar1 / 3, 2 * SK_Scalar1 / 3);
269 269
270 for (int i = 0; i < fPaths.count(); ++i) { 270 for (int i = 0; i < fPaths.count(); ++i) {
271 canvas->save(); 271 canvas->save();
272 // position the path, and make it at off-integer coords. 272 // position the path, and make it at off-integer coords.
273 canvas->translate(SK_Scalar1 * 200 * (i % 5) + SK_Scalar1 / 10, 273 canvas->translate(SK_Scalar1 * 200 * (i % 5) + SK_Scalar1 / 10,
274 SK_Scalar1 * 200 * (i / 5) + 9 * SK_Scalar1 / 10); 274 SK_Scalar1 * 200 * (i / 5) + 9 * SK_Scalar1 / 10);
(...skipping 13 matching lines...) Expand all
288 typedef GM INHERITED; 288 typedef GM INHERITED;
289 SkTArray<SkPath> fPaths; 289 SkTArray<SkPath> fPaths;
290 }; 290 };
291 291
292 ////////////////////////////////////////////////////////////////////////////// 292 //////////////////////////////////////////////////////////////////////////////
293 293
294 static GM* MyFactory(void*) { return new ConvexPathsGM; } 294 static GM* MyFactory(void*) { return new ConvexPathsGM; }
295 static GMRegistry reg(MyFactory); 295 static GMRegistry reg(MyFactory);
296 296
297 } 297 }
OLDNEW
« no previous file with comments | « gm/complexclip2.cpp ('k') | gm/cubicpaths.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698