diff options
author | 2016-08-11 03:55:15 -0700 | |
---|---|---|
committer | 2016-08-11 03:55:15 -0700 | |
commit | a9ca05ca5e604b9ee18e9cce19b059085ca0e22c (patch) | |
tree | b8b28257068935dc55c956c41ff2e3d899e031c7 /include/core/SkPicture.h | |
parent | 286a8657da0364006e95cb0988477cc3a5f0e112 (diff) |
Deserialize pictures with custom image-deserializer
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2187613002
Review-Url: https://codereview.chromium.org/2187613002
Diffstat (limited to 'include/core/SkPicture.h')
-rw-r--r-- | include/core/SkPicture.h | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h index 885eb59c9b..7cfa6679f3 100644 --- a/include/core/SkPicture.h +++ b/include/core/SkPicture.h @@ -16,6 +16,9 @@ class GrContext; class SkBigPicture; class SkBitmap; class SkCanvas; +class SkData; +class SkImage; +class SkImageDeserializer; class SkPath; class SkPictureData; class SkPixelSerializer; @@ -49,6 +52,7 @@ public: */ typedef bool (*InstallPixelRefProc)(const void* src, size_t length, SkBitmap* dst); +#ifdef SK_SUPPORT_LEGACY_PICTUREINSTALLPIXELREF /** * Recreate a picture that was serialized into a stream. * @param SkStream Serialized picture data. Ownership is unchanged by this call. @@ -58,17 +62,18 @@ public: * invalid. */ static sk_sp<SkPicture> MakeFromStream(SkStream*, InstallPixelRefProc proc); + static sk_sp<SkPicture> MakeFromStream(SkStream* stream, std::nullptr_t) { + return MakeFromStream(stream); + } +#endif /** * Recreate a picture that was serialized into a stream. * - * Any serialized images in the stream will be passed to - * SkImageGenerator::NewFromEncoded. - * - * @param SkStream Serialized picture data. Ownership is unchanged by this call. - * @return A new SkPicture representing the serialized data, or NULL if the stream is - * invalid. + * Any serialized images in the stream will be passed the image-deserializer, or if that is + * null, to the default deserializer that will call SkImage::MakeFromEncoded(). */ + static sk_sp<SkPicture> MakeFromStream(SkStream*, SkImageDeserializer*); static sk_sp<SkPicture> MakeFromStream(SkStream*); /** @@ -188,7 +193,7 @@ private: template <typename> friend class SkMiniPicture; void serialize(SkWStream*, SkPixelSerializer*, SkRefCntSet* typefaces) const; - static sk_sp<SkPicture> MakeFromStream(SkStream*, InstallPixelRefProc, SkTypefacePlayback*); + static sk_sp<SkPicture> MakeFromStream(SkStream*, SkImageDeserializer*, SkTypefacePlayback*); friend class SkPictureData; virtual int numSlowPaths() const = 0; |