More cleanup: streamline paths and bitmaps.
SkBitmapHeap is still used---now exclusively---by pipe.
BUG=skia:
Review URL: https://codereview.chromium.org/715413002
diff --git a/src/core/SkPictureData.cpp b/src/core/SkPictureData.cpp
index 556e2a5..29e4415 100644
--- a/src/core/SkPictureData.cpp
+++ b/src/core/SkPictureData.cpp
@@ -30,10 +30,8 @@
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 @@
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();
@@ -80,6 +76,7 @@
void SkPictureData::init() {
fBitmaps = NULL;
fPaints = NULL;
+ fPaths = NULL;
fPictureRefs = NULL;
fPictureCount = 0;
fTextBlobRefs = NULL;
@@ -93,6 +90,7 @@
SkSafeUnref(fBitmaps);
SkSafeUnref(fPaints);
+ SkSafeUnref(fPaths);
for (int i = 0; i < fPictureCount; i++) {
fPictureRefs[i]->unref();
@@ -210,9 +208,12 @@
}
}
- 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) {
@@ -441,9 +442,12 @@
} break;
case SK_PICT_PATH_BUFFER_TAG:
if (size > 0) {
- fPathHeap.reset(SkNEW_ARGS(SkPathHeap, (buffer)));
- }
- break;
+ const int count = buffer.readInt();
+ fPaths = SkTRefArray<SkPath>::Create(count);
+ for (int i = 0; i < count; i++) {
+ buffer.readPath(&fPaths->writableAt(i));
+ }
+ } break;
case SK_PICT_TEXTBLOB_BUFFER_TAG: {
if (!buffer.validate((0 == fTextBlobCount) && (NULL == fTextBlobRefs))) {
return false;