summaryrefslogtreecommitdiff
path: root/opengl/java
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2009-08-20 19:09:34 -0700
committerMathias Agopian <mathias@google.com>2009-08-20 19:09:34 -0700
commit82fd4fce16b9bbde25d044acc86ddf7306ebdd10 (patch)
tree5d831d3f987bb6d1d62d8bca692ce4c5218c6432 /opengl/java
parentdd8cb62bdf48ec0096c0ed665996a25320d477e2 (diff)
fix a bug in ComponentSizeChooser where it could pick a software EGLConfig instead of a better h/w one.
We now just try to honor the stencil / depth buffer "at least", while doing a "shortest distance" on the colors.
Diffstat (limited to 'opengl/java')
-rw-r--r--opengl/java/android/opengl/GLSurfaceView.java32
1 files changed, 17 insertions, 15 deletions
diff --git a/opengl/java/android/opengl/GLSurfaceView.java b/opengl/java/android/opengl/GLSurfaceView.java
index 132473a352aa..022da0c2aed1 100644
--- a/opengl/java/android/opengl/GLSurfaceView.java
+++ b/opengl/java/android/opengl/GLSurfaceView.java
@@ -655,25 +655,27 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
EGLConfig closestConfig = null;
int closestDistance = 1000;
for(EGLConfig config : configs) {
- int r = findConfigAttrib(egl, display, config,
- EGL10.EGL_RED_SIZE, 0);
- int g = findConfigAttrib(egl, display, config,
- EGL10.EGL_GREEN_SIZE, 0);
- int b = findConfigAttrib(egl, display, config,
- EGL10.EGL_BLUE_SIZE, 0);
- int a = findConfigAttrib(egl, display, config,
- EGL10.EGL_ALPHA_SIZE, 0);
int d = findConfigAttrib(egl, display, config,
EGL10.EGL_DEPTH_SIZE, 0);
int s = findConfigAttrib(egl, display, config,
EGL10.EGL_STENCIL_SIZE, 0);
- int distance = Math.abs(r - mRedSize)
- + Math.abs(g - mGreenSize)
- + Math.abs(b - mBlueSize) + Math.abs(a - mAlphaSize)
- + Math.abs(d - mDepthSize) + Math.abs(s - mStencilSize);
- if (distance < closestDistance) {
- closestDistance = distance;
- closestConfig = config;
+ if (d >= mDepthSize && s>= mStencilSize) {
+ int r = findConfigAttrib(egl, display, config,
+ EGL10.EGL_RED_SIZE, 0);
+ int g = findConfigAttrib(egl, display, config,
+ EGL10.EGL_GREEN_SIZE, 0);
+ int b = findConfigAttrib(egl, display, config,
+ EGL10.EGL_BLUE_SIZE, 0);
+ int a = findConfigAttrib(egl, display, config,
+ EGL10.EGL_ALPHA_SIZE, 0);
+ int distance = Math.abs(r - mRedSize)
+ + Math.abs(g - mGreenSize)
+ + Math.abs(b - mBlueSize)
+ + Math.abs(a - mAlphaSize);
+ if (distance < closestDistance) {
+ closestDistance = distance;
+ closestConfig = config;
+ }
}
}
return closestConfig;