OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |