diff options
author | Owen Lin <owenlin@google.com> | 2011-08-19 16:26:29 +0800 |
---|---|---|
committer | Owen Lin <owenlin@google.com> | 2011-08-19 16:33:57 +0800 |
commit | b225416022949bbc265ead6832ef92e9e08aa3fe (patch) | |
tree | f5e435f7d832a7e94e631051b88dd0ab5e028834 | |
parent | a2fba687d4d2dbb3b2db8866b054ecb0e42871b2 (diff) | |
download | android_packages_apps_Snap-b225416022949bbc265ead6832ef92e9e08aa3fe.tar.gz android_packages_apps_Snap-b225416022949bbc265ead6832ef92e9e08aa3fe.tar.bz2 android_packages_apps_Snap-b225416022949bbc265ead6832ef92e9e08aa3fe.zip |
Fix unknown type for GL issue.
fix: 5171449
Change-Id: Ib62e3237584144e94be6be773c292002bea5d21c
-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); |