diff options
-rw-r--r-- | include/core/SkStream.h | 4 | ||||
-rw-r--r-- | src/core/SkStream.cpp | 25 |
2 files changed, 1 insertions, 28 deletions
diff --git a/include/core/SkStream.h b/include/core/SkStream.h index 9fbd694cf0..d8eeb6c6d4 100644 --- a/include/core/SkStream.h +++ b/include/core/SkStream.h @@ -377,9 +377,7 @@ public: bool write(const void* buffer, size_t size) override; size_t bytesWritten() const override { return fBytesWritten; } - // random access write - // modifies stream and returns true if offset + size is less than or equal to getOffset() - bool write(const void* buffer, size_t offset, size_t size); + bool read(void* buffer, size_t offset, size_t size); size_t getOffset() const { return fBytesWritten; } diff --git a/src/core/SkStream.cpp b/src/core/SkStream.cpp index 060e0942e2..cb47437d0c 100644 --- a/src/core/SkStream.cpp +++ b/src/core/SkStream.cpp @@ -551,31 +551,6 @@ bool SkDynamicMemoryWStream::write(const void* buffer, size_t count) return true; } -bool SkDynamicMemoryWStream::write(const void* buffer, size_t offset, size_t count) -{ - if (offset + count > fBytesWritten) { - return false; // test does not partially modify - } - - this->invalidateCopy(); - - Block* block = fHead; - while (block != nullptr) { - size_t size = block->written(); - if (offset < size) { - size_t part = offset + count > size ? size - offset : count; - memcpy(block->start() + offset, buffer, part); - if (count <= part) - return true; - count -= part; - buffer = (const void*) ((char* ) buffer + part); - } - offset = offset > size ? offset - size : 0; - block = block->fNext; - } - return false; -} - bool SkDynamicMemoryWStream::read(void* buffer, size_t offset, size_t count) { if (offset + count > fBytesWritten) |