more checks for null shapes in pictures

git-svn-id: http://skia.googlecode.com/svn/trunk@249 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@android.com 2009-07-03 02:52:27 +00:00
Родитель 1c12abe350
Коммит 8433b5db1a
4 изменённых файлов: 21 добавлений и 9 удалений

Просмотреть файл

@ -251,7 +251,17 @@ public:
}
this->reset();
}
void safeUnrefAll() {
T* iter = fArray;
T* stop = fArray + fCount;
while (iter < stop) {
SkSafeUnref(*iter);
iter += 1;
}
this->reset();
}
#ifdef SK_DEBUG
void validate() const {
SkASSERT((fReserve == 0 && fArray == NULL) ||

Просмотреть файл

@ -90,9 +90,9 @@ protected:
pict.serialize(&ostream);
SkMemoryStream istream(ostream.getStream(), ostream.getOffset());
SkPicture newPict(&istream);
canvas->drawPicture(newPict);
SkPicture* newPict = new SkPicture(&istream);
canvas->drawPicture(*newPict);
newPict->unref();
#else
canvas->drawPicture(pict);
#endif

Просмотреть файл

@ -125,8 +125,9 @@ SkPicturePlayback::SkPicturePlayback(const SkPictureRecord& record) {
if (fShapeCount > 0) {
fShapes = SkNEW_ARRAY(SkShape*, fShapeCount);
for (int i = 0; i < fShapeCount; i++) {
fShapes[i] = shapes[i];
fShapes[i]->ref();
SkShape* s = shapes[i];
SkSafeRef(s);
fShapes[i] = s;
}
}
@ -205,8 +206,9 @@ SkPicturePlayback::SkPicturePlayback(const SkPicturePlayback& src) {
fShapeCount = src.fShapeCount;
fShapes = SkNEW_ARRAY(SkShape*, fShapeCount);
for (int i = 0; i < fShapeCount; i++) {
fShapes[i] = src.fShapes[i];
fShapes[i]->ref();
SkShape* s = src.fShapes[i];
SkSafeRef(s);
fShapes[i] = s;
}
fRegionCount = src.fRegionCount;

Просмотреть файл

@ -413,7 +413,7 @@ void SkPictureRecord::reset() {
fPaints.reset();
fPictureRefs.unrefAll();
fRegions.reset();
fShapes.unrefAll();
fShapes.safeUnrefAll();
fWriter.reset();
fHeap.reset();