summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/glrenderer/ResourceTexture.java
diff options
context:
space:
mode:
authorParamananda Pradhan <parama@codeaurora.org>2014-12-14 17:27:31 +0530
committerRicardo Cerqueira <ricardo@cyngn.com>2015-09-15 21:31:49 +0100
commit829f9ad8c06070038cdef24e5fac76a8a16f841b (patch)
tree80fb1a7700307bb833226e04e5547f91f86f374a /src/com/android/gallery3d/glrenderer/ResourceTexture.java
parenta5aa75d6ac958822e145b61e7c475bd1dc1b5260 (diff)
downloadandroid_packages_apps_Gallery2-829f9ad8c06070038cdef24e5fac76a8a16f841b.tar.gz
android_packages_apps_Gallery2-829f9ad8c06070038cdef24e5fac76a8a16f841b.tar.bz2
android_packages_apps_Gallery2-829f9ad8c06070038cdef24e5fac76a8a16f841b.zip
Gallery2: Make Gallery2 support OMADRM feature
- Make Gallery2 can recognize and consume DRM images and videos. Change-Id: I1655d295bcec31b5760c2c86c06f815cf6ed57ee
Diffstat (limited to 'src/com/android/gallery3d/glrenderer/ResourceTexture.java')
-rw-r--r--src/com/android/gallery3d/glrenderer/ResourceTexture.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/com/android/gallery3d/glrenderer/ResourceTexture.java b/src/com/android/gallery3d/glrenderer/ResourceTexture.java
index eb8e8a517..d60a16c5a 100644
--- a/src/com/android/gallery3d/glrenderer/ResourceTexture.java
+++ b/src/com/android/gallery3d/glrenderer/ResourceTexture.java
@@ -19,6 +19,7 @@ package com.android.gallery3d.glrenderer;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
+import android.util.Log;
import junit.framework.Assert;
@@ -26,6 +27,7 @@ import junit.framework.Assert;
// By default ResourceTexture is not opaque.
public class ResourceTexture extends UploadedTexture {
+ private static final String TAG = "ResourceTexture";
protected final Context mContext;
protected final int mResId;
@@ -40,8 +42,15 @@ public class ResourceTexture extends UploadedTexture {
protected Bitmap onGetBitmap() {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
- return BitmapFactory.decodeResource(
- mContext.getResources(), mResId, options);
+ Bitmap bitmap = null;
+ try {
+ bitmap = BitmapFactory.decodeResource(mContext.getResources(), mResId, options, false);
+ } catch (OutOfMemoryError ex) {
+ Log.e(TAG, "BitmapFactory decode resource out of memory");
+ ex.printStackTrace();
+ return null;
+ }
+ return bitmap;
}
@Override