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/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp
index 00c51ac..af1b8ff 100644
--- a/src/core/SkPictureRecord.cpp
+++ b/src/core/SkPictureRecord.cpp
@@ -31,16 +31,12 @@
SkPictureRecord::SkPictureRecord(const SkISize& dimensions, uint32_t flags)
: INHERITED(dimensions.width(), dimensions.height())
- , fRecordFlags(flags) {
-
- fBitmapHeap = SkNEW(SkBitmapHeap);
-
- fFirstSavedLayerIndex = kNoSavedLayerIndex;
- fInitialSaveCount = kNoInitialSave;
+ , fFirstSavedLayerIndex(kNoSavedLayerIndex)
+ , fRecordFlags(flags)
+ , fInitialSaveCount(kNoInitialSave) {
}
SkPictureRecord::~SkPictureRecord() {
- SkSafeUnref(fBitmapHeap);
fPictureRefs.unrefAll();
fTextBlobRefs.unrefAll();
}
@@ -905,13 +901,16 @@
}
int SkPictureRecord::addBitmap(const SkBitmap& bitmap) {
- const int index = fBitmapHeap->insert(bitmap);
- // In debug builds, a bad return value from insert() will crash, allowing for debugging. In
- // release builds, the invalid value will be recorded so that the reader will know that there
- // was a problem.
- SkASSERT(index != SkBitmapHeap::INVALID_SLOT);
- this->addInt(index);
- return index;
+ if (bitmap.isImmutable()) {
+ fBitmaps.push_back(bitmap);
+ } else {
+ SkBitmap copy;
+ bitmap.copyTo(©);
+ copy.setImmutable();
+ fBitmaps.push_back(copy);
+ }
+ this->addInt(fBitmaps.count()-1); // Unlike the rest, bitmap indicies are 0-based.
+ return fBitmaps.count();
}
void SkPictureRecord::addMatrix(const SkMatrix& matrix) {
@@ -930,14 +929,8 @@
}
int SkPictureRecord::addPathToHeap(const SkPath& path) {
- if (NULL == fPathHeap) {
- fPathHeap.reset(SkNEW(SkPathHeap));
- }
-#ifdef SK_DEDUP_PICTURE_PATHS
- return fPathHeap->insert(path);
-#else
- return fPathHeap->append(path);
-#endif
+ fPaths.push_back(path);
+ return fPaths.count();
}
void SkPictureRecord::addPath(const SkPath& path) {