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

Side by Side Diff: bench/HairlinePathBench.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/GrMemoryPoolBench.cpp ('k') | bench/LineBench.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 2013 Google Inc. 2 * Copyright 2013 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 #include "SkBenchmark.h" 7 #include "SkBenchmark.h"
8 #include "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkPaint.h" 9 #include "SkPaint.h"
10 #include "SkRandom.h" 10 #include "SkRandom.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 }; 78 };
79 79
80 class LinePathBench : public HairlinePathBench { 80 class LinePathBench : public HairlinePathBench {
81 public: 81 public:
82 LinePathBench(void* param, Flags flags) : INHERITED(param, flags) {} 82 LinePathBench(void* param, Flags flags) : INHERITED(param, flags) {}
83 83
84 virtual void appendName(SkString* name) SK_OVERRIDE { 84 virtual void appendName(SkString* name) SK_OVERRIDE {
85 name->append("line"); 85 name->append("line");
86 } 86 }
87 virtual void makePath(SkPath* path) SK_OVERRIDE { 87 virtual void makePath(SkPath* path) SK_OVERRIDE {
88 SkMWCRandom rand; 88 SkRandom rand;
89 int size = SK_ARRAY_COUNT(points); 89 int size = SK_ARRAY_COUNT(points);
90 int hSize = size / 2; 90 int hSize = size / 2;
91 for (int i = 0; i < kMaxPathSize; ++i) { 91 for (int i = 0; i < kMaxPathSize; ++i) {
92 int xTrans = 10 + 40 * (i%(kMaxPathSize/2)); 92 int xTrans = 10 + 40 * (i%(kMaxPathSize/2));
93 int yTrans = 0; 93 int yTrans = 0;
94 if (i > kMaxPathSize/2 - 1) { 94 if (i > kMaxPathSize/2 - 1) {
95 yTrans = 40; 95 yTrans = 40;
96 } 96 }
97 int base1 = 2 * rand.nextULessThan(hSize); 97 int base1 = 2 * rand.nextULessThan(hSize);
98 int base2 = 2 * rand.nextULessThan(hSize); 98 int base2 = 2 * rand.nextULessThan(hSize);
(...skipping 11 matching lines...) Expand all
110 }; 110 };
111 111
112 class QuadPathBench : public HairlinePathBench { 112 class QuadPathBench : public HairlinePathBench {
113 public: 113 public:
114 QuadPathBench(void* param, Flags flags) : INHERITED(param, flags) {} 114 QuadPathBench(void* param, Flags flags) : INHERITED(param, flags) {}
115 115
116 virtual void appendName(SkString* name) SK_OVERRIDE { 116 virtual void appendName(SkString* name) SK_OVERRIDE {
117 name->append("quad"); 117 name->append("quad");
118 } 118 }
119 virtual void makePath(SkPath* path) SK_OVERRIDE { 119 virtual void makePath(SkPath* path) SK_OVERRIDE {
120 SkMWCRandom rand; 120 SkRandom rand;
121 int size = SK_ARRAY_COUNT(points); 121 int size = SK_ARRAY_COUNT(points);
122 int hSize = size / 2; 122 int hSize = size / 2;
123 for (int i = 0; i < kMaxPathSize; ++i) { 123 for (int i = 0; i < kMaxPathSize; ++i) {
124 int xTrans = 10 + 40 * (i%(kMaxPathSize/2)); 124 int xTrans = 10 + 40 * (i%(kMaxPathSize/2));
125 int yTrans = 0; 125 int yTrans = 0;
126 if (i > kMaxPathSize/2 - 1) { 126 if (i > kMaxPathSize/2 - 1) {
127 yTrans = 40; 127 yTrans = 40;
128 } 128 }
129 int base1 = 2 * rand.nextULessThan(hSize); 129 int base1 = 2 * rand.nextULessThan(hSize);
130 int base2 = 2 * rand.nextULessThan(hSize); 130 int base2 = 2 * rand.nextULessThan(hSize);
(...skipping 11 matching lines...) Expand all
142 }; 142 };
143 143
144 class ConicPathBench : public HairlinePathBench { 144 class ConicPathBench : public HairlinePathBench {
145 public: 145 public:
146 ConicPathBench(void* param, Flags flags) : INHERITED(param, flags) {} 146 ConicPathBench(void* param, Flags flags) : INHERITED(param, flags) {}
147 147
148 virtual void appendName(SkString* name) SK_OVERRIDE { 148 virtual void appendName(SkString* name) SK_OVERRIDE {
149 name->append("conic"); 149 name->append("conic");
150 } 150 }
151 virtual void makePath(SkPath* path) SK_OVERRIDE { 151 virtual void makePath(SkPath* path) SK_OVERRIDE {
152 SkMWCRandom rand; 152 SkRandom rand;
153 SkMWCRandom randWeight; 153 SkRandom randWeight;
154 int size = SK_ARRAY_COUNT(points); 154 int size = SK_ARRAY_COUNT(points);
155 int hSize = size / 2; 155 int hSize = size / 2;
156 for (int i = 0; i < kMaxPathSize; ++i) { 156 for (int i = 0; i < kMaxPathSize; ++i) {
157 int xTrans = 10 + 40 * (i%(kMaxPathSize/2)); 157 int xTrans = 10 + 40 * (i%(kMaxPathSize/2));
158 int yTrans = 0; 158 int yTrans = 0;
159 if (i > kMaxPathSize/2 - 1) { 159 if (i > kMaxPathSize/2 - 1) {
160 yTrans = 40; 160 yTrans = 40;
161 } 161 }
162 int base1 = 2 * rand.nextULessThan(hSize); 162 int base1 = 2 * rand.nextULessThan(hSize);
163 int base2 = 2 * rand.nextULessThan(hSize); 163 int base2 = 2 * rand.nextULessThan(hSize);
(...skipping 13 matching lines...) Expand all
177 }; 177 };
178 178
179 class CubicPathBench : public HairlinePathBench { 179 class CubicPathBench : public HairlinePathBench {
180 public: 180 public:
181 CubicPathBench(void* param, Flags flags) : INHERITED(param, flags) {} 181 CubicPathBench(void* param, Flags flags) : INHERITED(param, flags) {}
182 182
183 virtual void appendName(SkString* name) SK_OVERRIDE { 183 virtual void appendName(SkString* name) SK_OVERRIDE {
184 name->append("cubic"); 184 name->append("cubic");
185 } 185 }
186 virtual void makePath(SkPath* path) SK_OVERRIDE { 186 virtual void makePath(SkPath* path) SK_OVERRIDE {
187 SkMWCRandom rand; 187 SkRandom rand;
188 int size = SK_ARRAY_COUNT(points); 188 int size = SK_ARRAY_COUNT(points);
189 int hSize = size / 2; 189 int hSize = size / 2;
190 for (int i = 0; i < kMaxPathSize; ++i) { 190 for (int i = 0; i < kMaxPathSize; ++i) {
191 int xTrans = 10 + 40 * (i%(kMaxPathSize/2)); 191 int xTrans = 10 + 40 * (i%(kMaxPathSize/2));
192 int yTrans = 0; 192 int yTrans = 0;
193 if (i > kMaxPathSize/2 - 1) { 193 if (i > kMaxPathSize/2 - 1) {
194 yTrans = 40; 194 yTrans = 40;
195 } 195 }
196 int base1 = 2 * rand.nextULessThan(hSize); 196 int base1 = 2 * rand.nextULessThan(hSize);
197 int base2 = 2 * rand.nextULessThan(hSize); 197 int base2 = 2 * rand.nextULessThan(hSize);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 // Don't have default path renderer for conics yet on GPU, so must use AA 229 // Don't have default path renderer for conics yet on GPU, so must use AA
230 // DEF_BENCH( return new ConicPathBench(p, FLAGS00); ) 230 // DEF_BENCH( return new ConicPathBench(p, FLAGS00); )
231 // DEF_BENCH( return new ConicPathBench(p, FLAGS01); ) 231 // DEF_BENCH( return new ConicPathBench(p, FLAGS01); )
232 DEF_BENCH( return new ConicPathBench(p, FLAGS10); ) 232 DEF_BENCH( return new ConicPathBench(p, FLAGS10); )
233 DEF_BENCH( return new ConicPathBench(p, FLAGS11); ) 233 DEF_BENCH( return new ConicPathBench(p, FLAGS11); )
234 234
235 DEF_BENCH( return new CubicPathBench(p, FLAGS00); ) 235 DEF_BENCH( return new CubicPathBench(p, FLAGS00); )
236 DEF_BENCH( return new CubicPathBench(p, FLAGS01); ) 236 DEF_BENCH( return new CubicPathBench(p, FLAGS01); )
237 DEF_BENCH( return new CubicPathBench(p, FLAGS10); ) 237 DEF_BENCH( return new CubicPathBench(p, FLAGS10); )
238 DEF_BENCH( return new CubicPathBench(p, FLAGS11); ) 238 DEF_BENCH( return new CubicPathBench(p, FLAGS11); )
OLDNEW
« no previous file with comments | « bench/GrMemoryPoolBench.cpp ('k') | bench/LineBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698