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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkPath.h" | 10 #include "SkPath.h" |
11 #include "SkString.h" | 11 #include "sk_tool_utils.h" |
12 | |
13 static void make_path(SkPath& path) { | |
14 #include "BigPathBench.inc" | |
15 } | |
16 | 12 |
17 enum Align { | 13 enum Align { |
18 kLeft_Align, | 14 kLeft_Align, |
19 kMiddle_Align, | 15 kMiddle_Align, |
20 kRight_Align | 16 kRight_Align |
21 }; | 17 }; |
22 | 18 |
23 const char* gAlignName[] = { "left", "middle", "right" }; | 19 const char* gAlignName[] = { "left", "middle", "right" }; |
24 | 20 |
25 // Inspired by crbug.com/455429 | 21 // Inspired by crbug.com/455429 |
(...skipping 14 matching lines...) Expand all Loading... |
40 protected: | 36 protected: |
41 const char* onGetName() override { | 37 const char* onGetName() override { |
42 return fName.c_str(); | 38 return fName.c_str(); |
43 } | 39 } |
44 | 40 |
45 SkIPoint onGetSize() override { | 41 SkIPoint onGetSize() override { |
46 return SkIPoint::Make(640, 100); | 42 return SkIPoint::Make(640, 100); |
47 } | 43 } |
48 | 44 |
49 void onDelayedSetup() override { | 45 void onDelayedSetup() override { |
50 make_path(fPath); | 46 sk_tool_utils::make_big_path(fPath); |
51 } | 47 } |
52 | 48 |
53 void onDraw(int loops, SkCanvas* canvas) override { | 49 void onDraw(int loops, SkCanvas* canvas) override { |
54 SkPaint paint; | 50 SkPaint paint; |
55 paint.setAntiAlias(true); | 51 paint.setAntiAlias(true); |
56 paint.setStyle(SkPaint::kStroke_Style); | 52 paint.setStyle(SkPaint::kStroke_Style); |
57 paint.setStrokeWidth(2); | 53 paint.setStrokeWidth(2); |
58 if (fRound) { | 54 if (fRound) { |
59 paint.setStrokeJoin(SkPaint::kRound_Join); | 55 paint.setStrokeJoin(SkPaint::kRound_Join); |
60 } | 56 } |
(...skipping 21 matching lines...) Expand all Loading... |
82 }; | 78 }; |
83 | 79 |
84 DEF_BENCH( return new BigPathBench(kLeft_Align, false); ) | 80 DEF_BENCH( return new BigPathBench(kLeft_Align, false); ) |
85 DEF_BENCH( return new BigPathBench(kMiddle_Align, false); ) | 81 DEF_BENCH( return new BigPathBench(kMiddle_Align, false); ) |
86 DEF_BENCH( return new BigPathBench(kRight_Align, false); ) | 82 DEF_BENCH( return new BigPathBench(kRight_Align, false); ) |
87 | 83 |
88 DEF_BENCH( return new BigPathBench(kLeft_Align, true); ) | 84 DEF_BENCH( return new BigPathBench(kLeft_Align, true); ) |
89 DEF_BENCH( return new BigPathBench(kMiddle_Align, true); ) | 85 DEF_BENCH( return new BigPathBench(kMiddle_Align, true); ) |
90 DEF_BENCH( return new BigPathBench(kRight_Align, true); ) | 86 DEF_BENCH( return new BigPathBench(kRight_Align, true); ) |
91 | 87 |
OLD | NEW |