Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Unified Diff: src/core/SkPicturePlayback.cpp

Issue 155863005: Adding release method to SkWriter32 and using it to not copy the ops data from SkPictureRecord to S… (Closed) Base URL: https://skia.googlesource.com/skia.git@array_growth
Patch Set: Rebase patch Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkPicturePlayback.h ('k') | src/core/SkPictureRecord.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « src/core/SkPicturePlayback.h ('k') | src/core/SkPictureRecord.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698