summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKedi Xu <kedix@codeaurora.org>2016-08-22 12:03:03 +0800
committerKedi Xu <kedix@codeaurora.org>2016-08-22 12:03:03 +0800
commit9b551f035a4bf9fede311b735b8a3c9bfcff5cda (patch)
treefd4e935eb86e8ddb0c929f4e3bd26c786cd5808c /src
parent3a841f98947dc5437a61b3add98e72ca96b75acc (diff)
downloadandroid_packages_apps_Gallery2-9b551f035a4bf9fede311b735b8a3c9bfcff5cda.tar.gz
android_packages_apps_Gallery2-9b551f035a4bf9fede311b735b8a3c9bfcff5cda.tar.bz2
android_packages_apps_Gallery2-9b551f035a4bf9fede311b735b8a3c9bfcff5cda.zip
SnapdragonGallery:Fix gallery crash while loading content
Application is loading a texture of type RGB565 of size 483x483 without setting pixel alignment value (by glPixelStorei), so driver picks the default alignment value of 4, due to which while copying the data from client memory, sigsev is triggered because of wrong alignment, hence the crash. Change-Id: Ie133105fb3c24538288d8cc787e4945f755bb408 CRs-Fixed:1056207
Diffstat (limited to 'src')
-rwxr-xr-x[-rw-r--r--]src/com/android/gallery3d/glrenderer/GLES11Canvas.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/com/android/gallery3d/glrenderer/GLES11Canvas.java b/src/com/android/gallery3d/glrenderer/GLES11Canvas.java
index 7013c3d1f..38ee50a5e 100644..100755
--- a/src/com/android/gallery3d/glrenderer/GLES11Canvas.java
+++ b/src/com/android/gallery3d/glrenderer/GLES11Canvas.java
@@ -24,6 +24,7 @@ import android.opengl.GLUtils;
import android.opengl.Matrix;
import android.util.Log;
+import com.android.gallery3d.common.ApiHelper;
import com.android.gallery3d.common.Utils;
import com.android.gallery3d.util.IntArray;
@@ -617,7 +618,11 @@ public class GLES11Canvas implements GLCanvas {
gl.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
// We use 565 or 8888 format, so set the alignment to 2 bytes/pixel.
- gl.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 2);
+ if (ApiHelper.USE_888_PIXEL_FORMAT) {
+ gl.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 2);
+ } else {
+ gl.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
+ }
}
public void setTexEnvMode(int mode) {