Index: src/core/SkBitmapProcState.cpp |
diff --git a/src/core/SkBitmapProcState.cpp b/src/core/SkBitmapProcState.cpp |
index 6c1dc30449a81ed0a1ddd7686a2cd5eaab5b1a31..2a449d6d8fa8e7732732bd9046517eb2a2ddb57d 100644 |
--- a/src/core/SkBitmapProcState.cpp |
+++ b/src/core/SkBitmapProcState.cpp |
@@ -260,11 +260,14 @@ bool SkBitmapProcState::possiblyScaleImage() { |
if (scaleSqd > SK_Scalar1) { |
fCurrMip.reset(SkMipMapCache::FindAndRef(fOrigBitmap)); |
if (NULL == fCurrMip.get()) { |
- fCurrMip.reset(SkMipMap::Build(fOrigBitmap)); |
+ fCurrMip.reset(SkMipMapCache::AddAndRef(fOrigBitmap)); |
if (NULL == fCurrMip.get()) { |
return false; |
} |
- SkMipMapCache::Add(fOrigBitmap, fCurrMip); |
+ } |
+ // diagnostic for a crasher... |
+ if (NULL == fCurrMip->data()) { |
+ sk_throw(); |
} |
SkScalar levelScale = SkScalarInvert(SkScalarSqrt(scaleSqd)); |
@@ -280,6 +283,9 @@ bool SkBitmapProcState::possiblyScaleImage() { |
fBitmap = &fScaledBitmap; |
fFilterLevel = SkPaint::kLow_FilterLevel; |
return true; |
+ } else { |
+ // failed to extract, so release the mipmap |
+ fCurrMip.reset(NULL); |
} |
} |