Index: bench/XfermodeBench.cpp |
diff --git a/bench/XfermodeBench.cpp b/bench/XfermodeBench.cpp |
index e9b3b95021ed5f1ed8ea9f4d4719d31938042651..29e8598758e8adef2d6dafc0a060db8b63dc5ecf 100644 |
--- a/bench/XfermodeBench.cpp |
+++ b/bench/XfermodeBench.cpp |
@@ -62,6 +62,28 @@ private: |
typedef SkBenchmark INHERITED; |
}; |
+class XferCreateBench : public SkBenchmark { |
+public: |
+ XferCreateBench() { |
+ fIsRendering = false; |
+ } |
+ |
+protected: |
+ virtual const char* onGetName() SK_OVERRIDE { return "xfermode_create"; } |
+ |
+ virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
+ for (int outer = 0; outer < this->getLoops() * 10; ++outer) { |
djsollen
2013/10/04 16:19:27
do we really need the 10x multiplier here
mtklein
2013/10/04 16:24:57
Not really, but it doesn't hurt. The only effect
|
+ for (int i = 0; i <= SkXfermode::kLastMode; ++i) { |
+ SkXfermode* xfer = SkXfermode::Create(SkXfermode::Mode(i)); |
+ SkSafeUnref(xfer); |
+ } |
+ } |
+ } |
+ |
+private: |
+ typedef SkBenchmark INHERITED; |
+}; |
+ |
////////////////////////////////////////////////////////////////////////////// |
#define CONCAT_I(x, y) x ## y |
@@ -106,3 +128,5 @@ BENCH(SkXfermode::kLuminosity_Mode) |
BENCH(SkLumaMaskXfermode::Create(SkXfermode::kSrcIn_Mode), "SrcInLuma") |
BENCH(SkLumaMaskXfermode::Create(SkXfermode::kDstIn_Mode), "DstInLuma") |
BENCH(SkLumaMaskXfermode::Create(SkXfermode::kSrcOver_Mode), "SrcOverLuma") |
+ |
+DEF_BENCH(return new XferCreateBench;) |