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