check (runtime) for null-pixels even when lock succeeds

BUG=492818
TBR=

Review URL: https://codereview.chromium.org/1159953006
This commit is contained in:
reed 2015-06-02 10:47:42 -07:00 committed by Commit bot
parent 1fa4572d1a
commit 91284caa23
2 changed files with 7 additions and 3 deletions

View File

@ -239,6 +239,10 @@ SkMipMap* SkMipMap::Build(const SkBitmap& src, SkDiscardableFactoryProc fact) {
return NULL;
}
const SkPixmap& srcPixmap = srcUnlocker.pixmap();
// Try to catch where we might have returned NULL for src crbug.com/492818
if (NULL == srcPixmap.addr()) {
sk_throw();
}
SkMipMap* mipmap;
if (fact) {

View File

@ -199,7 +199,7 @@ bool SkPixelRef::lockPixelsInsideMutex() {
}
}
validate_pixels_ctable(fInfo, fRec.fPixels, fRec.fColorTable);
return true;
return fRec.fPixels != NULL;
}
// For historical reasons, we always inc fLockCount, even if we return false.
@ -224,7 +224,7 @@ bool SkPixelRef::lockPixels() {
}
}
validate_pixels_ctable(fInfo, fRec.fPixels, fRec.fColorTable);
return true;
return fRec.fPixels != NULL;
}
bool SkPixelRef::lockPixels(LockRec* rec) {
@ -274,7 +274,7 @@ bool SkPixelRef::requestLock(const LockRequest& request, LockResult* result) {
}
}
validate_pixels_ctable(fInfo, result->fPixels, result->fCTable);
return true;
return result->fPixels != NULL;
}
bool SkPixelRef::lockPixelsAreWritable() const {