From 9b551f035a4bf9fede311b735b8a3c9bfcff5cda Mon Sep 17 00:00:00 2001 From: Kedi Xu Date: Mon, 22 Aug 2016 12:03:03 +0800 Subject: 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 --- src/com/android/gallery3d/glrenderer/GLES11Canvas.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) mode change 100644 => 100755 src/com/android/gallery3d/glrenderer/GLES11Canvas.java (limited to 'src/com') diff --git a/src/com/android/gallery3d/glrenderer/GLES11Canvas.java b/src/com/android/gallery3d/glrenderer/GLES11Canvas.java old mode 100644 new mode 100755 index 7013c3d1f..38ee50a5e --- 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) { -- cgit v1.2.3