From: Owen Lin Date: Fri, 19 Aug 2011 08:26:29 +0000 (+0800) Subject: Fix unknown type for GL issue. X-Git-Tag: android-x86-6.0-r3~68^2~28^2~213^2~19^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2~428^2~2^2~2155^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=c060a99d0d0f6a0bbcf3cd6bbc6ee9d91e15814d;p=android-x86%2Fpackages-apps-Camera2.git Fix unknown type for GL issue. fix: 5171449 Change-Id: Ib62e3237584144e94be6be773c292002bea5d21c --- 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);