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

Side by Side Diff: bench/SkBenchmark.h

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/ShaderMaskBench.cpp ('k') | bench/SkBenchmark.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 #ifndef SkBenchmark_DEFINED 8 #ifndef SkBenchmark_DEFINED
9 #define SkBenchmark_DEFINED 9 #define SkBenchmark_DEFINED
10 10
11 #include "SkRefCnt.h" 11 #include "SkRefCnt.h"
12 #include "SkPoint.h" 12 #include "SkPoint.h"
13 #include "SkTRegistry.h" 13 #include "SkTRegistry.h"
14 14
15 #define DEF_BENCH(code) \ 15 #define DEF_BENCH(code) \
16 static SkBenchmark* SK_MACRO_APPEND_LINE(F_)(void* p) { code; } \ 16 static SkBenchmark* SK_MACRO_APPEND_LINE(F_)() { code; } \
17 static BenchRegistry SK_MACRO_APPEND_LINE(R_)(SK_MACRO_APPEND_LINE(F_)); 17 static BenchRegistry SK_MACRO_APPEND_LINE(R_)(SK_MACRO_APPEND_LINE(F_));
18 18
19 /* 19 /*
20 * With the above macros, you can register benches as follows (at the bottom 20 * With the above macros, you can register benches as follows (at the bottom
21 * of your .cpp) 21 * of your .cpp)
22 * 22 *
23 * DEF_BENCH(new MyBenchmark(p, ...)) 23 * DEF_BENCH(return new MyBenchmark(...))
24 * DEF_BENCH(new MyBenchmark(p, ...)) 24 * DEF_BENCH(return new MyBenchmark(...))
25 * DEF_BENCH(new MyBenchmark(p, ...)) 25 * DEF_BENCH(return new MyBenchmark(...))
26 */ 26 */
27 27
28 28
29 class SkCanvas; 29 class SkCanvas;
30 class SkPaint; 30 class SkPaint;
31 31
32 class SkTriState { 32 class SkTriState {
33 public: 33 public:
34 enum State { 34 enum State {
35 kDefault, 35 kDefault,
36 kTrue, 36 kTrue,
37 kFalse 37 kFalse
38 }; 38 };
39 static const char* Name[]; 39 static const char* Name[];
40 }; 40 };
41 41
42 class SkBenchmark : public SkRefCnt { 42 class SkBenchmark : public SkRefCnt {
43 public: 43 public:
44 SK_DECLARE_INST_COUNT(SkBenchmark) 44 SK_DECLARE_INST_COUNT(SkBenchmark)
45 45
46 SkBenchmark(void* defineDict); 46 SkBenchmark();
47 47
48 const char* getName(); 48 const char* getName();
49 SkIPoint getSize(); 49 SkIPoint getSize();
50 50
51 // Call before draw, allows the benchmark to do setup work outside of the 51 // Call before draw, allows the benchmark to do setup work outside of the
52 // timer. When a benchmark is repeatedly drawn, this should be called once 52 // timer. When a benchmark is repeatedly drawn, this should be called once
53 // before the initial draw. 53 // before the initial draw.
54 void preDraw(); 54 void preDraw();
55 55
56 void draw(SkCanvas*); 56 void draw(SkCanvas*);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 int fForceAlpha; 122 int fForceAlpha;
123 bool fForceAA; 123 bool fForceAA;
124 bool fForceFilter; 124 bool fForceFilter;
125 SkTriState::State fDither; 125 SkTriState::State fDither;
126 uint32_t fOrMask, fClearMask; 126 uint32_t fOrMask, fClearMask;
127 int fLoops; 127 int fLoops;
128 128
129 typedef SkRefCnt INHERITED; 129 typedef SkRefCnt INHERITED;
130 }; 130 };
131 131
132 typedef SkTRegistry<SkBenchmark*(*)(void*)> BenchRegistry; 132 typedef SkTRegistry<SkBenchmark*(*)()> BenchRegistry;
133 133
134 #endif 134 #endif
OLDNEW
« no previous file with comments | « bench/ShaderMaskBench.cpp ('k') | bench/SkBenchmark.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698