Index: src/core/SkPicturePlayback.cpp |
=================================================================== |
--- src/core/SkPicturePlayback.cpp (revision 9244) |
+++ src/core/SkPicturePlayback.cpp (working copy) |
@@ -625,11 +625,11 @@ |
#endif |
#ifdef SK_DEVELOPER |
-size_t SkPicturePlayback::preDraw(size_t offset, int type) { |
- return 0; |
+bool SkPicturePlayback::preDraw(int opIndex, int type) { |
+ return false; |
} |
-void SkPicturePlayback::postDraw(size_t offset) { |
+void SkPicturePlayback::postDraw(int opIndex) { |
} |
#endif |
@@ -712,6 +712,10 @@ |
fAbortCurrentPlayback = false; |
#endif |
+#ifdef SK_DEVELOPER |
+ int opIndex = -1; |
+#endif |
+ |
while (!reader.eof()) { |
if (callback && callback->abortDrawing()) { |
canvas.restoreToCount(originalSaveCount); |
@@ -727,14 +731,16 @@ |
uint32_t size; |
DrawType op = read_op_and_size(&reader, &size); |
size_t skipTo = 0; |
+ if (NOOP == op) { |
+ // NOOPs are to be ignored - do not propagate them any further |
+ skipTo = curOffset + size; |
#ifdef SK_DEVELOPER |
- // TODO: once chunk sizes are in all .skps just use |
- // "curOffset + size" |
- skipTo = this->preDraw(curOffset, op); |
+ } else { |
+ opIndex++; |
+ if (this->preDraw(opIndex, op)) { |
+ skipTo = curOffset + size; |
+ } |
#endif |
- if (0 == skipTo && NOOP == op) { |
- // NOOPs are to be ignored - do not propagate them any further |
- skipTo = curOffset + size; |
} |
if (0 != skipTo) { |
@@ -1023,7 +1029,7 @@ |
} |
#ifdef SK_DEVELOPER |
- this->postDraw(curOffset); |
+ this->postDraw(opIndex); |
#endif |
if (it.isValid()) { |