Index: src/core/SkPicturePlayback.cpp |
diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp |
index 8b8c6b0862dad7bb6d0bc643de3b09b0abca4fd7..6a615a19bbac5840bfde8dd7859aff087df1f231 100644 |
--- a/src/core/SkPicturePlayback.cpp |
+++ b/src/core/SkPicturePlayback.cpp |
@@ -28,7 +28,7 @@ SkPicturePlayback::SkPicturePlayback() { |
this->init(); |
} |
-SkPicturePlayback::SkPicturePlayback(const SkPictureRecord& record, bool deepCopy) { |
+SkPicturePlayback::SkPicturePlayback(SkPictureRecord& record, bool deepCopy) { |
#ifdef SK_DEBUG_SIZE |
size_t overallBytes, bitmapBytes, matricesBytes, |
paintBytes, pathBytes, pictureBytes, regionBytes; |
@@ -67,7 +67,7 @@ SkPicturePlayback::SkPicturePlayback(const SkPictureRecord& record, bool deepCop |
#endif |
record.validate(record.writeStream().bytesWritten(), 0); |
- const SkWriter32& writer = record.writeStream(); |
+ SkWriter32& writer = record.writeStream(); |
init(); |
if (writer.bytesWritten() == 0) { |
fOpData = SkData::NewEmpty(); |
@@ -84,13 +84,8 @@ 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); |
- } |
+ SkASSERT(!fOpData); |
+ fOpData = writer.detatchAsData(); |
// copy over the refcnt dictionary to our reader |
record.fFlattenableHeap.setupPlaybacks(); |