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

Side by Side Diff: bench/PathIterBench.cpp

Issue 23876006: Refactoring: get rid of the SkBenchmark void* parameter. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: sync to head 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/PathBench.cpp ('k') | bench/PathUtilsBench.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 "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 13 matching lines...) Expand all
24 } 24 }
25 return n; 25 return n;
26 } 26 }
27 27
28 class PathIterBench : public SkBenchmark { 28 class PathIterBench : public SkBenchmark {
29 SkString fName; 29 SkString fName;
30 SkPath fPath; 30 SkPath fPath;
31 bool fRaw; 31 bool fRaw;
32 32
33 public: 33 public:
34 PathIterBench(void* param, bool raw) : INHERITED(param) { 34 PathIterBench(bool raw) {
35 fName.printf("pathiter_%s", raw ? "raw" : "consume"); 35 fName.printf("pathiter_%s", raw ? "raw" : "consume");
36 fRaw = raw; 36 fRaw = raw;
37 37
38 SkRandom rand; 38 SkRandom rand;
39 for (int i = 0; i < 1000; ++i) { 39 for (int i = 0; i < 1000; ++i) {
40 SkPoint pts[4]; 40 SkPoint pts[4];
41 int n = rand_pts(rand, pts); 41 int n = rand_pts(rand, pts);
42 switch (n) { 42 switch (n) {
43 case 1: 43 case 1:
44 fPath.moveTo(pts[0]); 44 fPath.moveTo(pts[0]);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 } 82 }
83 } 83 }
84 } 84 }
85 85
86 private: 86 private:
87 typedef SkBenchmark INHERITED; 87 typedef SkBenchmark INHERITED;
88 }; 88 };
89 89
90 /////////////////////////////////////////////////////////////////////////////// 90 ///////////////////////////////////////////////////////////////////////////////
91 91
92 static SkBenchmark* F0(void* p) { return new PathIterBench(p, false); } 92 DEF_BENCH( return new PathIterBench(false); )
93 static SkBenchmark* F1(void* p) { return new PathIterBench(p, true); } 93 DEF_BENCH( return new PathIterBench(true); )
94
95 static BenchRegistry gR0(F0);
96 static BenchRegistry gR1(F1);
OLDNEW
« no previous file with comments | « bench/PathBench.cpp ('k') | bench/PathUtilsBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698