diff options
author | Bobby Georgescu <georgescu@google.com> | 2013-02-22 21:03:45 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-02-22 21:03:46 +0000 |
commit | fae7bf8557f7de818a768d7a8c30425a9a5641d8 (patch) | |
tree | 341bb1cf1c6fd0f65da4b528abe35e4c56441a96 /src/com/android/gallery3d/ui/TileImageView.java | |
parent | ea332c69f084322ebdd13419424ee5fab2351760 (diff) | |
parent | f52ceba89962829aa12f5caba131580e8da85880 (diff) | |
download | android_packages_apps_Gallery2-fae7bf8557f7de818a768d7a8c30425a9a5641d8.tar.gz android_packages_apps_Gallery2-fae7bf8557f7de818a768d7a8c30425a9a5641d8.tar.bz2 android_packages_apps_Gallery2-fae7bf8557f7de818a768d7a8c30425a9a5641d8.zip |
Merge "Replace various BitmapPools with a smarter unified pool" into gb-ub-photos-bryce
Diffstat (limited to 'src/com/android/gallery3d/ui/TileImageView.java')
-rw-r--r-- | src/com/android/gallery3d/ui/TileImageView.java | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/src/com/android/gallery3d/ui/TileImageView.java b/src/com/android/gallery3d/ui/TileImageView.java index f1c31e49d..3185c7598 100644 --- a/src/com/android/gallery3d/ui/TileImageView.java +++ b/src/com/android/gallery3d/ui/TileImageView.java @@ -27,10 +27,9 @@ import android.util.FloatMath; import android.view.WindowManager; import com.android.gallery3d.app.GalleryContext; -import com.android.gallery3d.common.ApiHelper; import com.android.gallery3d.common.Utils; -import com.android.gallery3d.data.BitmapPool; import com.android.gallery3d.data.DecodeUtils; +import com.android.photos.data.GalleryBitmapPool; import com.android.gallery3d.glrenderer.GLCanvas; import com.android.gallery3d.glrenderer.UploadedTexture; import com.android.gallery3d.util.Future; @@ -50,8 +49,6 @@ public class TileImageView extends GLView { // TILE_SIZE must be 2^N private static int sTileSize; - private static BitmapPool sTilePool; - /* * This is the tile state in the CPU side. * Life of a Tile: @@ -143,8 +140,7 @@ public class TileImageView extends GLView { // still refers to the coordinate on the original image. // // The method would be called in another thread. - public Bitmap getTile(int level, int x, int y, int tileSize, - BitmapPool pool); + public Bitmap getTile(int level, int x, int y, int tileSize); } public static boolean isHighResolution(Context context) { @@ -164,10 +160,6 @@ public class TileImageView extends GLView { } else { sTileSize = 256; } - sTilePool = - ApiHelper.HAS_REUSING_BITMAP_IN_BITMAP_REGION_DECODER - ? new BitmapPool(sTileSize, sTileSize, 128) - : null; } } @@ -399,7 +391,6 @@ public class TileImageView extends GLView { } } setScreenNail(null); - if (sTilePool != null) sTilePool.clear(); } public void prepareTextures() { @@ -508,7 +499,7 @@ public class TileImageView extends GLView { if (tile.mTileState == STATE_RECYCLING) { tile.mTileState = STATE_RECYCLED; if (tile.mDecodedTile != null) { - if (sTilePool != null) sTilePool.recycle(tile.mDecodedTile); + GalleryBitmapPool.getInstance().put(tile.mDecodedTile); tile.mDecodedTile = null; } mRecycledQueue.push(tile); @@ -536,7 +527,7 @@ public class TileImageView extends GLView { } tile.mTileState = STATE_RECYCLED; if (tile.mDecodedTile != null) { - if (sTilePool != null) sTilePool.recycle(tile.mDecodedTile); + GalleryBitmapPool.getInstance().put(tile.mDecodedTile); tile.mDecodedTile = null; } mRecycledQueue.push(tile); @@ -675,7 +666,7 @@ public class TileImageView extends GLView { @Override protected void onFreeBitmap(Bitmap bitmap) { - if (sTilePool != null) sTilePool.recycle(bitmap); + GalleryBitmapPool.getInstance().put(bitmap); } boolean decode() { @@ -683,7 +674,7 @@ public class TileImageView extends GLView { // by (1 << mTilelevel) from a region in the original image. try { mDecodedTile = DecodeUtils.ensureGLCompatibleBitmap(mModel.getTile( - mTileLevel, mX, mY, sTileSize, sTilePool)); + mTileLevel, mX, mY, sTileSize)); } catch (Throwable t) { Log.w(TAG, "fail to decode tile", t); } |