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

Side by Side Diff: bench/RegionBench.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/RectoriBench.cpp ('k') | bench/RegionContainBench.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 "SkBenchmark.h" 8 #include "SkBenchmark.h"
9 #include "SkRandom.h" 9 #include "SkRandom.h"
10 #include "SkRegion.h" 10 #include "SkRegion.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 Proc fProc; 75 Proc fProc;
76 SkString fName; 76 SkString fName;
77 int fLoopMul; 77 int fLoopMul;
78 78
79 enum { 79 enum {
80 W = 1024, 80 W = 1024,
81 H = 768, 81 H = 768,
82 N = SkBENCHLOOP(2000) 82 N = SkBENCHLOOP(2000)
83 }; 83 };
84 84
85 SkIRect randrect(SkMWCRandom& rand) { 85 SkIRect randrect(SkRandom& rand) {
86 int x = rand.nextU() % W; 86 int x = rand.nextU() % W;
87 int y = rand.nextU() % H; 87 int y = rand.nextU() % H;
88 int w = rand.nextU() % W; 88 int w = rand.nextU() % W;
89 int h = rand.nextU() % H; 89 int h = rand.nextU() % H;
90 return SkIRect::MakeXYWH(x, y, w >> 1, h >> 1); 90 return SkIRect::MakeXYWH(x, y, w >> 1, h >> 1);
91 } 91 }
92 92
93 RegionBench(void* param, int count, Proc proc, const char name[], int mul = 1) : INHERITED(param) { 93 RegionBench(void* param, int count, Proc proc, const char name[], int mul = 1) : INHERITED(param) {
94 fProc = proc; 94 fProc = proc;
95 fName.printf("region_%s_%d", name, count); 95 fName.printf("region_%s_%d", name, count);
96 fLoopMul = mul; 96 fLoopMul = mul;
97 97
98 SkMWCRandom rand; 98 SkRandom rand;
99 for (int i = 0; i < count; i++) { 99 for (int i = 0; i < count; i++) {
100 fA.op(randrect(rand), SkRegion::kXOR_Op); 100 fA.op(randrect(rand), SkRegion::kXOR_Op);
101 fB.op(randrect(rand), SkRegion::kXOR_Op); 101 fB.op(randrect(rand), SkRegion::kXOR_Op);
102 } 102 }
103 fIsRendering = false; 103 fIsRendering = false;
104 } 104 }
105 105
106 protected: 106 protected:
107 virtual const char* onGetName() { return fName.c_str(); } 107 virtual const char* onGetName() { return fName.c_str(); }
108 108
(...skipping 23 matching lines...) Expand all
132 132
133 static BenchRegistry gR0(gF0); 133 static BenchRegistry gR0(gF0);
134 static BenchRegistry gR1(gF1); 134 static BenchRegistry gR1(gF1);
135 static BenchRegistry gR2(gF2); 135 static BenchRegistry gR2(gF2);
136 static BenchRegistry gR3(gF3); 136 static BenchRegistry gR3(gF3);
137 static BenchRegistry gR4(gF4); 137 static BenchRegistry gR4(gF4);
138 static BenchRegistry gR5(gF5); 138 static BenchRegistry gR5(gF5);
139 static BenchRegistry gR6(gF6); 139 static BenchRegistry gR6(gF6);
140 static BenchRegistry gR7(gF7); 140 static BenchRegistry gR7(gF7);
141 static BenchRegistry gR8(gF8); 141 static BenchRegistry gR8(gF8);
OLDNEW
« no previous file with comments | « bench/RectoriBench.cpp ('k') | bench/RegionContainBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698