Chromium Code Reviews| Index: src/core/SkPictureData.cpp |
| diff --git a/src/core/SkPictureData.cpp b/src/core/SkPictureData.cpp |
| index 556e2a5d906306094a1751b8370b15f39b65ef04..ea32304c696133160facabb6c5879da6e08a02bb 100644 |
| --- a/src/core/SkPictureData.cpp |
| +++ b/src/core/SkPictureData.cpp |
| @@ -30,10 +30,8 @@ SkPictureData::SkPictureData(const SkPictInfo& info) |
| void SkPictureData::initForPlayback() const { |
| // ensure that the paths bounds are pre-computed |
| - if (fPathHeap.get()) { |
| - for (int i = 0; i < fPathHeap->count(); i++) { |
| - (*fPathHeap.get())[i].updateBoundsCache(); |
| - } |
| + for (int i = 0; i < fPaths->count(); i++) { |
| + (*fPaths)[i].updateBoundsCache(); |
| } |
| } |
| @@ -48,11 +46,9 @@ SkPictureData::SkPictureData(const SkPictureRecord& record, |
| fContentInfo.set(record.fContentInfo); |
| - fBitmaps = record.fBitmapHeap->extractBitmaps(); |
| - fPaints = SkTRefArray<SkPaint>::Create(record.fPaints.begin(), record.fPaints.count()); |
| - |
| - fBitmapHeap.reset(SkSafeRef(record.fBitmapHeap)); |
| - fPathHeap.reset(SkSafeRef(record.pathHeap())); |
| + fBitmaps = SkTRefArray<SkBitmap>::Create(record.fBitmaps.begin(), record.fBitmaps.count()); |
| + fPaints = SkTRefArray<SkPaint> ::Create(record.fPaints .begin(), record.fPaints .count()); |
| + fPaths = SkTRefArray<SkPath> ::Create(record.fPaths .begin(), record.fPaths .count()); |
| this->initForPlayback(); |
| @@ -210,9 +206,12 @@ void SkPictureData::flattenToBuffer(SkWriteBuffer& buffer) const { |
| } |
| } |
| - if ((n = SafeCount(fPathHeap.get())) > 0) { |
| + if ((n = SafeCount(fPaths)) > 0) { |
| write_tag_size(buffer, SK_PICT_PATH_BUFFER_TAG, n); |
| - fPathHeap->flatten(buffer); |
| + buffer.writeInt(n); |
| + for (int i = 0; i < n; i++) { |
| + buffer.writePath((*fPaths)[i]); |
| + } |
| } |
| if (fTextBlobCount > 0) { |
| @@ -439,11 +438,13 @@ bool SkPictureData::parseBufferTag(SkReadBuffer& buffer, |
| buffer.readPaint(&fPaints->writableAt(i)); |
| } |
| } break; |
|
robertphillips
2014/11/12 18:12:55
newline before the if here ?
mtklein
2014/11/12 18:15:18
Done.
|
| - case SK_PICT_PATH_BUFFER_TAG: |
| - if (size > 0) { |
| - fPathHeap.reset(SkNEW_ARGS(SkPathHeap, (buffer))); |
| + case SK_PICT_PATH_BUFFER_TAG: if (size > 0) { |
| + const int count = buffer.readInt(); |
| + fPaths = SkTRefArray<SkPath>::Create(count); |
| + for (int i = 0; i < count; i++) { |
| + buffer.readPath(&fPaths->writableAt(i)); |
| } |
| - break; |
| + } break; |
| case SK_PICT_TEXTBLOB_BUFFER_TAG: { |
| if (!buffer.validate((0 == fTextBlobCount) && (NULL == fTextBlobRefs))) { |
| return false; |