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

Unified Diff: src/core/SkBitmapProcState.cpp

Issue 691143008: Avoid the use of mipmaps to prevent memory leak (Closed) Base URL: https://skia.googlesource.com/skia.git@m39
Patch Set: Created 6 years, 1 month 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 | « no previous file | no next file » | 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..c3801e4404cbfae38c7b9022906c83a283ef2071 100644
--- a/src/core/SkBitmapProcState.cpp
+++ b/src/core/SkBitmapProcState.cpp
@@ -252,36 +252,9 @@ bool SkBitmapProcState::possiblyScaleImage() {
SkASSERT(SkPaint::kMedium_FilterLevel == fFilterLevel);
- /**
- * Medium quality means use a mipmap for down-scaling, and just bilper
- * for upscaling. Since we're examining the inverse matrix, we look for
- * a scale > 1 to indicate down scaling by the CTM.
- */
- if (scaleSqd > SK_Scalar1) {
- fCurrMip.reset(SkMipMapCache::FindAndRef(fOrigBitmap));
- if (NULL == fCurrMip.get()) {
- fCurrMip.reset(SkMipMap::Build(fOrigBitmap));
- if (NULL == fCurrMip.get()) {
- return false;
- }
- SkMipMapCache::Add(fOrigBitmap, fCurrMip);
- }
-
- SkScalar levelScale = SkScalarInvert(SkScalarSqrt(scaleSqd));
- SkMipMap::Level level;
- if (fCurrMip->extractLevel(levelScale, &level)) {
- SkScalar invScaleFixup = level.fScale;
- fInvMatrix.postScale(invScaleFixup, invScaleFixup);
-
- const SkImageInfo info = fOrigBitmap.info().makeWH(level.fWidth, level.fHeight);
- // todo: if we could wrap the fCurrMip in a pixelref, then we could just install
- // that here, and not need to explicitly track it ourselves.
- fScaledBitmap.installPixels(info, level.fPixels, level.fRowBytes);
- fBitmap = &fScaledBitmap;
- fFilterLevel = SkPaint::kLow_FilterLevel;
- return true;
- }
- }
+ // HACK: Disable use of mipmaps in M39 since they do not use discardable
+ // memory in the cache.
+ fFilterLevel = SkPaint::kLow_FilterLevel;
return false;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698