diff options
author | Mathias Agopian <mathias@google.com> | 2011-01-16 17:57:20 -0800 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2011-01-16 17:57:20 -0800 |
commit | 22a666a80b67b199188805b63ffc01a3e044b3ef (patch) | |
tree | b6421a5ca9660993f7f07c5d4119484f6bf3b0e0 /libs/ui | |
parent | 4a2e478a5bf6b4650181d1dfa643eadcc387fcec (diff) | |
download | frameworks_base-22a666a80b67b199188805b63ffc01a3e044b3ef.zip frameworks_base-22a666a80b67b199188805b63ffc01a3e044b3ef.tar.gz frameworks_base-22a666a80b67b199188805b63ffc01a3e044b3ef.tar.bz2 |
Use EGL_NATIVE_VISUAL_ID to select EGLConfig
EGLUtils::selectConfigForPixelFormat() now uses EGL_NATIVE_VISUAL_ID
to select a config with the proper format. this is more robust and
future proof.
Change-Id: Ib85e0974160945d838956b50a3cac4de78618957
Diffstat (limited to 'libs/ui')
-rw-r--r-- | libs/ui/EGLUtils.cpp | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/libs/ui/EGLUtils.cpp b/libs/ui/EGLUtils.cpp index 1663313..f24a71d 100644 --- a/libs/ui/EGLUtils.cpp +++ b/libs/ui/EGLUtils.cpp @@ -66,12 +66,6 @@ status_t EGLUtils::selectConfigForPixelFormat( if (outConfig == NULL) return BAD_VALUE; - int err; - PixelFormatInfo fbFormatInfo; - if ((err = getPixelFormatInfo(PixelFormat(format), &fbFormatInfo)) < 0) { - return err; - } - // Get all the "potential match" configs... if (eglGetConfigs(dpy, NULL, 0, &numConfigs) == EGL_FALSE) return BAD_VALUE; @@ -81,23 +75,14 @@ status_t EGLUtils::selectConfigForPixelFormat( free(configs); return BAD_VALUE; } - - const int fbSzA = fbFormatInfo.getSize(PixelFormatInfo::INDEX_ALPHA); - const int fbSzR = fbFormatInfo.getSize(PixelFormatInfo::INDEX_RED); - const int fbSzG = fbFormatInfo.getSize(PixelFormatInfo::INDEX_GREEN); - const int fbSzB = fbFormatInfo.getSize(PixelFormatInfo::INDEX_BLUE); int i; EGLConfig config = NULL; for (i=0 ; i<n ; i++) { - EGLint r,g,b,a; - EGLConfig curr = configs[i]; - eglGetConfigAttrib(dpy, curr, EGL_RED_SIZE, &r); - eglGetConfigAttrib(dpy, curr, EGL_GREEN_SIZE, &g); - eglGetConfigAttrib(dpy, curr, EGL_BLUE_SIZE, &b); - eglGetConfigAttrib(dpy, curr, EGL_ALPHA_SIZE, &a); - if (fbSzA == a && fbSzR == r && fbSzG == g && fbSzB == b) { - config = curr; + EGLint nativeVisualId = 0; + eglGetConfigAttrib(dpy, configs[i], EGL_NATIVE_VISUAL_ID, &nativeVisualId); + if (nativeVisualId>0 && format == nativeVisualId) { + config = configs[i]; break; } } |