OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "Benchmark.h" | 8 #include "Benchmark.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 59 |
60 bool isSuitableFor(Backend backend) override { | 60 bool isSuitableFor(Backend backend) override { |
61 return backend == kNonRendering_Backend; | 61 return backend == kNonRendering_Backend; |
62 } | 62 } |
63 | 63 |
64 protected: | 64 protected: |
65 const char* onGetName() override { | 65 const char* onGetName() override { |
66 return fName.c_str(); | 66 return fName.c_str(); |
67 } | 67 } |
68 | 68 |
69 void onDraw(const int loops, SkCanvas*) override { | 69 void onDraw(int loops, SkCanvas*) override { |
70 if (fRaw) { | 70 if (fRaw) { |
71 for (int i = 0; i < loops; ++i) { | 71 for (int i = 0; i < loops; ++i) { |
72 SkPath::RawIter iter(fPath); | 72 SkPath::RawIter iter(fPath); |
73 SkPath::Verb verb; | 73 SkPath::Verb verb; |
74 SkPoint pts[4]; | 74 SkPoint pts[4]; |
75 | 75 |
76 while ((verb = iter.next(pts)) != SkPath::kDone_Verb) { } | 76 while ((verb = iter.next(pts)) != SkPath::kDone_Verb) { } |
77 } | 77 } |
78 } else { | 78 } else { |
79 for (int i = 0; i < loops; ++i) { | 79 for (int i = 0; i < loops; ++i) { |
80 SkPath::Iter iter(fPath, false); | 80 SkPath::Iter iter(fPath, false); |
81 SkPath::Verb verb; | 81 SkPath::Verb verb; |
82 SkPoint pts[4]; | 82 SkPoint pts[4]; |
83 | 83 |
84 while ((verb = iter.next(pts)) != SkPath::kDone_Verb) { } | 84 while ((verb = iter.next(pts)) != SkPath::kDone_Verb) { } |
85 } | 85 } |
86 } | 86 } |
87 } | 87 } |
88 | 88 |
89 private: | 89 private: |
90 typedef Benchmark INHERITED; | 90 typedef Benchmark INHERITED; |
91 }; | 91 }; |
92 | 92 |
93 /////////////////////////////////////////////////////////////////////////////// | 93 /////////////////////////////////////////////////////////////////////////////// |
94 | 94 |
95 DEF_BENCH( return new PathIterBench(false); ) | 95 DEF_BENCH( return new PathIterBench(false); ) |
96 DEF_BENCH( return new PathIterBench(true); ) | 96 DEF_BENCH( return new PathIterBench(true); ) |
OLD | NEW |