summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/ui/BitmapScreenNail.java
diff options
context:
space:
mode:
authorOwen Lin <owenlin@google.com>2012-06-28 17:12:20 +0800
committerOwen Lin <owenlin@google.com>2012-07-03 18:05:47 +0800
commit7aac26484af3d40df81e1d08c673bd925856a7fa (patch)
tree4f444fc13ca1ee651f2e5e75787b5f1c16cef9eb /src/com/android/gallery3d/ui/BitmapScreenNail.java
parentce8b4485801843c14abc3654e57aad96d1364e49 (diff)
downloadandroid_packages_apps_Snap-7aac26484af3d40df81e1d08c673bd925856a7fa.tar.gz
android_packages_apps_Snap-7aac26484af3d40df81e1d08c673bd925856a7fa.tar.bz2
android_packages_apps_Snap-7aac26484af3d40df81e1d08c673bd925856a7fa.zip
Don't reuse bitmap before HoneyComb.
Change-Id: I0df9bf0a8f43e28ed25b436d4c584dc3ceb43c1d
Diffstat (limited to 'src/com/android/gallery3d/ui/BitmapScreenNail.java')
-rw-r--r--src/com/android/gallery3d/ui/BitmapScreenNail.java16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/com/android/gallery3d/ui/BitmapScreenNail.java b/src/com/android/gallery3d/ui/BitmapScreenNail.java
index 5c917570d..0043e0cbe 100644
--- a/src/com/android/gallery3d/ui/BitmapScreenNail.java
+++ b/src/com/android/gallery3d/ui/BitmapScreenNail.java
@@ -20,6 +20,7 @@ import android.graphics.Bitmap;
import android.graphics.RectF;
import com.android.gallery3d.common.Utils;
+import com.android.gallery3d.data.BitmapPool;
import com.android.gallery3d.data.MediaItem;
// This is a ScreenNail wraps a Bitmap. There are some extra functions:
@@ -70,6 +71,11 @@ public class BitmapScreenNail implements ScreenNail {
mHeight = Math.round(scale * height);
}
+ private static void recycleBitmap(BitmapPool pool, Bitmap bitmap) {
+ if (pool == null || bitmap == null) return;
+ pool.recycle(bitmap);
+ }
+
// Combines the two ScreenNails.
// Returns the used one and recycle the unused one.
public ScreenNail combine(ScreenNail other) {
@@ -88,9 +94,7 @@ public class BitmapScreenNail implements ScreenNail {
mWidth = newer.mWidth;
mHeight = newer.mHeight;
if (newer.mBitmap != null) {
- if (mBitmap != null) {
- MediaItem.getThumbPool().recycle(mBitmap);
- }
+ recycleBitmap(MediaItem.getThumbPool(), mBitmap);
mBitmap = newer.mBitmap;
newer.mBitmap = null;
@@ -130,10 +134,8 @@ public class BitmapScreenNail implements ScreenNail {
mTexture.recycle();
mTexture = null;
}
- if (mBitmap != null) {
- MediaItem.getThumbPool().recycle(mBitmap);
- mBitmap = null;
- }
+ recycleBitmap(MediaItem.getThumbPool(), mBitmap);
+ mBitmap = null;
}
@Override