Benchmark rotated rect with AA/noAA

Using this benchmark, we verify that AA is about 4x slower than noAA in
path_fill_big_rotated_rect. This is what I aim to improve in the next
CL.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2087453003

Review-Url: https://codereview.chromium.org/2087453003
This commit is contained in:
liyuqian 2016-06-20 14:05:27 -07:00 committed by Commit bot
parent 70ba047eac
commit a27f669f46

View File

@ -112,6 +112,37 @@ private:
typedef PathBench INHERITED; typedef PathBench INHERITED;
}; };
class RotatedRectBench : public PathBench {
public:
RotatedRectBench(Flags flags, bool aa, int degrees) : INHERITED(flags) {
fAA = aa;
fDegrees = degrees;
}
void appendName(SkString* name) override {
SkString suffix;
suffix.printf("rotated_rect_%s_%d", fAA ? "aa" : "noaa", fDegrees);
name->append(suffix);
}
void makePath(SkPath* path) override {
SkRect r = { 10, 10, 20, 20 };
path->addRect(r);
SkMatrix rotateMatrix;
rotateMatrix.setRotate((SkScalar)fDegrees);
path->transform(rotateMatrix);
}
virtual void setupPaint(SkPaint* paint) override {
PathBench::setupPaint(paint);
paint->setAntiAlias(fAA);
}
private:
typedef PathBench INHERITED;
int fDegrees;
bool fAA;
};
class OvalPathBench : public PathBench { class OvalPathBench : public PathBench {
public: public:
OvalPathBench(Flags flags) : INHERITED(flags) {} OvalPathBench(Flags flags) : INHERITED(flags) {}
@ -1003,6 +1034,11 @@ DEF_BENCH( return new RectPathBench(FLAGS01); )
DEF_BENCH( return new RectPathBench(FLAGS10); ) DEF_BENCH( return new RectPathBench(FLAGS10); )
DEF_BENCH( return new RectPathBench(FLAGS11); ) DEF_BENCH( return new RectPathBench(FLAGS11); )
DEF_BENCH( return new RotatedRectBench(FLAGS00, false, 45));
DEF_BENCH( return new RotatedRectBench(FLAGS10, false, 45));
DEF_BENCH( return new RotatedRectBench(FLAGS00, true, 45));
DEF_BENCH( return new RotatedRectBench(FLAGS10, true, 45));
DEF_BENCH( return new OvalPathBench(FLAGS00); ) DEF_BENCH( return new OvalPathBench(FLAGS00); )
DEF_BENCH( return new OvalPathBench(FLAGS01); ) DEF_BENCH( return new OvalPathBench(FLAGS01); )
DEF_BENCH( return new OvalPathBench(FLAGS10); ) DEF_BENCH( return new OvalPathBench(FLAGS10); )