Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Unified Diff: bench/PathBench.cpp

Issue 2087453003: Benchmark rotated rect with AA/noAA (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Scalar Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/PathBench.cpp
diff --git a/bench/PathBench.cpp b/bench/PathBench.cpp
index d0ede02ab70b5bd31531eb0dc4326bb22a22c92e..67e002ba240fe62c380978b59b63e21140c6ec72 100644
--- a/bench/PathBench.cpp
+++ b/bench/PathBench.cpp
@@ -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); )
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698