aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar djsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-01-23 13:40:40 +0000
committerGravatar djsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-01-23 13:40:40 +0000
commite782f5ee472db5e05f3a63607a8c5cdfe838e464 (patch)
tree6a217623aac332e25cb91c2d8a0ec5557438bb47 /src
parent98ded84b80918ac1e40224c125922941f3b2eb03 (diff)
Ensure that streams written using SkFlattenableBuffer's can be read with readByteArray(...)
Review URL: https://codereview.appspot.com/7138063 git-svn-id: http://skia.googlecode.com/svn/trunk@7335 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r--src/core/SkOrderedWriteBuffer.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/core/SkOrderedWriteBuffer.cpp b/src/core/SkOrderedWriteBuffer.cpp
index 7db0312ef4..de265875d9 100644
--- a/src/core/SkOrderedWriteBuffer.cpp
+++ b/src/core/SkOrderedWriteBuffer.cpp
@@ -132,7 +132,12 @@ void SkOrderedWriteBuffer::writePath(const SkPath& path) {
}
size_t SkOrderedWriteBuffer::writeStream(SkStream* stream, size_t length) {
- return fWriter.readFromStream(stream, length);
+ fWriter.write32(length);
+ size_t bytesWritten = fWriter.readFromStream(stream, length);
+ if (bytesWritten < length) {
+ fWriter.reservePad(length - bytesWritten);
+ }
+ return bytesWritten;
}
bool SkOrderedWriteBuffer::writeToStream(SkWStream* stream) {