From 297b0ab47fa63ef99e65b6834b731c260ea3e941 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 4 Feb 2010 23:57:43 -0800 Subject: [PATCH] [gl] When making a boilerplate GLX window, ensure it has alpha. cairo_gl_surface_create_for_window assumes CONTENT_COLOR_ALPHA, so make sure the fbconfig we choose is good enough. Fixes gl-window testcase results to basically match the non-window testcases. --- boilerplate/cairo-boilerplate-gl.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/boilerplate/cairo-boilerplate-gl.c b/boilerplate/cairo-boilerplate-gl.c index d4f5e3777..05c2d0449 100644 --- a/boilerplate/cairo-boilerplate-gl.c +++ b/boilerplate/cairo-boilerplate-gl.c @@ -149,12 +149,13 @@ _cairo_boilerplate_gl_create_window (const char *name, int id, void **closure) { - int rgb_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 }; XVisualInfo *vi; GLXContext ctx; gl_target_closure_t *gltc; @@ -181,9 +182,9 @@ _cairo_boilerplate_gl_create_window (const char *name, if (mode == CAIRO_BOILERPLATE_MODE_TEST) XSynchronize (gltc->dpy, 1); - vi = glXChooseVisual (dpy, DefaultScreen (dpy), rgb_attribs); + vi = glXChooseVisual (dpy, DefaultScreen (dpy), rgba_attribs); if (vi == NULL) { - fprintf (stderr, "Failed to create RGB, double-buffered visual\n"); + fprintf (stderr, "Failed to create RGBA, double-buffered visual\n"); XCloseDisplay (dpy); free (gltc); return NULL;