Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Unified Diff: src/core/SkBitmapProcState.cpp

Issue 635333002: Add SkCachedData and use it for SkMipMap (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkBitmapCache.cpp ('k') | src/core/SkCachedData.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
}
« no previous file with comments | « src/core/SkBitmapCache.cpp ('k') | src/core/SkCachedData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698