From 2eaa2112c460e931ad0261b408213d3d1217d96f Mon Sep 17 00:00:00 2001 From: Chih-Chung Chang Date: Tue, 17 Apr 2012 20:35:14 +0800 Subject: Add thumb pool the cache Bitmap used for thumbnails. Change-Id: Ib710f2a6fc1aa86fe4abdd18d1fa7ac71396a3b4 --- src/com/android/gallery3d/ui/BitmapScreenNail.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/com/android/gallery3d/ui/BitmapScreenNail.java') diff --git a/src/com/android/gallery3d/ui/BitmapScreenNail.java b/src/com/android/gallery3d/ui/BitmapScreenNail.java index 3481aa18e..064e1af0e 100644 --- a/src/com/android/gallery3d/ui/BitmapScreenNail.java +++ b/src/com/android/gallery3d/ui/BitmapScreenNail.java @@ -20,6 +20,8 @@ import android.graphics.Bitmap; import android.graphics.RectF; import android.util.Log; +import com.android.gallery3d.data.MediaItem; + // This is a ScreenNail wraps a Bitmap. It also includes the rotation // information. The getWidth() and getHeight() methods return the width/height // before rotation. @@ -28,7 +30,7 @@ public class BitmapScreenNail implements ScreenNail { private final int mWidth; private final int mHeight; private final int mRotation; - private final Bitmap mBitmap; + private Bitmap mBitmap; private BitmapTexture mTexture; public BitmapScreenNail(Bitmap bitmap, int rotation) { @@ -60,11 +62,15 @@ public class BitmapScreenNail implements ScreenNail { } @Override - public void pauseDraw() { + public void recycle() { if (mTexture != null) { mTexture.recycle(); mTexture = null; } + if (mBitmap != null) { + MediaItem.getThumbPool().recycle(mBitmap); + mBitmap = null; + } } @Override -- cgit v1.2.3