aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPicturePlayback.cpp
diff options
context:
space:
mode:
authorGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-02-15 17:19:15 +0000
committerGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-02-15 17:19:15 +0000
commite4ce5b82627d7ef7cab34b808ff88dc208aef7bc (patch)
tree033bbb9a59e45b0d291a7fffc3c30f5f79daf32a /src/core/SkPicturePlayback.cpp
parentaa6470af8ee401831958a9ce35ae3e3ed36e31cc (diff)
Add NOOP "command" to picture format
Diffstat (limited to 'src/core/SkPicturePlayback.cpp')
-rw-r--r--src/core/SkPicturePlayback.cpp12
1 files changed, 11 insertions, 1 deletions
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);