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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 * uint32_t flags = paint.getFlags(); | 100 * uint32_t flags = paint.getFlags(); |
101 * flags &= ~clearMask; | 101 * flags &= ~clearMask; |
102 * flags |= orMask; | 102 * flags |= orMask; |
103 * paint.setFlags(flags); | 103 * paint.setFlags(flags); |
104 */ | 104 */ |
105 void setPaintMasks(uint32_t orMask, uint32_t clearMask) { | 105 void setPaintMasks(uint32_t orMask, uint32_t clearMask) { |
106 fOrMask = orMask; | 106 fOrMask = orMask; |
107 fClearMask = clearMask; | 107 fClearMask = clearMask; |
108 } | 108 } |
109 | 109 |
110 static void SetResourcePath(const char*); | 110 static void SetResourcePath(const char* resPath) { gResourcePath.set(resPath
); } |
111 static SkString GetResourcePath(); | 111 |
| 112 static SkString& GetResourcePath() { return gResourcePath; } |
112 | 113 |
113 protected: | 114 protected: |
114 virtual void setupPaint(SkPaint* paint); | 115 virtual void setupPaint(SkPaint* paint); |
115 | 116 |
116 virtual const char* onGetName() = 0; | 117 virtual const char* onGetName() = 0; |
117 virtual void onPreDraw() {} | 118 virtual void onPreDraw() {} |
118 // Each bench should do its main work in a loop like this: | 119 // Each bench should do its main work in a loop like this: |
119 // for (int i = 0; i < loops; i++) { <work here> } | 120 // for (int i = 0; i < loops; i++) { <work here> } |
120 virtual void onDraw(const int loops, SkCanvas*) = 0; | 121 virtual void onDraw(const int loops, SkCanvas*) = 0; |
121 virtual void onPostDraw() {} | 122 virtual void onPostDraw() {} |
122 | 123 |
123 virtual SkIPoint onGetSize(); | 124 virtual SkIPoint onGetSize(); |
124 | 125 |
125 private: | 126 private: |
126 int fForceAlpha; | 127 int fForceAlpha; |
127 bool fForceAA; | 128 bool fForceAA; |
128 bool fForceFilter; | 129 bool fForceFilter; |
129 SkTriState::State fDither; | 130 SkTriState::State fDither; |
130 uint32_t fOrMask, fClearMask; | 131 uint32_t fOrMask, fClearMask; |
131 static const char* gResourcePath; | 132 static SkString gResourcePath; |
132 | 133 |
133 typedef SkRefCnt INHERITED; | 134 typedef SkRefCnt INHERITED; |
134 }; | 135 }; |
135 | 136 |
136 typedef SkTRegistry<SkBenchmark*(*)(void*)> BenchRegistry; | 137 typedef SkTRegistry<SkBenchmark*(*)(void*)> BenchRegistry; |
137 | 138 |
138 #endif | 139 #endif |
OLD | NEW |