OSDN Git Service

Fix unknown type for GL issue.
authorOwen Lin <owenlin@google.com>
Fri, 19 Aug 2011 08:26:29 +0000 (16:26 +0800)
committerOwen Lin <owenlin@google.com>
Fri, 19 Aug 2011 08:33:57 +0000 (16:33 +0800)
fix: 5171449

Change-Id: Ib62e3237584144e94be6be773c292002bea5d21c

src/com/android/gallery3d/data/DecodeUtils.java
src/com/android/gallery3d/ui/TileImageView.java

index e7ae638..da2d3e0 100644 (file)
@@ -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);
index cf06851..2cecedd 100644 (file)
@@ -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);