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

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: Add reset and comment 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 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();
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 1526 matching lines...) Expand 10 before | Expand all | Expand 10 after
1630 for (index = 0; index < fPictureCount; index++) 1625 for (index = 0; index < fPictureCount; index++)
1631 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer ), 1626 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer ),
1632 "picture%p, ", fPictureRefs[index]); 1627 "picture%p, ", fPictureRefs[index]);
1633 if (fPictureCount > 0) 1628 if (fPictureCount > 0)
1634 SkDebugf("%s0};\n", pBuffer); 1629 SkDebugf("%s0};\n", pBuffer);
1635 1630
1636 const_cast<SkPicturePlayback*>(this)->dumpStream(); 1631 const_cast<SkPicturePlayback*>(this)->dumpStream();
1637 } 1632 }
1638 1633
1639 #endif 1634 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698