diff options
author | 2014-03-12 14:46:41 +0000 | |
---|---|---|
committer | 2014-03-12 14:46:41 +0000 | |
commit | 9e5f85e89d03a850d435fc951e74e9861a0c1bdd (patch) | |
tree | b42ed92b9bd943cfb3321008d05e5746263cb0e9 /src/core/SkValidatingReadBuffer.cpp | |
parent | b6401863fbeb7bf5c12d88fb9de78c7b5a346457 (diff) |
Fixing SkPicture serialization
Fixed a few issues while attempting to use the new
serialization path for SkPicture inside a fuzzer:
- SkReadBuffer and SkValidatingReadBuffer both had a fReader
member instead of sharing the same member, which leads to
problems if a base class function is used
- In SkPicture, a header is now written as a single chunk of
data, so it also has to be read as a single chunk of data
- In the SkPicturePlayback destructor, a bad deserialization
would lead to a crash if we don't safely unref fOpData
- Also in SkPicturePlayback, if we only use a ReadBuffer for
the whole deserialization, additional tags must be added to
parseBufferTag()
- SkValidatingReadBuffer::readBitmap() was broken, but this
path wasn't usen't since the only use case for
SkValidatingReadBuffer is currently image filters and
bitmaps are unflattened as part of the deserialization of
SkBitmapSource
- SkPictureImageFilter was not deserializable. Added it to
SkGlobalInitialization*
- Added a test that exercises the SkPicture serialization /
deserialization code
BUG=skia:
R=senorblanco@google.com, senorblanco@chromium.org, reed@google.com, robertphillips@google.com
Author: sugoi@chromium.org
Review URL: https://codereview.chromium.org/195223003
git-svn-id: http://skia.googlecode.com/svn/trunk@13764 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkValidatingReadBuffer.cpp')
-rw-r--r-- | src/core/SkValidatingReadBuffer.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/core/SkValidatingReadBuffer.cpp b/src/core/SkValidatingReadBuffer.cpp index ae7a83684b..8db2c68b9a 100644 --- a/src/core/SkValidatingReadBuffer.cpp +++ b/src/core/SkValidatingReadBuffer.cpp @@ -213,10 +213,10 @@ uint32_t SkValidatingReadBuffer::getArrayCount() { void SkValidatingReadBuffer::readBitmap(SkBitmap* bitmap) { const int width = this->readInt(); const int height = this->readInt(); + const bool useBitmapHeap = this->readBool(); const size_t length = this->readUInt(); // A size of zero means the SkBitmap was simply flattened. - this->validate(length == 0); - if (fError) { + if (!this->validate(!useBitmapHeap && (0 == length))) { return; } bitmap->unflatten(*this); |