OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "Benchmark.h" | 8 #include "Benchmark.h" |
9 #include "SkPaint.h" | 9 #include "SkPaint.h" |
10 #include "SkPath.h" | 10 #include "SkPath.h" |
11 #include "SkRandom.h" | 11 #include "SkRandom.h" |
12 #include "SkString.h" | 12 #include "SkString.h" |
13 | 13 |
14 class StrokeBench : public Benchmark { | 14 class StrokeBench : public Benchmark { |
15 public: | 15 public: |
16 StrokeBench(const SkPath& path, const SkPaint& paint, const char pathType[],
SkScalar res) | 16 StrokeBench(const SkPath& path, const SkPaint& paint, const char pathType[],
SkScalar res) |
17 : fPath(path), fPaint(paint), fRes(res) | 17 : fPath(path), fPaint(paint), fRes(res) |
18 { | 18 { |
19 fName.printf("build_stroke_%s_%g_%d_%d", | 19 fName.printf("build_stroke_%s_%g_%d_%d", |
20 pathType, paint.getStrokeWidth(), paint.getStrokeJoin(), pa
int.getStrokeCap()); | 20 pathType, paint.getStrokeWidth(), paint.getStrokeJoin(), pa
int.getStrokeCap()); |
21 } | 21 } |
22 | 22 |
23 protected: | 23 protected: |
24 virtual bool isSuitableFor(Backend backend) { | 24 bool isSuitableFor(Backend backend) override { |
25 return backend == kNonRendering_Backend; | 25 return backend == kNonRendering_Backend; |
26 } | 26 } |
27 | 27 |
28 const char* onGetName() override { return fName.c_str(); } | 28 const char* onGetName() override { return fName.c_str(); } |
29 | 29 |
30 void onDraw(const int loops, SkCanvas* canvas) override { | 30 void onDraw(const int loops, SkCanvas* canvas) override { |
31 SkPaint paint(fPaint); | 31 SkPaint paint(fPaint); |
32 this->setupPaint(&paint); | 32 this->setupPaint(&paint); |
33 | 33 |
34 for (int outer = 0; outer < 10; ++outer) { | 34 for (int outer = 0; outer < 10; ++outer) { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 110 |
111 DEF_BENCH( return SkNEW_ARGS(StrokeBench, (line_path_maker(), paint_maker(), "li
ne_4", 4)); ) | 111 DEF_BENCH( return SkNEW_ARGS(StrokeBench, (line_path_maker(), paint_maker(), "li
ne_4", 4)); ) |
112 DEF_BENCH( return SkNEW_ARGS(StrokeBench, (quad_path_maker(), paint_maker(), "qu
ad_4", 4)); ) | 112 DEF_BENCH( return SkNEW_ARGS(StrokeBench, (quad_path_maker(), paint_maker(), "qu
ad_4", 4)); ) |
113 DEF_BENCH( return SkNEW_ARGS(StrokeBench, (conic_path_maker(), paint_maker(), "c
onic_4", 4)); ) | 113 DEF_BENCH( return SkNEW_ARGS(StrokeBench, (conic_path_maker(), paint_maker(), "c
onic_4", 4)); ) |
114 DEF_BENCH( return SkNEW_ARGS(StrokeBench, (cubic_path_maker(), paint_maker(), "c
ubic_4", 4)); ) | 114 DEF_BENCH( return SkNEW_ARGS(StrokeBench, (cubic_path_maker(), paint_maker(), "c
ubic_4", 4)); ) |
115 | 115 |
116 DEF_BENCH( return SkNEW_ARGS(StrokeBench, (line_path_maker(), paint_maker(), "li
ne_.25", .25f)); ) | 116 DEF_BENCH( return SkNEW_ARGS(StrokeBench, (line_path_maker(), paint_maker(), "li
ne_.25", .25f)); ) |
117 DEF_BENCH( return SkNEW_ARGS(StrokeBench, (quad_path_maker(), paint_maker(), "qu
ad_.25", .25f)); ) | 117 DEF_BENCH( return SkNEW_ARGS(StrokeBench, (quad_path_maker(), paint_maker(), "qu
ad_.25", .25f)); ) |
118 DEF_BENCH( return SkNEW_ARGS(StrokeBench, (conic_path_maker(), paint_maker(), "c
onic_.25", .25f)); ) | 118 DEF_BENCH( return SkNEW_ARGS(StrokeBench, (conic_path_maker(), paint_maker(), "c
onic_.25", .25f)); ) |
119 DEF_BENCH( return SkNEW_ARGS(StrokeBench, (cubic_path_maker(), paint_maker(), "c
ubic_.25", .25f)); ) | 119 DEF_BENCH( return SkNEW_ARGS(StrokeBench, (cubic_path_maker(), paint_maker(), "c
ubic_.25", .25f)); ) |
OLD | NEW |