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
This commit is contained in:
djsollen@google.com 2013-01-23 13:40:40 +00:00
parent 98ded84b80
commit e782f5ee47

View File

@ -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) {