summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKedi Xu <kedix@codeaurora.org>2016-08-22 12:03:03 +0800
committerSteve Kondik <steve@cyngn.com>2016-09-26 04:54:49 -0700
commit2f324dc34064f0439ac2ec413ffe5611676dcf18 (patch)
treea80f48426e57f8e064b792d947b4bcbe7e71bbc0
parent11727bd35d9dd19dac3a98ef810aaf3adad7ac89 (diff)
downloadandroid_packages_apps_Gallery2-2f324dc34064f0439ac2ec413ffe5611676dcf18.tar.gz
android_packages_apps_Gallery2-2f324dc34064f0439ac2ec413ffe5611676dcf18.tar.bz2
android_packages_apps_Gallery2-2f324dc34064f0439ac2ec413ffe5611676dcf18.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
-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) {