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

Side by Side Diff: src/core/SkPicturePlayback.cpp

Issue 167113003: Add capture snapshot as data to SkWriter32, use it to optimise record->playback. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Mutex protect snapshot creation Created 6 years, 9 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 unified diff | Download patch
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "SkPicturePlayback.h" 8 #include "SkPicturePlayback.h"
9 #include "SkPictureRecord.h" 9 #include "SkPictureRecord.h"
10 #include "SkTypeface.h" 10 #include "SkTypeface.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 fBoundingHierarchy = record.fBoundingHierarchy; 77 fBoundingHierarchy = record.fBoundingHierarchy;
78 fStateTree = record.fStateTree; 78 fStateTree = record.fStateTree;
79 79
80 SkSafeRef(fBoundingHierarchy); 80 SkSafeRef(fBoundingHierarchy);
81 SkSafeRef(fStateTree); 81 SkSafeRef(fStateTree);
82 82
83 if (NULL != fBoundingHierarchy) { 83 if (NULL != fBoundingHierarchy) {
84 fBoundingHierarchy->flushDeferredInserts(); 84 fBoundingHierarchy->flushDeferredInserts();
85 } 85 }
86 86
87 { 87 SkASSERT(!fOpData);
88 size_t size = writer.bytesWritten(); 88 fOpData = writer.snapshotAsData();
mtklein 2014/03/06 18:58:08 Moving this up to / merge this with the other part
iancottrell 2014/03/06 21:31:52 Done.
89 void* buffer = sk_malloc_throw(size);
90 writer.flatten(buffer);
91 SkASSERT(!fOpData);
92 fOpData = SkData::NewFromMalloc(buffer, size);
93 }
94 89
95 // copy over the refcnt dictionary to our reader 90 // copy over the refcnt dictionary to our reader
96 record.fFlattenableHeap.setupPlaybacks(); 91 record.fFlattenableHeap.setupPlaybacks();
97 92
98 fBitmaps = record.fBitmapHeap->extractBitmaps(); 93 fBitmaps = record.fBitmapHeap->extractBitmaps();
99 fPaints = record.fPaints.unflattenToArray(); 94 fPaints = record.fPaints.unflattenToArray();
100 95
101 fBitmapHeap.reset(SkSafeRef(record.fBitmapHeap)); 96 fBitmapHeap.reset(SkSafeRef(record.fBitmapHeap));
102 fPathHeap.reset(SkSafeRef(record.fPathHeap)); 97 fPathHeap.reset(SkSafeRef(record.fPathHeap));
103 98
(...skipping 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after
1637 for (index = 0; index < fPictureCount; index++) 1632 for (index = 0; index < fPictureCount; index++)
1638 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer ), 1633 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer ),
1639 "picture%p, ", fPictureRefs[index]); 1634 "picture%p, ", fPictureRefs[index]);
1640 if (fPictureCount > 0) 1635 if (fPictureCount > 0)
1641 SkDebugf("%s0};\n", pBuffer); 1636 SkDebugf("%s0};\n", pBuffer);
1642 1637
1643 const_cast<SkPicturePlayback*>(this)->dumpStream(); 1638 const_cast<SkPicturePlayback*>(this)->dumpStream();
1644 } 1639 }
1645 1640
1646 #endif 1641 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698