Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(853)

Unified Diff: tools/DumpRecord.cpp

Issue 527423002: SkRecordPartialDraw with less code duplication (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: test Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/RecordDrawTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/DumpRecord.cpp
diff --git a/tools/DumpRecord.cpp b/tools/DumpRecord.cpp
index 6e679a5430a4269855c905b1e18a4b7680bd1398..c505123acd66be2200227c61193b3633fc139e02 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);
}
}
« no previous file with comments | « tests/RecordDrawTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698