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

Side by Side Diff: bench/PathUtilsBench.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/PathIterBench.cpp ('k') | bench/PerlinNoiseBench.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 2011 Google Inc. 2 * Copyright 2011 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 "SkPathUtils.h" 9 #include "SkPathUtils.h"
10 #include "SkRandom.h" 10 #include "SkRandom.h"
(...skipping 24 matching lines...) Expand all
35 35
36 /// Emulates the mix of rects blitted by gmail during scrolling 36 /// Emulates the mix of rects blitted by gmail during scrolling
37 class PathUtilsBench : public SkBenchmark { 37 class PathUtilsBench : public SkBenchmark {
38 typedef void (*Proc)(char*, SkPath*); 38 typedef void (*Proc)(char*, SkPath*);
39 39
40 Proc fProc; 40 Proc fProc;
41 SkString fName; 41 SkString fName;
42 char* bits[H * STRIDE]; 42 char* bits[H * STRIDE];
43 43
44 public: 44 public:
45 PathUtilsBench(void* param, Proc proc, const char name[]) : INHERITED(param) { 45 PathUtilsBench(Proc proc, const char name[]) {
46 fProc = proc; 46 fProc = proc;
47 fName.printf("pathUtils_%s", name); 47 fName.printf("pathUtils_%s", name);
48 48
49 49
50 } 50 }
51 51
52 protected: 52 protected:
53 virtual const char* onGetName() { return fName.c_str(); } 53 virtual const char* onGetName() { return fName.c_str(); }
54 54
55 virtual void onDraw(SkCanvas* canvas) { 55 virtual void onDraw(SkCanvas* canvas) {
56 56
57 for (int i = 0; i < this->getLoops(); ++i){ 57 for (int i = 0; i < this->getLoops(); ++i){
58 //create a random 16x16 bitmap 58 //create a random 16x16 bitmap
59 fillRandomBits(H * STRIDE, (char*) &bits); 59 fillRandomBits(H * STRIDE, (char*) &bits);
60 60
61 //use passed function pointer to handle it 61 //use passed function pointer to handle it
62 SkPath path; 62 SkPath path;
63 fProc( (char*) &bits, &path); 63 fProc( (char*) &bits, &path);
64 } 64 }
65 } 65 }
66 66
67 private: 67 private:
68 typedef SkBenchmark INHERITED; 68 typedef SkBenchmark INHERITED;
69 }; 69 };
70 70
71 static SkBenchmark* PU_path(void* p) { return SkNEW_ARGS(PathUtilsBench, (p, pat h_proc, "path")); } 71 DEF_BENCH( return SkNEW_ARGS(PathUtilsBench, (path_proc, "path")); )
72 static SkBenchmark* PU_region(void* p) { return SkNEW_ARGS(PathUtilsBench, (p, r egion_proc, "region")); } 72 DEF_BENCH( return SkNEW_ARGS(PathUtilsBench, (region_proc, "region")); )
73
74 static BenchRegistry PU_Path(PU_path);
75 static BenchRegistry PU_Region(PU_region);
OLDNEW
« no previous file with comments | « bench/PathIterBench.cpp ('k') | bench/PerlinNoiseBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698