am baf9af94: Merge "Use EGL_NATIVE_VISUAL_ID to select EGLConfig" into honeycomb
* commit 'baf9af94a679f7e4b2273bce6c8f4645ef68015a': Use EGL_NATIVE_VISUAL_ID to select EGLConfig
This commit is contained in:
@@ -66,12 +66,6 @@ status_t EGLUtils::selectConfigForPixelFormat(
|
|||||||
if (outConfig == NULL)
|
if (outConfig == NULL)
|
||||||
return BAD_VALUE;
|
return BAD_VALUE;
|
||||||
|
|
||||||
int err;
|
|
||||||
PixelFormatInfo fbFormatInfo;
|
|
||||||
if ((err = getPixelFormatInfo(PixelFormat(format), &fbFormatInfo)) < 0) {
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get all the "potential match" configs...
|
// Get all the "potential match" configs...
|
||||||
if (eglGetConfigs(dpy, NULL, 0, &numConfigs) == EGL_FALSE)
|
if (eglGetConfigs(dpy, NULL, 0, &numConfigs) == EGL_FALSE)
|
||||||
return BAD_VALUE;
|
return BAD_VALUE;
|
||||||
@@ -81,23 +75,14 @@ status_t EGLUtils::selectConfigForPixelFormat(
|
|||||||
free(configs);
|
free(configs);
|
||||||
return BAD_VALUE;
|
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;
|
int i;
|
||||||
EGLConfig config = NULL;
|
EGLConfig config = NULL;
|
||||||
for (i=0 ; i<n ; i++) {
|
for (i=0 ; i<n ; i++) {
|
||||||
EGLint r,g,b,a;
|
EGLint nativeVisualId = 0;
|
||||||
EGLConfig curr = configs[i];
|
eglGetConfigAttrib(dpy, configs[i], EGL_NATIVE_VISUAL_ID, &nativeVisualId);
|
||||||
eglGetConfigAttrib(dpy, curr, EGL_RED_SIZE, &r);
|
if (nativeVisualId>0 && format == nativeVisualId) {
|
||||||
eglGetConfigAttrib(dpy, curr, EGL_GREEN_SIZE, &g);
|
config = configs[i];
|
||||||
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;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user