| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 <stdio.h> | 8 #include <stdio.h> |
| 9 | 9 |
| 10 #include "SkRecord.h" | 10 #include "SkRecord.h" |
| 11 #include "SkRecordDraw.h" | 11 #include "SkRecordDraw.h" |
| 12 | 12 |
| 13 #include "DumpRecord.h" | 13 #include "DumpRecord.h" |
| 14 #include "Timer.h" | 14 #include "Timer.h" |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 class Dumper { | 18 class Dumper { |
| 19 public: | 19 public: |
| 20 explicit Dumper(SkCanvas* canvas, int count, bool timeWithCommand) | 20 explicit Dumper(SkCanvas* canvas, int count, bool timeWithCommand) |
| 21 : fDigits(0) | 21 : fDigits(0) |
| 22 , fIndent(0) | 22 , fIndent(0) |
| 23 , fIndex(0) | 23 , fIndex(0) |
| 24 , fDraw(canvas, NULL, NULL, 0, NULL) | 24 , fDraw(canvas, nullptr, nullptr, 0, nullptr) |
| 25 , fTimeWithCommand(timeWithCommand) { | 25 , fTimeWithCommand(timeWithCommand) { |
| 26 while (count > 0) { | 26 while (count > 0) { |
| 27 count /= 10; | 27 count /= 10; |
| 28 fDigits++; | 28 fDigits++; |
| 29 } | 29 } |
| 30 } | 30 } |
| 31 | 31 |
| 32 template <typename T> | 32 template <typename T> |
| 33 void operator()(const T& command) { | 33 void operator()(const T& command) { |
| 34 Timer timer; | 34 Timer timer; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 } // namespace | 102 } // namespace |
| 103 | 103 |
| 104 void DumpRecord(const SkRecord& record, | 104 void DumpRecord(const SkRecord& record, |
| 105 SkCanvas* canvas, | 105 SkCanvas* canvas, |
| 106 bool timeWithCommand) { | 106 bool timeWithCommand) { |
| 107 Dumper dumper(canvas, record.count(), timeWithCommand); | 107 Dumper dumper(canvas, record.count(), timeWithCommand); |
| 108 for (int i = 0; i < record.count(); i++) { | 108 for (int i = 0; i < record.count(); i++) { |
| 109 record.visit<void>(i, dumper); | 109 record.visit<void>(i, dumper); |
| 110 } | 110 } |
| 111 } | 111 } |
| OLD | NEW |