OLD | NEW |
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 | 7 |
8 #ifndef Benchmark_DEFINED | 8 #ifndef Benchmark_DEFINED |
9 #define Benchmark_DEFINED | 9 #define Benchmark_DEFINED |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 static const char* Name[]; | 42 static const char* Name[]; |
43 }; | 43 }; |
44 | 44 |
45 class Benchmark : public SkRefCnt { | 45 class Benchmark : public SkRefCnt { |
46 public: | 46 public: |
47 SK_DECLARE_INST_COUNT(Benchmark) | 47 SK_DECLARE_INST_COUNT(Benchmark) |
48 | 48 |
49 Benchmark(); | 49 Benchmark(); |
50 | 50 |
51 const char* getName(); | 51 const char* getName(); |
| 52 const char* getUniqueName(); |
52 SkIPoint getSize(); | 53 SkIPoint getSize(); |
53 | 54 |
54 enum Backend { | 55 enum Backend { |
55 kNonRendering_Backend, | 56 kNonRendering_Backend, |
56 kRaster_Backend, | 57 kRaster_Backend, |
57 kGPU_Backend, | 58 kGPU_Backend, |
58 kPDF_Backend, | 59 kPDF_Backend, |
59 }; | 60 }; |
60 | 61 |
61 // Call to determine whether the benchmark is intended for | 62 // Call to determine whether the benchmark is intended for |
(...skipping 29 matching lines...) Expand all Loading... |
91 */ | 92 */ |
92 void setPaintMasks(uint32_t orMask, uint32_t clearMask) { | 93 void setPaintMasks(uint32_t orMask, uint32_t clearMask) { |
93 fOrMask = orMask; | 94 fOrMask = orMask; |
94 fClearMask = clearMask; | 95 fClearMask = clearMask; |
95 } | 96 } |
96 | 97 |
97 protected: | 98 protected: |
98 virtual void setupPaint(SkPaint* paint); | 99 virtual void setupPaint(SkPaint* paint); |
99 | 100 |
100 virtual const char* onGetName() = 0; | 101 virtual const char* onGetName() = 0; |
| 102 virtual const char* onGetUniqueName() { return this->onGetName(); } |
101 virtual void onPreDraw() {} | 103 virtual void onPreDraw() {} |
102 // Each bench should do its main work in a loop like this: | 104 // Each bench should do its main work in a loop like this: |
103 // for (int i = 0; i < loops; i++) { <work here> } | 105 // for (int i = 0; i < loops; i++) { <work here> } |
104 virtual void onDraw(const int loops, SkCanvas*) = 0; | 106 virtual void onDraw(const int loops, SkCanvas*) = 0; |
105 | 107 |
106 virtual SkIPoint onGetSize(); | 108 virtual SkIPoint onGetSize(); |
107 | 109 |
108 private: | 110 private: |
109 int fForceAlpha; | 111 int fForceAlpha; |
110 SkTriState::State fDither; | 112 SkTriState::State fDither; |
111 uint32_t fOrMask, fClearMask; | 113 uint32_t fOrMask, fClearMask; |
112 | 114 |
113 typedef SkRefCnt INHERITED; | 115 typedef SkRefCnt INHERITED; |
114 }; | 116 }; |
115 | 117 |
116 typedef SkTRegistry<Benchmark*(*)(void*)> BenchRegistry; | 118 typedef SkTRegistry<Benchmark*(*)(void*)> BenchRegistry; |
117 | 119 |
118 #endif | 120 #endif |
OLD | NEW |