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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
68 } | 68 } |
69 | 69 |
70 // Call before draw, allows the benchmark to do setup work outside of the | 70 // Call before draw, allows the benchmark to do setup work outside of the |
71 // timer. When a benchmark is repeatedly drawn, this should be called once | 71 // timer. When a benchmark is repeatedly drawn, this should be called once |
72 // before the initial draw. | 72 // before the initial draw. |
73 void preDraw(); | 73 void preDraw(); |
74 | 74 |
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 perCanvasLastCallBeforeDraw(SkCanvas*); | |
mtklein_C
2015/09/30 17:26:29
Having names this similar to the perCanvas-flavore
joshualitt
2015/09/30 17:57:17
done
| |
79 void perCanvasFirstCallAfterDraw(SkCanvas*); | |
78 void perCanvasPostDraw(SkCanvas*); | 80 void perCanvasPostDraw(SkCanvas*); |
79 | 81 |
80 // Bench framework can tune loops to be large enough for stable timing. | 82 // Bench framework can tune loops to be large enough for stable timing. |
81 void draw(const int loops, SkCanvas*); | 83 void draw(const int loops, SkCanvas*); |
82 | 84 |
83 void setForceAlpha(int alpha) { | 85 void setForceAlpha(int alpha) { |
84 fForceAlpha = alpha; | 86 fForceAlpha = alpha; |
85 } | 87 } |
86 | 88 |
87 void setDither(SkTriState::State state) { | 89 void setDither(SkTriState::State state) { |
(...skipping 19 matching lines...) Expand all Loading... | |
107 */ | 109 */ |
108 virtual bool isVisual() { return false; } | 110 virtual bool isVisual() { return false; } |
109 | 111 |
110 protected: | 112 protected: |
111 virtual void setupPaint(SkPaint* paint); | 113 virtual void setupPaint(SkPaint* paint); |
112 | 114 |
113 virtual const char* onGetName() = 0; | 115 virtual const char* onGetName() = 0; |
114 virtual const char* onGetUniqueName() { return this->onGetName(); } | 116 virtual const char* onGetUniqueName() { return this->onGetName(); } |
115 virtual void onPreDraw() {} | 117 virtual void onPreDraw() {} |
116 virtual void onPerCanvasPreDraw(SkCanvas*) {} | 118 virtual void onPerCanvasPreDraw(SkCanvas*) {} |
119 virtual void onPerCanvasLastCallBeforeDraw(SkCanvas*) {} | |
120 virtual void onPerCanvasFirstCallAfterDraw(SkCanvas*) {} | |
117 virtual void onPerCanvasPostDraw(SkCanvas*) {} | 121 virtual void onPerCanvasPostDraw(SkCanvas*) {} |
118 // Each bench should do its main work in a loop like this: | 122 // Each bench should do its main work in a loop like this: |
119 // for (int i = 0; i < loops; i++) { <work here> } | 123 // for (int i = 0; i < loops; i++) { <work here> } |
120 virtual void onDraw(const int loops, SkCanvas*) = 0; | 124 virtual void onDraw(const int loops, SkCanvas*) = 0; |
121 | 125 |
122 virtual SkIPoint onGetSize(); | 126 virtual SkIPoint onGetSize(); |
123 | 127 |
124 private: | 128 private: |
125 int fForceAlpha; | 129 int fForceAlpha; |
126 SkTriState::State fDither; | 130 SkTriState::State fDither; |
127 uint32_t fOrMask, fClearMask; | 131 uint32_t fOrMask, fClearMask; |
128 | 132 |
129 typedef SkRefCnt INHERITED; | 133 typedef SkRefCnt INHERITED; |
130 }; | 134 }; |
131 | 135 |
132 typedef SkTRegistry<Benchmark*(*)(void*)> BenchRegistry; | 136 typedef SkTRegistry<Benchmark*(*)(void*)> BenchRegistry; |
133 | 137 |
134 #endif | 138 #endif |
OLD | NEW |