diff options
author | mtklein <mtklein@chromium.org> | 2014-09-02 12:03:31 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-02 12:03:31 -0700 |
commit | 00f30bdc9e34b013da54b4406f36556c5be8d041 (patch) | |
tree | bc3dac91df9e6d0f2e610855a0ca21fb97594c6a /tools/DumpRecord.cpp | |
parent | aca21d6d2f9984da8f941b76f4ee11772d0e48ec (diff) |
SkRecordPartialDraw with less code duplication
BUG=skia:
R=robertphillips@google.com, mtklein@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/527423002
Diffstat (limited to 'tools/DumpRecord.cpp')
-rw-r--r-- | tools/DumpRecord.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/tools/DumpRecord.cpp b/tools/DumpRecord.cpp index 6e679a5430..c505123acd 100644 --- a/tools/DumpRecord.cpp +++ b/tools/DumpRecord.cpp @@ -20,6 +20,7 @@ public: explicit Dumper(SkCanvas* canvas, int count, bool timeWithCommand) : fDigits(0) , fIndent(0) + , fIndex(0) , fDraw(canvas) , fTimeWithCommand(timeWithCommand) { while (count > 0) { @@ -28,9 +29,6 @@ public: } } - unsigned index() const { return fDraw.index(); } - void next() { fDraw.next(); } - template <typename T> void operator()(const T& command) { Timer timer; @@ -71,7 +69,7 @@ private: if (!fTimeWithCommand) { printf("%6.1f ", time * 1000); } - printf("%*d ", fDigits, fDraw.index()); + printf("%*d ", fDigits, fIndex++); for (int i = 0; i < fIndent; i++) { putchar('\t'); } @@ -96,6 +94,7 @@ private: int fDigits; int fIndent; + int fIndex; SkRecords::Draw fDraw; const bool fTimeWithCommand; }; @@ -105,9 +104,8 @@ private: void DumpRecord(const SkRecord& record, SkCanvas* canvas, bool timeWithCommand) { - for (Dumper dumper(canvas, record.count(), timeWithCommand); - dumper.index() < record.count(); - dumper.next()) { - record.visit<void>(dumper.index(), dumper); + Dumper dumper(canvas, record.count(), timeWithCommand); + for (unsigned i = 0; i < record.count(); i++) { + record.visit<void>(i, dumper); } } |