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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 case 3: | 49 case 3: |
50 fPath.quadTo(pts[1], pts[2]); | 50 fPath.quadTo(pts[1], pts[2]); |
51 break; | 51 break; |
52 case 4: | 52 case 4: |
53 fPath.cubicTo(pts[1], pts[2], pts[3]); | 53 fPath.cubicTo(pts[1], pts[2], pts[3]); |
54 break; | 54 break; |
55 } | 55 } |
56 } | 56 } |
57 } | 57 } |
58 | 58 |
59 virtual bool isSuitableFor(Backend backend) SK_OVERRIDE { | 59 bool isSuitableFor(Backend backend) SK_OVERRIDE { |
60 return backend == kNonRendering_Backend; | 60 return backend == kNonRendering_Backend; |
61 } | 61 } |
62 | 62 |
63 protected: | 63 protected: |
64 virtual const char* onGetName() SK_OVERRIDE { | 64 const char* onGetName() SK_OVERRIDE { |
65 return fName.c_str(); | 65 return fName.c_str(); |
66 } | 66 } |
67 | 67 |
68 virtual void onDraw(const int loops, SkCanvas*) SK_OVERRIDE { | 68 void onDraw(const int loops, SkCanvas*) SK_OVERRIDE { |
69 if (fRaw) { | 69 if (fRaw) { |
70 for (int i = 0; i < loops; ++i) { | 70 for (int i = 0; i < loops; ++i) { |
71 SkPath::RawIter iter(fPath); | 71 SkPath::RawIter iter(fPath); |
72 SkPath::Verb verb; | 72 SkPath::Verb verb; |
73 SkPoint pts[4]; | 73 SkPoint pts[4]; |
74 | 74 |
75 while ((verb = iter.next(pts)) != SkPath::kDone_Verb) { } | 75 while ((verb = iter.next(pts)) != SkPath::kDone_Verb) { } |
76 } | 76 } |
77 } else { | 77 } else { |
78 for (int i = 0; i < loops; ++i) { | 78 for (int i = 0; i < loops; ++i) { |
79 SkPath::Iter iter(fPath, false); | 79 SkPath::Iter iter(fPath, false); |
80 SkPath::Verb verb; | 80 SkPath::Verb verb; |
81 SkPoint pts[4]; | 81 SkPoint pts[4]; |
82 | 82 |
83 while ((verb = iter.next(pts)) != SkPath::kDone_Verb) { } | 83 while ((verb = iter.next(pts)) != SkPath::kDone_Verb) { } |
84 } | 84 } |
85 } | 85 } |
86 } | 86 } |
87 | 87 |
88 private: | 88 private: |
89 typedef Benchmark INHERITED; | 89 typedef Benchmark INHERITED; |
90 }; | 90 }; |
91 | 91 |
92 /////////////////////////////////////////////////////////////////////////////// | 92 /////////////////////////////////////////////////////////////////////////////// |
93 | 93 |
94 DEF_BENCH( return new PathIterBench(false); ) | 94 DEF_BENCH( return new PathIterBench(false); ) |
95 DEF_BENCH( return new PathIterBench(true); ) | 95 DEF_BENCH( return new PathIterBench(true); ) |
OLD | NEW |