2 * Copyright © 2008 Chris Wilson
3 * Copyright © 2010 Intel Corporation
5 * Permission to use, copy, modify, distribute, and sell this software
6 * and its documentation for any purpose is hereby granted without
7 * fee, provided that the above copyright notice appear in all copies
8 * and that both that copyright notice and this permission notice
9 * appear in supporting documentation, and that the name of
10 * Chris Wilson not be used in advertising or publicity pertaining to
11 * distribution of the software without specific, written prior
12 * permission. Chris Wilson makes no representations about the
13 * suitability of this software for any purpose. It is provided "as
14 * is" without express or implied warranty.
16 * CHRIS WILSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
17 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 * FITNESS, IN NO EVENT SHALL CHRIS WILSON BE LIABLE FOR ANY SPECIAL,
19 * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
20 * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
21 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
22 * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
24 * Author: Chris Wilson <chris@chris-wilson.co.uk>
27 #include "cairo-test.h"
30 #include "surface-source.c"
40 struct closure *arg = data;
42 glXDestroyContext (arg->dpy, arg->ctx);
43 XCloseDisplay (arg->dpy);
48 static cairo_surface_t *
49 create_source_surface (int size)
51 int rgba_attribs[] = {
63 cairo_device_t *device;
64 cairo_surface_t *surface;
67 dpy = XOpenDisplay (NULL);
71 visinfo = glXChooseVisual (dpy, DefaultScreen (dpy), rgba_attribs);
72 if (visinfo == NULL) {
77 ctx = glXCreateContext (dpy, visinfo, NULL, True);
85 arg = xmalloc (sizeof (struct closure));
88 device = cairo_glx_device_create (dpy, ctx);
89 if (cairo_device_set_user_data (device,
90 (cairo_user_data_key_t *) cleanup,
98 surface = cairo_gl_surface_create (device,
99 CAIRO_CONTENT_COLOR_ALPHA,
101 cairo_device_destroy (device);
106 CAIRO_TEST (gl_surface_source,
107 "Test using a GL surface as the source",
108 "source", /* keywords */
109 NULL, /* requirements */