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

Side by Side Diff: bench/GradientBench.cpp

Issue 476923002: remove internal repeat count from gradient benches (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 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
« no previous file with comments | « no previous file | no next file » | 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 "Benchmark.h" 8 #include "Benchmark.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 200
201 /////////////////////////////////////////////////////////////////////////////// 201 ///////////////////////////////////////////////////////////////////////////////
202 202
203 class GradientBench : public Benchmark { 203 class GradientBench : public Benchmark {
204 SkString fName; 204 SkString fName;
205 SkShader* fShader; 205 SkShader* fShader;
206 bool fDither; 206 bool fDither;
207 enum { 207 enum {
208 W = 400, 208 W = 400,
209 H = 400, 209 H = 400,
210 kRepeat = 15,
211 }; 210 };
212 public: 211 public:
213 SkShader* makeShader(GradType gradType, GradData data, SkShader::TileMode tm , float scale) { 212 SkShader* makeShader(GradType gradType, GradData data, SkShader::TileMode tm , float scale) {
214 const SkPoint pts[2] = { 213 const SkPoint pts[2] = {
215 { 0, 0 }, 214 { 0, 0 },
216 { SkIntToScalar(W), SkIntToScalar(H) } 215 { SkIntToScalar(W), SkIntToScalar(H) }
217 }; 216 };
218 217
219 return gGrads[gradType].fMaker(pts, data, tm, scale); 218 return gGrads[gradType].fMaker(pts, data, tm, scale);
220 } 219 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 virtual void onDraw(const int loops, SkCanvas* canvas) { 267 virtual void onDraw(const int loops, SkCanvas* canvas) {
269 SkPaint paint; 268 SkPaint paint;
270 this->setupPaint(&paint); 269 this->setupPaint(&paint);
271 270
272 paint.setShader(fShader); 271 paint.setShader(fShader);
273 if (fDither) { 272 if (fDither) {
274 paint.setDither(true); 273 paint.setDither(true);
275 } 274 }
276 275
277 SkRect r = { 0, 0, SkIntToScalar(W), SkIntToScalar(H) }; 276 SkRect r = { 0, 0, SkIntToScalar(W), SkIntToScalar(H) };
278 for (int i = 0; i < loops * kRepeat; i++) { 277 for (int i = 0; i < loops; i++) {
279 switch (fGeomType) { 278 switch (fGeomType) {
280 case kRect_GeomType: 279 case kRect_GeomType:
281 canvas->drawRect(r, paint); 280 canvas->drawRect(r, paint);
282 break; 281 break;
283 case kOval_GeomType: 282 case kOval_GeomType:
284 canvas->drawOval(r, paint); 283 canvas->drawOval(r, paint);
285 break; 284 break;
286 } 285 }
287 } 286 }
288 } 287 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 canvas->drawRect(r, paint); 380 canvas->drawRect(r, paint);
382 } 381 }
383 } 382 }
384 383
385 private: 384 private:
386 typedef Benchmark INHERITED; 385 typedef Benchmark INHERITED;
387 }; 386 };
388 387
389 DEF_BENCH( return new Gradient2Bench(false); ) 388 DEF_BENCH( return new Gradient2Bench(false); )
390 DEF_BENCH( return new Gradient2Bench(true); ) 389 DEF_BENCH( return new Gradient2Bench(true); )
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698