From e4ce5b82627d7ef7cab34b808ff88dc208aef7bc Mon Sep 17 00:00:00 2001 From: "robertphillips@google.com" Date: Fri, 15 Feb 2013 17:19:15 +0000 Subject: Add NOOP "command" to picture format https://codereview.appspot.com/7343044/ git-svn-id: http://skia.googlecode.com/svn/trunk@7752 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/core/SkPicturePlayback.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/core/SkPicturePlayback.cpp') diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp index 3b76ab2101..c6c26ff3ae 100644 --- a/src/core/SkPicturePlayback.cpp +++ b/src/core/SkPicturePlayback.cpp @@ -630,7 +630,11 @@ void SkPicturePlayback::postDraw(size_t offset) { #endif /* - * Read the next op code and chunk size from 'reader' + * Read the next op code and chunk size from 'reader'. The returned size + * is the entire size of the chunk (including the opcode). Thus, the + * offset just prior to calling read_op_and_size + 'size' is the offset + * to the next chunk's op code. This also means that the size of a chunk + * with no arguments (just an opcode) will be 4. */ static DrawType read_op_and_size(SkReader32* reader, uint32_t* size) { uint32_t temp = reader->readInt(); @@ -715,6 +719,12 @@ void SkPicturePlayback::draw(SkCanvas& canvas) { #endif uint32_t size; DrawType op = read_op_and_size(&reader, &size); + if (NOOP == op) { + // NOOPs are to be ignored - do not propagate them any further + reader.setOffset(curOffset+size); + continue; + } + #ifdef SK_DEVELOPER // TODO: once chunk sizes are in all .skps just use "curOffset + size" size_t skipTo = this->preDraw(curOffset, op); -- cgit v1.2.3