Index: src/core/SkPicturePlayback.cpp |
diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp |
index b546d397c04617570c7534c1ed338f451abc0af0..3b7c34bf84161a36f267b749ca17b55bb37703da 100644 |
--- a/src/core/SkPicturePlayback.cpp |
+++ b/src/core/SkPicturePlayback.cpp |
@@ -69,10 +69,12 @@ SkPicturePlayback::SkPicturePlayback(const SkPictureRecord& record, bool deepCop |
record.validate(record.writeStream().bytesWritten(), 0); |
const SkWriter32& writer = record.writeStream(); |
init(); |
+ SkASSERT(!fOpData); |
if (writer.bytesWritten() == 0) { |
fOpData = SkData::NewEmpty(); |
return; |
} |
+ fOpData = writer.snapshotAsData(); |
fBoundingHierarchy = record.fBoundingHierarchy; |
fStateTree = record.fStateTree; |
@@ -84,14 +86,6 @@ SkPicturePlayback::SkPicturePlayback(const SkPictureRecord& record, bool deepCop |
fBoundingHierarchy->flushDeferredInserts(); |
} |
- { |
- size_t size = writer.bytesWritten(); |
- void* buffer = sk_malloc_throw(size); |
- writer.flatten(buffer); |
- SkASSERT(!fOpData); |
- fOpData = SkData::NewFromMalloc(buffer, size); |
- } |
- |
// copy over the refcnt dictionary to our reader |
record.fFlattenableHeap.setupPlaybacks(); |