diff options
author | Pin Ting <pinting@google.com> | 2012-09-19 01:28:18 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-09-19 01:28:18 -0700 |
commit | 5439e7f0ec09c59c1159c2ba233ecd95f26fb9fe (patch) | |
tree | c3f2ae961f38931a10dfba0b4660483640d3bb27 /src/com/android | |
parent | a7f4e15ea94735e31739dd1122ed97018a552dfd (diff) | |
parent | c5378acab92e5d9428e35acc595f09c4bfcb3823 (diff) | |
download | android_packages_apps_Snap-5439e7f0ec09c59c1159c2ba233ecd95f26fb9fe.tar.gz android_packages_apps_Snap-5439e7f0ec09c59c1159c2ba233ecd95f26fb9fe.tar.bz2 android_packages_apps_Snap-5439e7f0ec09c59c1159c2ba233ecd95f26fb9fe.zip |
Merge "Use 565 pixel format for pre-JB; use 888 otherwise." into gb-ub-photos-arches
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/gallery3d/ui/GLRootView.java | 6 | ||||
-rw-r--r-- | src/com/android/gallery3d/ui/GalleryEGLConfigChooser.java | 24 |
2 files changed, 24 insertions, 6 deletions
diff --git a/src/com/android/gallery3d/ui/GLRootView.java b/src/com/android/gallery3d/ui/GLRootView.java index d3969349a..390d58737 100644 --- a/src/com/android/gallery3d/ui/GLRootView.java +++ b/src/com/android/gallery3d/ui/GLRootView.java @@ -119,7 +119,11 @@ public class GLRootView extends GLSurfaceView setBackgroundDrawable(null); setEGLConfigChooser(mEglConfigChooser); setRenderer(this); - getHolder().setFormat(PixelFormat.RGB_565); + if (ApiHelper.USE_888_PIXEL_FORMAT) { + getHolder().setFormat(PixelFormat.RGB_888); + } else { + getHolder().setFormat(PixelFormat.RGB_565); + } // Uncomment this to enable gl error check. // setDebugFlags(DEBUG_CHECK_GL_ERROR); diff --git a/src/com/android/gallery3d/ui/GalleryEGLConfigChooser.java b/src/com/android/gallery3d/ui/GalleryEGLConfigChooser.java index 7089d3c1d..deeb3b76d 100644 --- a/src/com/android/gallery3d/ui/GalleryEGLConfigChooser.java +++ b/src/com/android/gallery3d/ui/GalleryEGLConfigChooser.java @@ -17,6 +17,8 @@ package com.android.gallery3d.ui; import android.opengl.GLSurfaceView.EGLConfigChooser; +import com.android.gallery3d.common.ApiHelper; + import javax.microedition.khronos.egl.EGL10; import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.egl.EGLDisplay; @@ -31,7 +33,7 @@ class GalleryEGLConfigChooser implements EGLConfigChooser { private static final String TAG = "GalleryEGLConfigChooser"; - private final int mConfigSpec[] = new int[] { + private final int mConfigSpec565[] = new int[] { EGL10.EGL_RED_SIZE, 5, EGL10.EGL_GREEN_SIZE, 6, EGL10.EGL_BLUE_SIZE, 5, @@ -39,9 +41,19 @@ class GalleryEGLConfigChooser implements EGLConfigChooser { EGL10.EGL_NONE }; + private final int mConfigSpec888[] = new int[] { + EGL10.EGL_RED_SIZE, 8, + EGL10.EGL_GREEN_SIZE, 8, + EGL10.EGL_BLUE_SIZE, 8, + EGL10.EGL_ALPHA_SIZE, 0, + EGL10.EGL_NONE + }; + @Override public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) { int[] numConfig = new int[1]; + int mConfigSpec[] = ApiHelper.USE_888_PIXEL_FORMAT + ? mConfigSpec888 : mConfigSpec565; if (!egl.eglChooseConfig(display, mConfigSpec, null, 0, numConfig)) { throw new RuntimeException("eglChooseConfig failed"); } @@ -70,10 +82,12 @@ class GalleryEGLConfigChooser implements EGLConfigChooser { // has stencil support but with smallest number of stencil bits. If // none is found, choose any one. for (int i = 0, n = configs.length; i < n; ++i) { - if (egl.eglGetConfigAttrib( - display, configs[i], EGL10.EGL_RED_SIZE, value)) { - // Filter out ARGB 8888 configs. - if (value[0] == 8) continue; + if (!ApiHelper.USE_888_PIXEL_FORMAT) { + if (egl.eglGetConfigAttrib( + display, configs[i], EGL10.EGL_RED_SIZE, value)) { + // Filter out ARGB 8888 configs. + if (value[0] == 8) continue; + } } if (egl.eglGetConfigAttrib( display, configs[i], EGL10.EGL_STENCIL_SIZE, value)) { |