diff options
author | 2014-02-06 18:06:14 +0000 | |
---|---|---|
committer | 2014-02-06 18:06:14 +0000 | |
commit | 670b98ea5df48daef5d23e2bb7570d408207c333 (patch) | |
tree | e16a6dd93f7d6cc6eb429d8f1cd70af01641b320 /include/core | |
parent | d5808bd35a08475c3f866418e9b548571a795a15 (diff) |
Serialization of SkPictureImageFilter
BUG=skia:
R=senorblanco@google.com, reed@google.com, mtklein@google.com, sugoi@google.com, senorblanco@chromium.org, robertphillips@google.com, scroggo@google.com
Author: sugoi@chromium.org
Review URL: https://codereview.chromium.org/138063005
git-svn-id: http://skia.googlecode.com/svn/trunk@13347 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkPicture.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h index 82d6835dbd..a717153dbe 100644 --- a/include/core/SkPicture.h +++ b/include/core/SkPicture.h @@ -68,6 +68,16 @@ public: static SkPicture* CreateFromStream(SkStream*, InstallPixelRefProc proc = &SkImageDecoder::DecodeMemory); + /** + * Recreate a picture that was serialized into a buffer. If the creation requires bitmap + * decoding, the decoder must be set on the SkReadBuffer parameter by calling + * SkReadBuffer::setBitmapDecoder() before calling SkPicture::CreateFromBuffer(). + * @param SkReadBuffer Serialized picture data. + * @return A new SkPicture representing the serialized data, or NULL if the buffer is + * invalid. + */ + static SkPicture* CreateFromBuffer(SkReadBuffer&); + virtual ~SkPicture(); /** @@ -187,6 +197,11 @@ public: void serialize(SkWStream*, EncodeBitmap encoder = NULL) const; /** + * Serialize to a buffer. + */ + void flatten(SkWriteBuffer&) const; + + /** * Returns true if any bitmaps may be produced when this SkPicture * is replayed. * Returns false if called while still recording. @@ -223,7 +238,8 @@ protected: // V17: SkPixelRef now writes SkImageInfo // V18: SkBitmap now records x,y for its pixelref origin, instead of offset. // V19: encode matrices and regions into the ops stream - static const uint32_t PICTURE_VERSION = 19; + // V20: added bool to SkPictureImageFilter's serialization (to allow SkPicture serialization) + static const uint32_t PICTURE_VERSION = 20; // fPlayback, fRecord, fWidth & fHeight are protected to allow derived classes to // install their own SkPicturePlayback-derived players,SkPictureRecord-derived @@ -245,7 +261,10 @@ protected: // will be ready to be parsed to create an SkPicturePlayback. // If false is returned, SkPictInfo is unmodified. static bool StreamIsSKP(SkStream*, SkPictInfo*); + static bool BufferIsSKP(SkReadBuffer&, SkPictInfo*); private: + void createHeader(void* header) const; + friend class SkFlatPicture; friend class SkPicturePlayback; |