summaryrefslogtreecommitdiff
path: root/boilerplate
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2009-03-28 21:30:13 -0700
committerEric Anholt <eric@anholt.net>2009-03-28 21:48:42 -0700
commit809f7dc4c83009f0a67bc8af0608b480bf7fb00e (patch)
tree75bd5e6a69db4cc902c0fd317f98c84aa7238468 /boilerplate
parent93c437d4b9261bc1ce3daf9cbd02d9cc4d2584cc (diff)
[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.
Diffstat (limited to 'boilerplate')
-rw-r--r--boilerplate/cairo-boilerplate-gl.c25
1 files 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);