| 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 "SkBenchmark.h" | 8 #include "SkBenchmark.h" |
| 9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 virtual bool isSuitableFor(Backend backend) SK_OVERRIDE { | 59 virtual 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 virtual const char* onGetName() SK_OVERRIDE { |
| 65 return fName.c_str(); | 65 return fName.c_str(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 virtual void onDraw(SkCanvas*) SK_OVERRIDE { | 68 virtual void onDraw(const int loops, SkCanvas*) SK_OVERRIDE { |
| 69 if (fRaw) { | 69 if (fRaw) { |
| 70 for (int i = 0; i < this->getLoops(); ++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 < this->getLoops(); ++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 SkBenchmark INHERITED; | 89 typedef SkBenchmark 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 |