add helpers for using SkData with picture serialization
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2341693004
TBR=
Review-Url: https://codereview.chromium.org/2341693004
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 0cdb70e..26d90f2 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -1428,10 +1428,7 @@
sk_sp<SkPicture> pic(recorder.finishRecordingAsPicture());
// Serialize it and then deserialize it.
- SkDynamicMemoryWStream wStream;
- pic->serialize(&wStream);
- SkAutoTDelete<SkStream> rStream(wStream.detachAsStream());
- sk_sp<SkPicture> deserialized(SkPicture::MakeFromStream(rStream));
+ sk_sp<SkPicture> deserialized(SkPicture::MakeFromData(pic->serialize().get()));
return draw_to_canvas(fSink, bitmap, stream, log, size, [&](SkCanvas* canvas) {
canvas->drawPicture(deserialized);