Index: src/core/SkBitmapProcState.cpp |
diff --git a/src/core/SkBitmapProcState.cpp b/src/core/SkBitmapProcState.cpp |
index 3a059d3876da56f2baba557192074c95920e2006..6e52546938066ee1aa920179a7418c0dfa6d1f5b 100644 |
--- a/src/core/SkBitmapProcState.cpp |
+++ b/src/core/SkBitmapProcState.cpp |
@@ -157,11 +157,17 @@ void SkBitmapProcState::possiblyScaleImage() { |
// All the criteria are met; let's make a new bitmap. |
- fScaledBitmap = SkBitmapScaler::Resize(fOrigBitmap, |
- SkBitmapScaler::RESIZE_BEST, |
- dest_width, |
- dest_height, |
- fConvolutionProcs); |
+ if (!SkBitmapScaler::Resize(&fScaledBitmap, |
+ fOrigBitmap, |
+ SkBitmapScaler::RESIZE_BEST, |
+ dest_width, |
+ dest_height, |
+ fConvolutionProcs)) { |
+ // we failed to create fScaledBitmap, so just return and let |
+ // the scanline proc handle it. |
+ return; |
+ |
+ } |
fScaledCacheID = SkScaledImageCache::AddAndLock(fOrigBitmap, |
invScaleX, |
invScaleY, |
@@ -277,6 +283,13 @@ void SkBitmapProcState::endContext() { |
} |
} |
+SkBitmapProcState::~SkBitmapProcState() { |
+ if (fScaledCacheID) { |
+ SkScaledImageCache::Unlock(fScaledCacheID); |
+ } |
+ SkDELETE(fBitmapFilter); |
+} |
+ |
bool SkBitmapProcState::chooseProcs(const SkMatrix& inv, const SkPaint& paint) { |
if (fOrigBitmap.width() == 0 || fOrigBitmap.height() == 0) { |
return false; |