Index: bench/SkBenchmark.h |
diff --git a/bench/SkBenchmark.h b/bench/SkBenchmark.h |
index 001b3ab679d0a9529b02ea098710ea3d3b7e8b7f..baadb5140a309f9954396c9b0b402ef67d0a2b2f 100644 |
--- a/bench/SkBenchmark.h |
+++ b/bench/SkBenchmark.h |
@@ -106,6 +106,20 @@ public: |
bool findDefine32(const char* key, int32_t* value) const; |
bool findDefineScalar(const char* key, SkScalar* value) const; |
+ /** |
robertphillips
2013/05/29 13:14:17
// Sets the bit manipulation masks so in ::setupPa
reed1
2013/05/29 15:02:30
Done.
|
+ * Performs the following on the paint: |
+ * uint32_t flags = paint.getFlags(); |
+ * flags &= ~clearMask; |
+ * flags |= orMask; |
+ * paint.setFlags(flags); |
+ */ |
+ void setPaintFlags(uint32_t orMask, uint32_t clearMask) { |
+ fOrMask = orMask; |
+ fClearMask = clearMask; |
+ } |
+ |
+ float getDurationScale() { return this->onGetDurationScale(); } |
+ |
protected: |
virtual void setupPaint(SkPaint* paint); |
@@ -113,6 +127,13 @@ protected: |
virtual void onPreDraw() {} |
virtual void onDraw(SkCanvas*) = 0; |
virtual void onPostDraw() {} |
+ // the caller will scale the computed duration by this value. It allows a |
+ // slow bench to run fewer inner loops, but return the corresponding scale |
+ // so that its reported duration can be compared against other benches. |
+ // e.g. |
+ // if I run 10x slower, I can run 1/10 the number of inner-loops, but |
+ // return 10.0 for my durationScale, so I "report" the honest duration. |
+ virtual float onGetDurationScale() { return 1; } |
virtual SkIPoint onGetSize(); |
/// Defaults to true. |
@@ -126,6 +147,7 @@ private: |
SkTriState::State fDither; |
bool fHasStrokeWidth; |
SkScalar strokeWidth; |
+ uint32_t fOrMask, fClearMask; |
typedef SkRefCnt INHERITED; |
}; |