add bench for srcmode

git-svn-id: http://skia.googlecode.com/svn/trunk@6443 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@google.com 2012-11-15 19:52:07 +00:00
parent 60712f3180
commit 2d078b637a

View File

@ -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,