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

Side by Side Diff: bench/GameBench.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 | « bench/FSRectBench.cpp ('k') | bench/GrMemoryPoolBench.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 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBenchmark.h" 8 #include "SkBenchmark.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkPaint.h" 10 #include "SkPaint.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 virtual void onPreDraw() SK_OVERRIDE { 82 virtual void onPreDraw() SK_OVERRIDE {
83 if (!fInitialized) { 83 if (!fInitialized) {
84 this->makeCheckerboard(); 84 this->makeCheckerboard();
85 this->makeAtlas(); 85 this->makeAtlas();
86 fInitialized = true; 86 fInitialized = true;
87 } 87 }
88 } 88 }
89 89
90 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 90 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
91 SkMWCRandom scaleRand; 91 SkRandom scaleRand;
92 SkMWCRandom transRand; 92 SkRandom transRand;
93 SkMWCRandom rotRand; 93 SkRandom rotRand;
94 94
95 int width, height; 95 int width, height;
96 if (fUseAtlas) { 96 if (fUseAtlas) {
97 width = kAtlasCellWidth; 97 width = kAtlasCellWidth;
98 height = kAtlasCellHeight; 98 height = kAtlasCellHeight;
99 } else { 99 } else {
100 width = kCheckerboardWidth; 100 width = kCheckerboardWidth;
101 height = kCheckerboardHeight; 101 height = kCheckerboardHeight;
102 } 102 }
103 103
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 *scanline++ = 0xFFFF0000; 273 *scanline++ = 0xFFFF0000;
274 } else { 274 } else {
275 *scanline++ = 0x00000000; 275 *scanline++ = 0x00000000;
276 } 276 }
277 } 277 }
278 } 278 }
279 } 279 }
280 280
281 // Note: the resulting atlas has transparency 281 // Note: the resulting atlas has transparency
282 void makeAtlas() { 282 void makeAtlas() {
283 SkMWCRandom rand; 283 SkRandom rand;
284 284
285 SkColor colors[kNumAtlasedX][kNumAtlasedY]; 285 SkColor colors[kNumAtlasedX][kNumAtlasedY];
286 286
287 for (int y = 0; y < kNumAtlasedY; ++y) { 287 for (int y = 0; y < kNumAtlasedY; ++y) {
288 for (int x = 0; x < kNumAtlasedX; ++x) { 288 for (int x = 0; x < kNumAtlasedX; ++x) {
289 colors[x][y] = rand.nextU() | 0xff000000; 289 colors[x][y] = rand.nextU() | 0xff000000;
290 fAtlasRects[x][y] = SkIRect::MakeXYWH(kAtlasSpacer + x * (kAtlas CellWidth + kAtlasSpacer), 290 fAtlasRects[x][y] = SkIRect::MakeXYWH(kAtlasSpacer + x * (kAtlas CellWidth + kAtlasSpacer),
291 kAtlasSpacer + y * (kAtlas CellHeight + kAtlasSpacer), 291 kAtlasSpacer + y * (kAtlas CellHeight + kAtlasSpacer),
292 kAtlasCellWidth, 292 kAtlasCellWidth,
293 kAtlasCellHeight); 293 kAtlasCellHeight);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kTranslate_Type, 339 DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kTranslate_Type,
340 GameBench::kFull_Clear, true)); ) 340 GameBench::kFull_Clear, true)); )
341 DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kRotate_Type, 341 DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kRotate_Type,
342 GameBench::kFull_Clear)); ) 342 GameBench::kFull_Clear)); )
343 343
344 // Atlased 344 // Atlased
345 DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kTranslate_Type, 345 DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kTranslate_Type,
346 GameBench::kFull_Clear, false, true) ); ) 346 GameBench::kFull_Clear, false, true) ); )
347 DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kTranslate_Type, 347 DEF_BENCH( return SkNEW_ARGS(GameBench, (p, GameBench::kTranslate_Type,
348 GameBench::kFull_Clear, false, true, true)); ) 348 GameBench::kFull_Clear, false, true, true)); )
OLDNEW
« no previous file with comments | « bench/FSRectBench.cpp ('k') | bench/GrMemoryPoolBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698