OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 #include "SkBenchmark.h" | 7 #include "SkBenchmark.h" |
8 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkPaint.h" | 9 #include "SkPaint.h" |
10 #include "SkRandom.h" | 10 #include "SkRandom.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 protected: | 43 protected: |
44 virtual const char* onGetName() SK_OVERRIDE { | 44 virtual const char* onGetName() SK_OVERRIDE { |
45 fName.printf("path_hairline_%s_%s_", | 45 fName.printf("path_hairline_%s_%s_", |
46 fFlags & kBig_Flag ? "big" : "small", | 46 fFlags & kBig_Flag ? "big" : "small", |
47 fFlags & kAA_Flag ? "AA" : "noAA"); | 47 fFlags & kAA_Flag ? "AA" : "noAA"); |
48 this->appendName(&fName); | 48 this->appendName(&fName); |
49 return fName.c_str(); | 49 return fName.c_str(); |
50 } | 50 } |
51 | 51 |
52 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 52 virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE { |
53 SkPaint paint(fPaint); | 53 SkPaint paint(fPaint); |
54 this->setupPaint(&paint); | 54 this->setupPaint(&paint); |
55 | 55 |
56 paint.setAntiAlias(fFlags & kAA_Flag ? true : false); | 56 paint.setAntiAlias(fFlags & kAA_Flag ? true : false); |
57 | 57 |
58 SkPath path; | 58 SkPath path; |
59 this->makePath(&path); | 59 this->makePath(&path); |
60 if (fFlags & kBig_Flag) { | 60 if (fFlags & kBig_Flag) { |
61 SkMatrix m; | 61 SkMatrix m; |
62 m.setScale(SkIntToScalar(3), SkIntToScalar(3)); | 62 m.setScale(SkIntToScalar(3), SkIntToScalar(3)); |
63 path.transform(m); | 63 path.transform(m); |
64 } | 64 } |
65 | 65 |
66 for (int i = 0; i < this->getLoops(); i++) { | 66 for (int i = 0; i < loops; i++) { |
67 canvas->drawPath(path, paint); | 67 canvas->drawPath(path, paint); |
68 } | 68 } |
69 } | 69 } |
70 | 70 |
71 private: | 71 private: |
72 SkPaint fPaint; | 72 SkPaint fPaint; |
73 SkString fName; | 73 SkString fName; |
74 Flags fFlags; | 74 Flags fFlags; |
75 typedef SkBenchmark INHERITED; | 75 typedef SkBenchmark INHERITED; |
76 }; | 76 }; |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 // Don't have default path renderer for conics yet on GPU, so must use AA | 227 // Don't have default path renderer for conics yet on GPU, so must use AA |
228 // DEF_BENCH( return new ConicPathBench(FLAGS00); ) | 228 // DEF_BENCH( return new ConicPathBench(FLAGS00); ) |
229 // DEF_BENCH( return new ConicPathBench(FLAGS01); ) | 229 // DEF_BENCH( return new ConicPathBench(FLAGS01); ) |
230 DEF_BENCH( return new ConicPathBench(FLAGS10); ) | 230 DEF_BENCH( return new ConicPathBench(FLAGS10); ) |
231 DEF_BENCH( return new ConicPathBench(FLAGS11); ) | 231 DEF_BENCH( return new ConicPathBench(FLAGS11); ) |
232 | 232 |
233 DEF_BENCH( return new CubicPathBench(FLAGS00); ) | 233 DEF_BENCH( return new CubicPathBench(FLAGS00); ) |
234 DEF_BENCH( return new CubicPathBench(FLAGS01); ) | 234 DEF_BENCH( return new CubicPathBench(FLAGS01); ) |
235 DEF_BENCH( return new CubicPathBench(FLAGS10); ) | 235 DEF_BENCH( return new CubicPathBench(FLAGS10); ) |
236 DEF_BENCH( return new CubicPathBench(FLAGS11); ) | 236 DEF_BENCH( return new CubicPathBench(FLAGS11); ) |
OLD | NEW |