add some asserts for mipmaps, and cleanup fFilterLevel if mipping failed

BUG=skia:
R=scroggo@google.com, humper@google.com

Author: reed@google.com

Review URL: https://codereview.chromium.org/240633003

git-svn-id: http://skia.googlecode.com/svn/trunk@14241 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
commit-bot@chromium.org 2014-04-17 16:46:07 +00:00
parent 273a00d14f
commit 84f7a06ff9

View File

@ -263,6 +263,7 @@ bool SkBitmapProcState::possiblyScaleImage() {
if (mip) {
fScaledCacheID = SkScaledImageCache::AddAndLockMip(fOrigBitmap,
mip);
SkASSERT(mip->getRefCnt() > 1);
mip->unref(); // the cache took a ref
SkASSERT(fScaledCacheID);
}
@ -403,6 +404,12 @@ bool SkBitmapProcState::chooseProcs(const SkMatrix& inv, const SkPaint& paint) {
return false;
}
// If we are "still" kMedium_FilterLevel, then the request was not fulfilled by possiblyScale,
// so we downgrade to kLow (so the rest of the sniffing code can assume that)
if (SkPaint::kMedium_FilterLevel == fFilterLevel) {
fFilterLevel = SkPaint::kLow_FilterLevel;
}
bool trivialMatrix = (fInvMatrix.getType() & ~SkMatrix::kTranslate_Mask) == 0;
bool clampClamp = SkShader::kClamp_TileMode == fTileModeX &&
SkShader::kClamp_TileMode == fTileModeY;