Index: src/core/SkPicture.cpp |
diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp |
index 5d6986631b5ae894542fad6afd3b7aff0d492b82..5409eb34651947441c7353c82e3bfab26b4047b4 100644 |
--- a/src/core/SkPicture.cpp |
+++ b/src/core/SkPicture.cpp |
@@ -176,6 +176,20 @@ sk_sp<SkPicture> SkPicture::MakeFromStream(SkStream* stream) { |
return MakeFromStream(stream, &factory); |
} |
+sk_sp<SkPicture> SkPicture::MakeFromData(const void* data, size_t size, |
+ SkImageDeserializer* factory) { |
+ SkMemoryStream stream(data, size); |
+ return MakeFromStream(&stream, factory, nullptr); |
+} |
+ |
+sk_sp<SkPicture> SkPicture::MakeFromData(const SkData* data, SkImageDeserializer* factory) { |
+ if (!data) { |
+ return nullptr; |
+ } |
+ SkMemoryStream stream(data->data(), data->size()); |
+ return MakeFromStream(&stream, factory, nullptr); |
+} |
+ |
sk_sp<SkPicture> SkPicture::MakeFromStream(SkStream* stream, SkImageDeserializer* factory, |
SkTypefacePlayback* typefaces) { |
SkPictInfo info; |
@@ -209,6 +223,12 @@ void SkPicture::serialize(SkWStream* stream, SkPixelSerializer* pixelSerializer) |
this->serialize(stream, pixelSerializer, nullptr); |
} |
+sk_sp<SkData> SkPicture::serialize(SkPixelSerializer* pixelSerializer) const { |
+ SkDynamicMemoryWStream stream; |
+ this->serialize(&stream, pixelSerializer, nullptr); |
+ return stream.detachAsData(); |
+} |
+ |
void SkPicture::serialize(SkWStream* stream, |
SkPixelSerializer* pixelSerializer, |
SkRefCntSet* typefaceSet) const { |