From 809f7dc4c83009f0a67bc8af0608b480bf7fb00e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sat, 28 Mar 2009 21:30:13 -0700 Subject: [PATCH] [gl] Make sure test visuals for CAIRO_CONTENT_COLOR_ALPHA have alpha bits. Since we're just making FBOs, the visual chosen probably shouldn't matter, and it doesn't on Intel. But it does seem like the right thing to do. --- boilerplate/cairo-boilerplate-gl.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/boilerplate/cairo-boilerplate-gl.c b/boilerplate/cairo-boilerplate-gl.c index b914ce073..e818341ca 100644 --- a/boilerplate/cairo-boilerplate-gl.c +++ b/boilerplate/cairo-boilerplate-gl.c @@ -66,12 +66,19 @@ _cairo_boilerplate_gl_create_surface (const char *name, int id, void **closure) { - int attribs[] = { GLX_RGBA, - GLX_RED_SIZE, 1, - GLX_GREEN_SIZE, 1, - GLX_BLUE_SIZE, 1, - GLX_DOUBLEBUFFER, - None }; + int rgba_attribs[] = { GLX_RGBA, + GLX_RED_SIZE, 1, + GLX_GREEN_SIZE, 1, + GLX_BLUE_SIZE, 1, + GLX_ALPHA_SIZE, 1, + GLX_DOUBLEBUFFER, + None }; + int rgb_attribs[] = { GLX_RGBA, + GLX_RED_SIZE, 1, + GLX_GREEN_SIZE, 1, + GLX_BLUE_SIZE, 1, + GLX_DOUBLEBUFFER, + None }; XVisualInfo *visinfo; GLXContext gl_ctx; gl_target_closure_t *gltc; @@ -96,7 +103,11 @@ _cairo_boilerplate_gl_create_surface (const char *name, if (mode == CAIRO_BOILERPLATE_MODE_TEST) XSynchronize (gltc->dpy, 1); - visinfo = glXChooseVisual (dpy, DefaultScreen (dpy), attribs); + if (content == CAIRO_CONTENT_COLOR) + visinfo = glXChooseVisual (dpy, DefaultScreen (dpy), rgb_attribs); + else + visinfo = glXChooseVisual (dpy, DefaultScreen (dpy), rgba_attribs); + if (visinfo == NULL) { fprintf (stderr, "Failed to create RGB, double-buffered visual\n"); XCloseDisplay (dpy);