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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 void preTimingHooks(SkCanvas* canvas) { | 117 void preTimingHooks(SkCanvas* canvas) { |
118 this->perCanvasPreDraw(canvas); | 118 this->perCanvasPreDraw(canvas); |
119 this->preDraw(canvas); | 119 this->preDraw(canvas); |
120 } | 120 } |
121 | 121 |
122 void postTimingHooks(SkCanvas* canvas) { | 122 void postTimingHooks(SkCanvas* canvas) { |
123 this->postDraw(canvas); | 123 this->postDraw(canvas); |
124 this->perCanvasPostDraw(canvas); | 124 this->perCanvasPostDraw(canvas); |
125 } | 125 } |
126 | 126 |
| 127 virtual void getGpuStats(SkCanvas*, SkTArray<SkString>* keys, SkTArray<doubl
e>* values) {} |
| 128 |
127 protected: | 129 protected: |
128 virtual void setupPaint(SkPaint* paint); | 130 virtual void setupPaint(SkPaint* paint); |
129 | 131 |
130 virtual const char* onGetName() = 0; | 132 virtual const char* onGetName() = 0; |
131 virtual const char* onGetUniqueName() { return this->onGetName(); } | 133 virtual const char* onGetUniqueName() { return this->onGetName(); } |
132 virtual void onDelayedSetup() {} | 134 virtual void onDelayedSetup() {} |
133 virtual void onPerCanvasPreDraw(SkCanvas*) {} | 135 virtual void onPerCanvasPreDraw(SkCanvas*) {} |
134 virtual void onPerCanvasPostDraw(SkCanvas*) {} | 136 virtual void onPerCanvasPostDraw(SkCanvas*) {} |
135 virtual void onPreDraw(SkCanvas*) {} | 137 virtual void onPreDraw(SkCanvas*) {} |
136 virtual void onPostDraw(SkCanvas*) {} | 138 virtual void onPostDraw(SkCanvas*) {} |
137 // Each bench should do its main work in a loop like this: | 139 // Each bench should do its main work in a loop like this: |
138 // for (int i = 0; i < loops; i++) { <work here> } | 140 // for (int i = 0; i < loops; i++) { <work here> } |
139 virtual void onDraw(int loops, SkCanvas*) = 0; | 141 virtual void onDraw(int loops, SkCanvas*) = 0; |
140 | 142 |
141 virtual SkIPoint onGetSize(); | 143 virtual SkIPoint onGetSize(); |
142 | 144 |
143 private: | 145 private: |
144 int fForceAlpha; | 146 int fForceAlpha; |
145 SkTriState::State fDither; | 147 SkTriState::State fDither; |
146 uint32_t fOrMask, fClearMask; | 148 uint32_t fOrMask, fClearMask; |
147 | 149 |
148 typedef SkRefCnt INHERITED; | 150 typedef SkRefCnt INHERITED; |
149 }; | 151 }; |
150 | 152 |
151 typedef SkTRegistry<Benchmark*(*)(void*)> BenchRegistry; | 153 typedef SkTRegistry<Benchmark*(*)(void*)> BenchRegistry; |
152 | 154 |
153 #endif | 155 #endif |
OLD | NEW |