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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // Called once before and after a series of draw calls to a single canvas. | 75 // Called once before and after a series of draw calls to a single canvas. |
76 // The setup/break down in these calls is not timed. | 76 // The setup/break down in these calls is not timed. |
77 void perCanvasPreDraw(SkCanvas*); | 77 void perCanvasPreDraw(SkCanvas*); |
78 void perCanvasPostDraw(SkCanvas*); | 78 void perCanvasPostDraw(SkCanvas*); |
79 | 79 |
80 // Called just before and after each call to draw(). Not timed. | 80 // Called just before and after each call to draw(). Not timed. |
81 void preDraw(SkCanvas*); | 81 void preDraw(SkCanvas*); |
82 void postDraw(SkCanvas*); | 82 void postDraw(SkCanvas*); |
83 | 83 |
84 // Bench framework can tune loops to be large enough for stable timing. | 84 // Bench framework can tune loops to be large enough for stable timing. |
85 void draw(const int loops, SkCanvas*); | 85 void draw(int loops, SkCanvas*); |
86 | 86 |
87 void setForceAlpha(int alpha) { | 87 void setForceAlpha(int alpha) { |
88 fForceAlpha = alpha; | 88 fForceAlpha = alpha; |
89 } | 89 } |
90 | 90 |
91 void setDither(SkTriState::State state) { | 91 void setDither(SkTriState::State state) { |
92 fDither = state; | 92 fDither = state; |
93 } | 93 } |
94 | 94 |
95 /** Assign masks for paint-flags. These will be applied when setupPaint() | 95 /** Assign masks for paint-flags. These will be applied when setupPaint() |
(...skipping 20 matching lines...) Expand all Loading... |
116 | 116 |
117 virtual const char* onGetName() = 0; | 117 virtual const char* onGetName() = 0; |
118 virtual const char* onGetUniqueName() { return this->onGetName(); } | 118 virtual const char* onGetUniqueName() { return this->onGetName(); } |
119 virtual void onDelayedSetup() {} | 119 virtual void onDelayedSetup() {} |
120 virtual void onPerCanvasPreDraw(SkCanvas*) {} | 120 virtual void onPerCanvasPreDraw(SkCanvas*) {} |
121 virtual void onPerCanvasPostDraw(SkCanvas*) {} | 121 virtual void onPerCanvasPostDraw(SkCanvas*) {} |
122 virtual void onPreDraw(SkCanvas*) {} | 122 virtual void onPreDraw(SkCanvas*) {} |
123 virtual void onPostDraw(SkCanvas*) {} | 123 virtual void onPostDraw(SkCanvas*) {} |
124 // Each bench should do its main work in a loop like this: | 124 // Each bench should do its main work in a loop like this: |
125 // for (int i = 0; i < loops; i++) { <work here> } | 125 // for (int i = 0; i < loops; i++) { <work here> } |
126 virtual void onDraw(const int loops, SkCanvas*) = 0; | 126 virtual void onDraw(int loops, SkCanvas*) = 0; |
127 | 127 |
128 virtual SkIPoint onGetSize(); | 128 virtual SkIPoint onGetSize(); |
129 | 129 |
130 private: | 130 private: |
131 int fForceAlpha; | 131 int fForceAlpha; |
132 SkTriState::State fDither; | 132 SkTriState::State fDither; |
133 uint32_t fOrMask, fClearMask; | 133 uint32_t fOrMask, fClearMask; |
134 | 134 |
135 typedef SkRefCnt INHERITED; | 135 typedef SkRefCnt INHERITED; |
136 }; | 136 }; |
137 | 137 |
138 typedef SkTRegistry<Benchmark*(*)(void*)> BenchRegistry; | 138 typedef SkTRegistry<Benchmark*(*)(void*)> BenchRegistry; |
139 | 139 |
140 #endif | 140 #endif |
OLD | NEW |