| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 #include <new> | 7 #include <new> |
| 8 #include "SkBBoxHierarchy.h" | 8 #include "SkBBoxHierarchy.h" |
| 9 #include "SkPicturePlayback.h" | 9 #include "SkPicturePlayback.h" |
| 10 #include "SkPictureRecord.h" | 10 #include "SkPictureRecord.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 #endif | 51 #endif |
| 52 | 52 |
| 53 SkPicturePlayback::SkPicturePlayback(const SkPicture* picture, const SkPictInfo&
info) | 53 SkPicturePlayback::SkPicturePlayback(const SkPicture* picture, const SkPictInfo&
info) |
| 54 : fPicture(picture) | 54 : fPicture(picture) |
| 55 , fInfo(info) { | 55 , fInfo(info) { |
| 56 this->init(); | 56 this->init(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 SkPicturePlayback::SkPicturePlayback(const SkPicture* picture, | 59 SkPicturePlayback::SkPicturePlayback(const SkPicture* picture, |
| 60 const SkPictureRecord& record, | 60 const SkPictureRecord& record, |
| 61 const SkPictInfo& info, | 61 const SkPictInfo& info) |
| 62 bool deepCopy) | |
| 63 : fPicture(picture) | 62 : fPicture(picture) |
| 64 , fInfo(info) { | 63 , fInfo(info) { |
| 65 #ifdef SK_DEBUG_SIZE | 64 #ifdef SK_DEBUG_SIZE |
| 66 size_t overallBytes, bitmapBytes, matricesBytes, | 65 size_t overallBytes, bitmapBytes, matricesBytes, |
| 67 paintBytes, pathBytes, pictureBytes, regionBytes; | 66 paintBytes, pathBytes, pictureBytes, regionBytes; |
| 68 int bitmaps = record.bitmaps(&bitmapBytes); | 67 int bitmaps = record.bitmaps(&bitmapBytes); |
| 69 int matrices = record.matrices(&matricesBytes); | 68 int matrices = record.matrices(&matricesBytes); |
| 70 int paints = record.paints(&paintBytes); | 69 int paints = record.paints(&paintBytes); |
| 71 int paths = record.paths(&pathBytes); | 70 int paths = record.paths(&pathBytes); |
| 72 int pictures = record.pictures(&pictureBytes); | 71 int pictures = record.pictures(&pictureBytes); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 126 |
| 128 fBitmapHeap.reset(SkSafeRef(record.fBitmapHeap)); | 127 fBitmapHeap.reset(SkSafeRef(record.fBitmapHeap)); |
| 129 | 128 |
| 130 picture->initForPlayback(); | 129 picture->initForPlayback(); |
| 131 | 130 |
| 132 const SkTDArray<const SkPicture* >& pictures = record.getPictureRefs(); | 131 const SkTDArray<const SkPicture* >& pictures = record.getPictureRefs(); |
| 133 fPictureCount = pictures.count(); | 132 fPictureCount = pictures.count(); |
| 134 if (fPictureCount > 0) { | 133 if (fPictureCount > 0) { |
| 135 fPictureRefs = SkNEW_ARRAY(const SkPicture*, fPictureCount); | 134 fPictureRefs = SkNEW_ARRAY(const SkPicture*, fPictureCount); |
| 136 for (int i = 0; i < fPictureCount; i++) { | 135 for (int i = 0; i < fPictureCount; i++) { |
| 137 if (deepCopy) { | 136 fPictureRefs[i] = pictures[i]; |
| 138 fPictureRefs[i] = pictures[i]->clone(); | 137 fPictureRefs[i]->ref(); |
| 139 } else { | |
| 140 fPictureRefs[i] = pictures[i]; | |
| 141 fPictureRefs[i]->ref(); | |
| 142 } | |
| 143 } | 138 } |
| 144 } | 139 } |
| 145 | 140 |
| 146 #ifdef SK_DEBUG_SIZE | 141 #ifdef SK_DEBUG_SIZE |
| 147 int overall = fPlayback->size(&overallBytes); | 142 int overall = fPlayback->size(&overallBytes); |
| 148 bitmaps = fPlayback->bitmaps(&bitmapBytes); | 143 bitmaps = fPlayback->bitmaps(&bitmapBytes); |
| 149 paints = fPlayback->paints(&paintBytes); | 144 paints = fPlayback->paints(&paintBytes); |
| 150 paths = fPlayback->paths(&pathBytes); | 145 paths = fPlayback->paths(&pathBytes); |
| 151 pictures = fPlayback->pictures(&pictureBytes); | 146 pictures = fPlayback->pictures(&pictureBytes); |
| 152 regions = fPlayback->regions(®ionBytes); | 147 regions = fPlayback->regions(®ionBytes); |
| (...skipping 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1838 for (index = 0; index < fPictureCount; index++) | 1833 for (index = 0; index < fPictureCount; index++) |
| 1839 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer
), | 1834 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer
), |
| 1840 "picture%p, ", fPictureRefs[index]); | 1835 "picture%p, ", fPictureRefs[index]); |
| 1841 if (fPictureCount > 0) | 1836 if (fPictureCount > 0) |
| 1842 SkDebugf("%s0};\n", pBuffer); | 1837 SkDebugf("%s0};\n", pBuffer); |
| 1843 | 1838 |
| 1844 const_cast<SkPicturePlayback*>(this)->dumpStream(); | 1839 const_cast<SkPicturePlayback*>(this)->dumpStream(); |
| 1845 } | 1840 } |
| 1846 | 1841 |
| 1847 #endif | 1842 #endif |
| OLD | NEW |