aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/StrokeBench.cpp
diff options
context:
space:
mode:
authorGravatar caryclark <caryclark@google.com>2015-06-01 06:30:06 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-06-01 06:30:06 -0700
commitc58e5326bbb296ddf598f7d3cdb652baad7bcb6b (patch)
tree8a0e6d49192507e5169b88c2103a17e7aa39860b /bench/StrokeBench.cpp
parentcabe20cafd5f091a68bbc2c0c48755ba9b61b0b7 (diff)
add res to stroke bench
R=reed@google.com Review URL: https://codereview.chromium.org/1158183003
Diffstat (limited to 'bench/StrokeBench.cpp')
-rw-r--r--bench/StrokeBench.cpp30
1 files changed, 22 insertions, 8 deletions
diff --git a/bench/StrokeBench.cpp b/bench/StrokeBench.cpp
index 7844035bcc..8417bbf186 100644
--- a/bench/StrokeBench.cpp
+++ b/bench/StrokeBench.cpp
@@ -13,14 +13,18 @@
class StrokeBench : public Benchmark {
public:
- StrokeBench(const SkPath& path, const SkPaint& paint, const char pathType[])
- : fPath(path), fPaint(paint)
+ StrokeBench(const SkPath& path, const SkPaint& paint, const char pathType[], SkScalar res)
+ : fPath(path), fPaint(paint), fRes(res)
{
fName.printf("build_stroke_%s_%g_%d_%d",
pathType, paint.getStrokeWidth(), paint.getStrokeJoin(), paint.getStrokeCap());
}
protected:
+ virtual bool isSuitableFor(Backend backend) {
+ return backend == kNonRendering_Backend;
+ }
+
const char* onGetName() override { return fName.c_str(); }
void onDraw(const int loops, SkCanvas* canvas) override {
@@ -30,7 +34,7 @@ protected:
for (int outer = 0; outer < 10; ++outer) {
for (int i = 0; i < loops; ++i) {
SkPath result;
- paint.getFillPath(fPath, &result);
+ paint.getFillPath(fPath, &result, NULL, fRes);
}
}
}
@@ -39,7 +43,7 @@ private:
SkPath fPath;
SkPaint fPaint;
SkString fName;
-
+ SkScalar fRes;
typedef Benchmark INHERITED;
};
@@ -99,7 +103,17 @@ static SkPaint paint_maker() {
return paint;
}
-DEF_BENCH( return SkNEW_ARGS(StrokeBench, (line_path_maker(), paint_maker(), "line")); )
-DEF_BENCH( return SkNEW_ARGS(StrokeBench, (quad_path_maker(), paint_maker(), "quad")); )
-DEF_BENCH( return SkNEW_ARGS(StrokeBench, (conic_path_maker(), paint_maker(), "conic")); )
-DEF_BENCH( return SkNEW_ARGS(StrokeBench, (cubic_path_maker(), paint_maker(), "cubic")); )
+DEF_BENCH( return SkNEW_ARGS(StrokeBench, (line_path_maker(), paint_maker(), "line_1", 1)); )
+DEF_BENCH( return SkNEW_ARGS(StrokeBench, (quad_path_maker(), paint_maker(), "quad_1", 1)); )
+DEF_BENCH( return SkNEW_ARGS(StrokeBench, (conic_path_maker(), paint_maker(), "conic_1", 1)); )
+DEF_BENCH( return SkNEW_ARGS(StrokeBench, (cubic_path_maker(), paint_maker(), "cubic_1", 1)); )
+
+DEF_BENCH( return SkNEW_ARGS(StrokeBench, (line_path_maker(), paint_maker(), "line_4", 4)); )
+DEF_BENCH( return SkNEW_ARGS(StrokeBench, (quad_path_maker(), paint_maker(), "quad_4", 4)); )
+DEF_BENCH( return SkNEW_ARGS(StrokeBench, (conic_path_maker(), paint_maker(), "conic_4", 4)); )
+DEF_BENCH( return SkNEW_ARGS(StrokeBench, (cubic_path_maker(), paint_maker(), "cubic_4", 4)); )
+
+DEF_BENCH( return SkNEW_ARGS(StrokeBench, (line_path_maker(), paint_maker(), "line_.25", .25f)); )
+DEF_BENCH( return SkNEW_ARGS(StrokeBench, (quad_path_maker(), paint_maker(), "quad_.25", .25f)); )
+DEF_BENCH( return SkNEW_ARGS(StrokeBench, (conic_path_maker(), paint_maker(), "conic_.25", .25f)); )
+DEF_BENCH( return SkNEW_ARGS(StrokeBench, (cubic_path_maker(), paint_maker(), "cubic_.25", .25f)); )