Index: dm/DMSrcSink.cpp |
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp |
index f4c4b10c3e7f4b4ef06b6b28319bffde4b77c908..dd994b609015e31d951df3eab3bc29cee631cafa 100644 |
--- a/dm/DMSrcSink.cpp |
+++ b/dm/DMSrcSink.cpp |
@@ -39,6 +39,11 @@ |
DEFINE_bool(multiPage, false, "For document-type backends, render the source" |
" into multiple pages"); |
DEFINE_bool(RAW_threading, true, "Allow RAW decodes to run on multiple threads?"); |
+ |
+static bool lazy_decode_bitmap(const void* src, size_t size, SkBitmap* dst) { |
+ SkAutoTUnref<SkData> encoded(SkData::NewWithCopy(src, size)); |
+ return encoded && SkDEPRECATED_InstallDiscardablePixelRef(encoded, dst); |
+} |
namespace DM { |
@@ -797,7 +802,7 @@ |
if (!stream) { |
return SkStringPrintf("Couldn't read %s.", fPath.c_str()); |
} |
- SkAutoTUnref<SkPicture> pic(SkPicture::CreateFromStream(stream)); |
+ SkAutoTUnref<SkPicture> pic(SkPicture::CreateFromStream(stream, &lazy_decode_bitmap)); |
if (!pic) { |
return SkStringPrintf("Couldn't decode %s as a picture.", fPath.c_str()); |
} |
@@ -1170,7 +1175,7 @@ |
SkDynamicMemoryWStream wStream; |
pic->serialize(&wStream); |
SkAutoTDelete<SkStream> rStream(wStream.detachAsStream()); |
- SkAutoTUnref<SkPicture> deserialized(SkPicture::CreateFromStream(rStream)); |
+ SkAutoTUnref<SkPicture> deserialized(SkPicture::CreateFromStream(rStream, &lazy_decode_bitmap)); |
return draw_to_canvas(fSink, bitmap, stream, log, size, [&](SkCanvas* canvas) { |
canvas->drawPicture(deserialized); |