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:
parent
70ba047eac
commit
a27f669f46
@ -112,6 +112,37 @@ private:
|
||||
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 {
|
||||
public:
|
||||
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(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(FLAGS01); )
|
||||
DEF_BENCH( return new OvalPathBench(FLAGS10); )
|
||||
|
Loading…
Reference in New Issue
Block a user