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

Side by Side Diff: bench/Benchmark.h

Issue 1386933002: Cleanup timing state machine (Closed) Base URL: https://skia.googlesource.com/skia.git@vb2
Patch Set: rebase Created 5 years, 2 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
« no previous file with comments | « no previous file | tools/VisualBench/TimingStateMachine.h » ('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 7
8 #ifndef Benchmark_DEFINED 8 #ifndef Benchmark_DEFINED
9 #define Benchmark_DEFINED 9 #define Benchmark_DEFINED
10 10
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 void setPaintMasks(uint32_t orMask, uint32_t clearMask) { 104 void setPaintMasks(uint32_t orMask, uint32_t clearMask) {
105 fOrMask = orMask; 105 fOrMask = orMask;
106 fClearMask = clearMask; 106 fClearMask = clearMask;
107 } 107 }
108 108
109 /* 109 /*
110 * Benches which support running in a visual mode can advertise this functio nality 110 * Benches which support running in a visual mode can advertise this functio nality
111 */ 111 */
112 virtual bool isVisual() { return false; } 112 virtual bool isVisual() { return false; }
113 113
114 /*
115 * VisualBench frequently resets the canvas. As a result we need to bulk ca ll all of the hooks
116 */
117 void preTimingHooks(SkCanvas* canvas) {
118 this->perCanvasPreDraw(canvas);
119 this->preDraw(canvas);
120 }
121
122 void postTimingHooks(SkCanvas* canvas) {
123 this->postDraw(canvas);
124 this->perCanvasPostDraw(canvas);
125 }
126
114 protected: 127 protected:
115 virtual void setupPaint(SkPaint* paint); 128 virtual void setupPaint(SkPaint* paint);
116 129
117 virtual const char* onGetName() = 0; 130 virtual const char* onGetName() = 0;
118 virtual const char* onGetUniqueName() { return this->onGetName(); } 131 virtual const char* onGetUniqueName() { return this->onGetName(); }
119 virtual void onDelayedSetup() {} 132 virtual void onDelayedSetup() {}
120 virtual void onPerCanvasPreDraw(SkCanvas*) {} 133 virtual void onPerCanvasPreDraw(SkCanvas*) {}
121 virtual void onPerCanvasPostDraw(SkCanvas*) {} 134 virtual void onPerCanvasPostDraw(SkCanvas*) {}
122 virtual void onPreDraw(SkCanvas*) {} 135 virtual void onPreDraw(SkCanvas*) {}
123 virtual void onPostDraw(SkCanvas*) {} 136 virtual void onPostDraw(SkCanvas*) {}
124 // Each bench should do its main work in a loop like this: 137 // Each bench should do its main work in a loop like this:
125 // for (int i = 0; i < loops; i++) { <work here> } 138 // for (int i = 0; i < loops; i++) { <work here> }
126 virtual void onDraw(int loops, SkCanvas*) = 0; 139 virtual void onDraw(int loops, SkCanvas*) = 0;
127 140
128 virtual SkIPoint onGetSize(); 141 virtual SkIPoint onGetSize();
129 142
130 private: 143 private:
131 int fForceAlpha; 144 int fForceAlpha;
132 SkTriState::State fDither; 145 SkTriState::State fDither;
133 uint32_t fOrMask, fClearMask; 146 uint32_t fOrMask, fClearMask;
134 147
135 typedef SkRefCnt INHERITED; 148 typedef SkRefCnt INHERITED;
136 }; 149 };
137 150
138 typedef SkTRegistry<Benchmark*(*)(void*)> BenchRegistry; 151 typedef SkTRegistry<Benchmark*(*)(void*)> BenchRegistry;
139 152
140 #endif 153 #endif
OLDNEW
« no previous file with comments | « no previous file | tools/VisualBench/TimingStateMachine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698