diff options
author | Bobby Georgescu <georgescu@google.com> | 2013-02-19 15:49:14 -0800 |
---|---|---|
committer | Bobby Georgescu <georgescu@google.com> | 2013-02-22 12:56:23 -0800 |
commit | 11cfeeddedd61d3c4aa40945fef0bc2d87c7559d (patch) | |
tree | ab09906b8fe29d40768210bbeb5fc16be4a87625 /src/com/android/gallery3d/ui/TileImageViewAdapter.java | |
parent | 0718d480a144ba0a44c07c48f90e85cf4ec669c6 (diff) | |
download | android_packages_apps_Snap-11cfeeddedd61d3c4aa40945fef0bc2d87c7559d.tar.gz android_packages_apps_Snap-11cfeeddedd61d3c4aa40945fef0bc2d87c7559d.tar.bz2 android_packages_apps_Snap-11cfeeddedd61d3c4aa40945fef0bc2d87c7559d.zip |
Replace various BitmapPools with a smarter unified pool
Make all of gallery use a single shared pool, and pave the
way for making the pool more adaptive based on the current
workload.
Change-Id: Ia32561ad50b1b9716ebe2fd32a7bf02737685dac
Diffstat (limited to 'src/com/android/gallery3d/ui/TileImageViewAdapter.java')
-rw-r--r-- | src/com/android/gallery3d/ui/TileImageViewAdapter.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/com/android/gallery3d/ui/TileImageViewAdapter.java b/src/com/android/gallery3d/ui/TileImageViewAdapter.java index 0d20b0757..0c1f66d0c 100644 --- a/src/com/android/gallery3d/ui/TileImageViewAdapter.java +++ b/src/com/android/gallery3d/ui/TileImageViewAdapter.java @@ -26,7 +26,7 @@ import android.graphics.Rect; import com.android.gallery3d.common.ApiHelper; import com.android.gallery3d.common.Utils; -import com.android.gallery3d.data.BitmapPool; +import com.android.photos.data.GalleryBitmapPool; public class TileImageViewAdapter implements TileImageView.TileSource { private static final String TAG = "TileImageViewAdapter"; @@ -84,7 +84,7 @@ public class TileImageViewAdapter implements TileImageView.TileSource { // (44, 44, 256, 256) from the original photo and down sample it to 106. @TargetApi(ApiHelper.VERSION_CODES.HONEYCOMB) @Override - public Bitmap getTile(int level, int x, int y, int tileSize, BitmapPool pool) { + public Bitmap getTile(int level, int x, int y, int tileSize) { if (!ApiHelper.HAS_REUSING_BITMAP_IN_BITMAP_REGION_DECODER) { return getTileWithoutReusingBitmap(level, x, y, tileSize); } @@ -106,7 +106,7 @@ public class TileImageViewAdapter implements TileImageView.TileSource { .contains(wantRegion); } - Bitmap bitmap = pool == null ? null : pool.getBitmap(); + Bitmap bitmap = GalleryBitmapPool.getInstance().get(tileSize, tileSize); if (bitmap != null) { if (needClear) bitmap.eraseColor(0); } else { @@ -126,7 +126,7 @@ public class TileImageViewAdapter implements TileImageView.TileSource { } } finally { if (options.inBitmap != bitmap && options.inBitmap != null) { - if (pool != null) pool.recycle(options.inBitmap); + GalleryBitmapPool.getInstance().put(options.inBitmap); options.inBitmap = null; } } |