diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-11-15 19:52:07 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-11-15 19:52:07 +0000 |
commit | 2d078b637a08d5d4298c50245d3b48950362e9cf (patch) | |
tree | 7be2b09687713114a8d2341677a9c89d048c20d6 /bench | |
parent | 60712f3180f5d35a51292ebfd0f25c16a3925d28 (diff) |
add bench for srcmode
git-svn-id: http://skia.googlecode.com/svn/trunk@6443 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'bench')
-rw-r--r-- | bench/RectBench.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/bench/RectBench.cpp b/bench/RectBench.cpp index f3b9202c37..2674232053 100644 --- a/bench/RectBench.cpp +++ b/bench/RectBench.cpp @@ -73,6 +73,37 @@ private: typedef SkBenchmark INHERITED; }; +class SrcModeRectBench : public RectBench { +public: + SrcModeRectBench(void* param) : INHERITED(param, 1, 0) { + fMode = SkXfermode::Create(SkXfermode::kSrc_Mode); + } + + virtual ~SrcModeRectBench() { + SkSafeUnref(fMode); + } + +protected: + virtual void setupPaint(SkPaint* paint) SK_OVERRIDE { + this->INHERITED::setupPaint(paint); + // srcmode is most interesting when we're not opaque + paint->setAlpha(0x80); + paint->setXfermode(fMode); + } + + virtual const char* onGetName() SK_OVERRIDE { + fName.set(this->INHERITED::onGetName()); + fName.prepend("srcmode_"); + return fName.c_str(); + } + +private: + SkString fName; + SkXfermode* fMode; + + typedef RectBench INHERITED; +}; + class OvalBench : public RectBench { public: OvalBench(void* param, int shift) : RectBench(param, shift) {} @@ -219,6 +250,8 @@ DEF_BENCH( return SkNEW_ARGS(PointsBench, (p, SkCanvas::kPoints_PointMode, "poin DEF_BENCH( return SkNEW_ARGS(PointsBench, (p, SkCanvas::kLines_PointMode, "lines")); ) DEF_BENCH( return SkNEW_ARGS(PointsBench, (p, SkCanvas::kPolygon_PointMode, "polygon")); ) +DEF_BENCH( return SkNEW_ARGS(SrcModeRectBench, (p)); ) + /* init the blitmask bench */ DEF_BENCH( return SkNEW_ARGS(BlitMaskBench, |