diff options
author | senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-05-30 20:50:56 +0000 |
---|---|---|
committer | senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-05-30 20:50:56 +0000 |
commit | 97f5fc651956287e78e35934cf62b9e1b45b4f6c (patch) | |
tree | 9aed84527f56452f05442457830ac30f0ef2ba6d /src | |
parent | 1fd263edb3bac44c8921bd34590bbc57fb348001 (diff) |
Allow SkPictureImageFilter to be serialized when not run cross-process.
Picture serialization is not yet hardened, but it turns out we do need
serialization of SkPictureImageFilter for deferred SVG-on-SVG filters,
since the SkPaints (and thus the SkImageFilters) are serialized by
SkPictureRecord. However, deferred filters are always drawn in the
same process, so we can safely serialize them in this case. We do this
by turning the compile-time check for
SK_ALLOW_PICTUREIMAGEFILTER_SERIALIZATION to a runtime check for
isCrossProcess().
The image filter fuzzer sample was also modified to enable fuzzing
of basic picture image filters (the code had rotted a bit, being behind
an #ifdef that no one sets).
BUG=375162
R=sugoi@google.com
Review URL: https://codereview.chromium.org/311443003
git-svn-id: http://skia.googlecode.com/svn/trunk@15008 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r-- | src/effects/SkPictureImageFilter.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/effects/SkPictureImageFilter.cpp b/src/effects/SkPictureImageFilter.cpp index a2f558f202..af9466f977 100644 --- a/src/effects/SkPictureImageFilter.cpp +++ b/src/effects/SkPictureImageFilter.cpp @@ -34,27 +34,27 @@ SkPictureImageFilter::~SkPictureImageFilter() { SkPictureImageFilter::SkPictureImageFilter(SkReadBuffer& buffer) : INHERITED(0, buffer), fPicture(NULL) { -#ifdef SK_ALLOW_PICTUREIMAGEFILTER_SERIALIZATION - if (buffer.readBool()) { - fPicture = SkPicture::CreateFromBuffer(buffer); + if (!buffer.isCrossProcess()) { + if (buffer.readBool()) { + fPicture = SkPicture::CreateFromBuffer(buffer); + } + } else { + buffer.validate(!buffer.readBool()); } -#else - buffer.readBool(); -#endif buffer.readRect(&fCropRect); } void SkPictureImageFilter::flatten(SkWriteBuffer& buffer) const { this->INHERITED::flatten(buffer); -#ifdef SK_ALLOW_PICTUREIMAGEFILTER_SERIALIZATION - bool hasPicture = (fPicture != NULL); - buffer.writeBool(hasPicture); - if (hasPicture) { - fPicture->flatten(buffer); + if (!buffer.isCrossProcess()) { + bool hasPicture = (fPicture != NULL); + buffer.writeBool(hasPicture); + if (hasPicture) { + fPicture->flatten(buffer); + } + } else { + buffer.writeBool(false); } -#else - buffer.writeBool(false); -#endif buffer.writeRect(fCropRect); } |