Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 #ifndef SkBenchmark_DEFINED | 8 #ifndef SkBenchmark_DEFINED |
| 9 #define SkBenchmark_DEFINED | 9 #define SkBenchmark_DEFINED |
| 10 | 10 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 doesn't, and so need not be re-run in every different rendering | 99 doesn't, and so need not be re-run in every different rendering |
| 100 mode. */ | 100 mode. */ |
| 101 bool isRendering() { | 101 bool isRendering() { |
| 102 return fIsRendering; | 102 return fIsRendering; |
| 103 } | 103 } |
| 104 | 104 |
| 105 const char* findDefine(const char* key) const; | 105 const char* findDefine(const char* key) const; |
| 106 bool findDefine32(const char* key, int32_t* value) const; | 106 bool findDefine32(const char* key, int32_t* value) const; |
| 107 bool findDefineScalar(const char* key, SkScalar* value) const; | 107 bool findDefineScalar(const char* key, SkScalar* value) const; |
| 108 | 108 |
| 109 /** | |
|
robertphillips
2013/05/29 13:14:17
// Sets the bit manipulation masks so in ::setupPa
reed1
2013/05/29 15:02:30
Done.
| |
| 110 * Performs the following on the paint: | |
| 111 * uint32_t flags = paint.getFlags(); | |
| 112 * flags &= ~clearMask; | |
| 113 * flags |= orMask; | |
| 114 * paint.setFlags(flags); | |
| 115 */ | |
| 116 void setPaintFlags(uint32_t orMask, uint32_t clearMask) { | |
| 117 fOrMask = orMask; | |
| 118 fClearMask = clearMask; | |
| 119 } | |
| 120 | |
| 121 float getDurationScale() { return this->onGetDurationScale(); } | |
| 122 | |
| 109 protected: | 123 protected: |
| 110 virtual void setupPaint(SkPaint* paint); | 124 virtual void setupPaint(SkPaint* paint); |
| 111 | 125 |
| 112 virtual const char* onGetName() = 0; | 126 virtual const char* onGetName() = 0; |
| 113 virtual void onPreDraw() {} | 127 virtual void onPreDraw() {} |
| 114 virtual void onDraw(SkCanvas*) = 0; | 128 virtual void onDraw(SkCanvas*) = 0; |
| 115 virtual void onPostDraw() {} | 129 virtual void onPostDraw() {} |
| 130 // the caller will scale the computed duration by this value. It allows a | |
| 131 // slow bench to run fewer inner loops, but return the corresponding scale | |
| 132 // so that its reported duration can be compared against other benches. | |
| 133 // e.g. | |
| 134 // if I run 10x slower, I can run 1/10 the number of inner-loops, but | |
| 135 // return 10.0 for my durationScale, so I "report" the honest duration. | |
| 136 virtual float onGetDurationScale() { return 1; } | |
| 116 | 137 |
| 117 virtual SkIPoint onGetSize(); | 138 virtual SkIPoint onGetSize(); |
| 118 /// Defaults to true. | 139 /// Defaults to true. |
| 119 bool fIsRendering; | 140 bool fIsRendering; |
| 120 | 141 |
| 121 private: | 142 private: |
| 122 const SkTDict<const char*>* fDict; | 143 const SkTDict<const char*>* fDict; |
| 123 int fForceAlpha; | 144 int fForceAlpha; |
| 124 bool fForceAA; | 145 bool fForceAA; |
| 125 bool fForceFilter; | 146 bool fForceFilter; |
| 126 SkTriState::State fDither; | 147 SkTriState::State fDither; |
| 127 bool fHasStrokeWidth; | 148 bool fHasStrokeWidth; |
| 128 SkScalar strokeWidth; | 149 SkScalar strokeWidth; |
| 150 uint32_t fOrMask, fClearMask; | |
| 129 | 151 |
| 130 typedef SkRefCnt INHERITED; | 152 typedef SkRefCnt INHERITED; |
| 131 }; | 153 }; |
| 132 | 154 |
| 133 typedef SkTRegistry<SkBenchmark*, void*> BenchRegistry; | 155 typedef SkTRegistry<SkBenchmark*, void*> BenchRegistry; |
| 134 | 156 |
| 135 #endif | 157 #endif |
| OLD | NEW |