| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 if (record.fTextWrites != 0) | 59 if (record.fTextWrites != 0) |
| 60 SkDebugf("text size %zd (text strings:%d) ", record.fTextBytes, record.f
TextWrites); | 60 SkDebugf("text size %zd (text strings:%d) ", record.fTextBytes, record.f
TextWrites); |
| 61 | 61 |
| 62 SkDebugf("\n"); | 62 SkDebugf("\n"); |
| 63 #endif | 63 #endif |
| 64 #ifdef SK_DEBUG_DUMP | 64 #ifdef SK_DEBUG_DUMP |
| 65 record.dumpMatrices(); | 65 record.dumpMatrices(); |
| 66 record.dumpPaints(); | 66 record.dumpPaints(); |
| 67 #endif | 67 #endif |
| 68 | 68 |
| 69 record.validate(record.writeStream().size(), 0); | 69 record.validate(record.writeStream().bytesWritten(), 0); |
| 70 const SkWriter32& writer = record.writeStream(); | 70 const SkWriter32& writer = record.writeStream(); |
| 71 init(); | 71 init(); |
| 72 if (writer.size() == 0) { | 72 if (writer.bytesWritten() == 0) { |
| 73 fOpData = SkData::NewEmpty(); | 73 fOpData = SkData::NewEmpty(); |
| 74 return; | 74 return; |
| 75 } | 75 } |
| 76 | 76 |
| 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 { |
| 88 size_t size = writer.size(); | 88 size_t size = writer.bytesWritten(); |
| 89 void* buffer = sk_malloc_throw(size); | 89 void* buffer = sk_malloc_throw(size); |
| 90 writer.flatten(buffer); | 90 writer.flatten(buffer); |
| 91 SkASSERT(!fOpData); | 91 SkASSERT(!fOpData); |
| 92 fOpData = SkData::NewFromMalloc(buffer, size); | 92 fOpData = SkData::NewFromMalloc(buffer, size); |
| 93 } | 93 } |
| 94 | 94 |
| 95 // copy over the refcnt dictionary to our reader | 95 // copy over the refcnt dictionary to our reader |
| 96 record.fFlattenableHeap.setupPlaybacks(); | 96 record.fFlattenableHeap.setupPlaybacks(); |
| 97 | 97 |
| 98 fBitmaps = record.fBitmapHeap->extractBitmaps(); | 98 fBitmaps = record.fBitmapHeap->extractBitmaps(); |
| (...skipping 1570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1669 for (index = 0; index < fRegionCount; index++) | 1669 for (index = 0; index < fRegionCount; index++) |
| 1670 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer
), | 1670 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer
), |
| 1671 "region%p, ", &fRegions[index]); | 1671 "region%p, ", &fRegions[index]); |
| 1672 if (fRegionCount > 0) | 1672 if (fRegionCount > 0) |
| 1673 SkDebugf("%s0};\n", pBuffer); | 1673 SkDebugf("%s0};\n", pBuffer); |
| 1674 | 1674 |
| 1675 const_cast<SkPicturePlayback*>(this)->dumpStream(); | 1675 const_cast<SkPicturePlayback*>(this)->dumpStream(); |
| 1676 } | 1676 } |
| 1677 | 1677 |
| 1678 #endif | 1678 #endif |
| OLD | NEW |