diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/gallery3d/data/DecodeUtils.java | 7 | ||||
-rw-r--r-- | src/com/android/gallery3d/ui/TileImageView.java | 5 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/com/android/gallery3d/data/DecodeUtils.java b/src/com/android/gallery3d/data/DecodeUtils.java index e7ae638c2..da2d3e0ee 100644 --- a/src/com/android/gallery3d/data/DecodeUtils.java +++ b/src/com/android/gallery3d/data/DecodeUtils.java @@ -55,6 +55,13 @@ public class DecodeUtils { BitmapFactory.decodeFile(filePath, options)); } + public static Bitmap requestDecode(JobContext jc, FileDescriptor fd, Options options) { + if (options == null) options = new Options(); + jc.setCancelListener(new DecodeCanceller(options)); + return ensureGLCompatibleBitmap( + BitmapFactory.decodeFileDescriptor(fd, null, options)); + } + public static Bitmap requestDecode(JobContext jc, byte[] bytes, Options options) { return requestDecode(jc, bytes, 0, bytes.length, options); diff --git a/src/com/android/gallery3d/ui/TileImageView.java b/src/com/android/gallery3d/ui/TileImageView.java index cf0685191..2cecedd33 100644 --- a/src/com/android/gallery3d/ui/TileImageView.java +++ b/src/com/android/gallery3d/ui/TileImageView.java @@ -18,6 +18,7 @@ package com.android.gallery3d.ui; import com.android.gallery3d.app.GalleryContext; import com.android.gallery3d.common.Utils; +import com.android.gallery3d.data.DecodeUtils; import com.android.gallery3d.util.Future; import com.android.gallery3d.util.ThreadPool; import com.android.gallery3d.util.ThreadPool.CancelListener; @@ -600,8 +601,8 @@ public class TileImageView extends GLView { int tileLength = (TILE_SIZE + 2 * TILE_BORDER); int borderLength = TILE_BORDER << mTileLevel; try { - mDecodedTile = mModel.getTile( - mTileLevel, mX - borderLength, mY - borderLength, tileLength); + mDecodedTile = DecodeUtils.ensureGLCompatibleBitmap(mModel.getTile( + mTileLevel, mX - borderLength, mY - borderLength, tileLength)); return mDecodedTile != null; } catch (Throwable t) { Log.w(TAG, "fail to decode tile", t); |