summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/data/DecodeUtils.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/gallery3d/data/DecodeUtils.java')
-rw-r--r--src/com/android/gallery3d/data/DecodeUtils.java22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/com/android/gallery3d/data/DecodeUtils.java b/src/com/android/gallery3d/data/DecodeUtils.java
index 825c4bbea..12405184c 100644
--- a/src/com/android/gallery3d/data/DecodeUtils.java
+++ b/src/com/android/gallery3d/data/DecodeUtils.java
@@ -87,7 +87,7 @@ public class DecodeUtils {
jc.setCancelListener(new DecodeCanceller(options));
setOptionsMutable(options);
return ensureGLCompatibleBitmap(
- BitmapFactory.decodeByteArray(bytes, offset, length, options));
+ BitmapFactory.decodeByteArray(bytes, offset, length, options, false));
}
public static void decodeBounds(JobContext jc, byte[] bytes, int offset,
@@ -95,7 +95,7 @@ public class DecodeUtils {
Utils.assertTrue(options != null);
options.inJustDecodeBounds = true;
jc.setCancelListener(new DecodeCanceller(options));
- BitmapFactory.decodeByteArray(bytes, offset, length, options);
+ BitmapFactory.decodeByteArray(bytes, offset, length, options, false);
options.inJustDecodeBounds = false;
}
@@ -120,7 +120,7 @@ public class DecodeUtils {
jc.setCancelListener(new DecodeCanceller(options));
options.inJustDecodeBounds = true;
- BitmapFactory.decodeFileDescriptor(fd, null, options);
+ BitmapFactory.decodeFileDescriptor(fd, null, options, false);
if (jc.isCancelled()) return null;
int w = options.outWidth;
@@ -148,7 +148,7 @@ public class DecodeUtils {
options.inJustDecodeBounds = false;
setOptionsMutable(options);
- Bitmap result = BitmapFactory.decodeFileDescriptor(fd, null, options);
+ Bitmap result = BitmapFactory.decodeFileDescriptor(fd, null, options, false);
if (result == null) return null;
// We need to resize down if the decoder does not support inSampleSize
@@ -174,7 +174,7 @@ public class DecodeUtils {
jc.setCancelListener(new DecodeCanceller(options));
options.inJustDecodeBounds = true;
- BitmapFactory.decodeByteArray(data, 0, data.length, options);
+ BitmapFactory.decodeByteArray(data, 0, data.length, options, false);
if (jc.isCancelled()) return null;
if (options.outWidth < targetSize || options.outHeight < targetSize) {
return null;
@@ -184,8 +184,16 @@ public class DecodeUtils {
options.inJustDecodeBounds = false;
setOptionsMutable(options);
- return ensureGLCompatibleBitmap(
- BitmapFactory.decodeByteArray(data, 0, data.length, options));
+ Bitmap bitmap = null;
+
+ try {
+ bitmap = BitmapFactory.decodeByteArray(data, 0, data.length, options, false);
+
+ } catch (OutOfMemoryError ex) {
+ bitmap = null;
+ Log.e(TAG, "OutOfMemoryError : image is too large");
+ }
+ return ensureGLCompatibleBitmap(bitmap);
}
// TODO: This function should not be called directly from