diff options
author | yangsu@google.com <yangsu@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-06-16 21:08:19 +0000 |
---|---|---|
committer | yangsu@google.com <yangsu@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-06-16 21:08:19 +0000 |
commit | 1bce0a585733a3e4e5cc1b79eae12b15deee122d (patch) | |
tree | 6d7287e5f0c243dcb012e78c46822fee9ee9e470 | |
parent | a8a42e20f0806fabac8e87b9d06421b93a225267 (diff) |
Modified Pipe Reader to read an atom at a time
http://codereview.appspot.com/4636043/
git-svn-id: http://skia.googlecode.com/svn/trunk@1623 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | include/pipe/SkGPipe.h | 7 | ||||
-rw-r--r-- | src/pipe/SkGPipeRead.cpp | 11 |
2 files changed, 14 insertions, 4 deletions
diff --git a/include/pipe/SkGPipe.h b/include/pipe/SkGPipe.h index 897766f08e..cd10384084 100644 --- a/include/pipe/SkGPipe.h +++ b/include/pipe/SkGPipe.h @@ -31,13 +31,14 @@ public: enum Status { kDone_Status, //!< no more data expected from reader kEOF_Status, //!< need more data from reader - kError_Status //!< encountered error + kError_Status, //!< encountered error + kReadAtom_Status//!< finished reading an atom }; // data must be 4-byte aligned // length must be a multiple of 4 - Status playback(const void* data, size_t length, size_t* bytesRead = NULL); - + Status playback(const void* data, size_t length, size_t* bytesRead = NULL, + bool readAtom = false); private: SkCanvas* fCanvas; class SkGPipeState* fState; diff --git a/src/pipe/SkGPipeRead.cpp b/src/pipe/SkGPipeRead.cpp index ecb19fd059..6665abb3ff 100644 --- a/src/pipe/SkGPipeRead.cpp +++ b/src/pipe/SkGPipeRead.cpp @@ -527,7 +527,7 @@ SkGPipeReader::~SkGPipeReader() { } SkGPipeReader::Status SkGPipeReader::playback(const void* data, size_t length, - size_t* bytesRead) { + size_t* bytesRead, bool readAtom) { if (NULL == fCanvas) { return kError_Status; } @@ -559,6 +559,15 @@ SkGPipeReader::Status SkGPipeReader::playback(const void* data, size_t length, break; } table[op](canvas, &reader, op32, fState); + if (readAtom && + (table[op] != paintOp_rp && + table[op] != def_Typeface_rp && + table[op] != def_PaintFlat_rp && + table[op] != name_PaintFlat_rp + )) { + status = kReadAtom_Status; + break; + } } if (bytesRead) { |