diff --git a/ChangeLog b/ChangeLog index cfae36595..77a519acc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2005-05-13 Owen Taylor + + * src/cairo-xlib-surface.c src/cairo-xlib.h + doc/public/cairo-sections.txt: Drop the _for_pixmap() and + _for_window() out of the create functions and use some lazy + cleverness to sniff the information out as needed. + + * src/cairo-xlib-surface.c src/cairo-xlib-test.h Makefile.am: + add cairo_test_xlib_disable_render() to turn off RENDER + for tests. + + * test/xlib-surface.c: Test various different types of + Xlib surface creation. + + * src/cairo-xlib.h: Remove left-over include of Xrender.h. + 2005-05-13 Kristian Høgsberg * src/cairo-pdf-surface.c (_cairo_pdf_document_open_stream): Make diff --git a/doc/public/Makefile.am b/doc/public/Makefile.am index 59c579ece..f058d36aa 100644 --- a/doc/public/Makefile.am +++ b/doc/public/Makefile.am @@ -26,6 +26,7 @@ IGNORE_HFILES= \ cairo-path-fixed-private.h \ cairo-private.h \ cairo-win32-private.h \ + cairo-xlib-test.h \ cairoint.h \ cairo-wideint.h diff --git a/doc/public/cairo-sections.txt b/doc/public/cairo-sections.txt index 121f4bb71..b462436b8 100644 --- a/doc/public/cairo-sections.txt +++ b/doc/public/cairo-sections.txt @@ -66,9 +66,8 @@ cairo_xcb_surface_create
cairo-xlib XLib Backend -cairo_xlib_surface_create_for_pixmap -cairo_xlib_surface_create_for_pixmap_with_visual -cairo_xlib_surface_create_for_window_with_visual +cairo_xlib_surface_create +cairo_xlib_surface_create_with_visual cairo_xlib_surface_set_size
diff --git a/doc/public/tmpl/cairo-xlib.sgml b/doc/public/tmpl/cairo-xlib.sgml index 7068d84f2..30282b226 100644 --- a/doc/public/tmpl/cairo-xlib.sgml +++ b/doc/public/tmpl/cairo-xlib.sgml @@ -17,37 +17,27 @@ XLib Backend - + @dpy: -@pixmap: +@drawable: @format: @Returns: -@drawable: - - - - - - - -@dpy: -@pixmap: @visual: -@Returns: +@colormap: - + @dpy: -@window: +@drawable: @visual: @Returns: diff --git a/src/Makefile.am b/src/Makefile.am index 7fcbc7f2e..30cf00e42 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -15,7 +15,7 @@ endif if CAIRO_HAS_XLIB_SURFACE libcairo_xlib_headers = cairo-xlib.h -libcairo_xlib_sources = cairo-xlib-surface.c +libcairo_xlib_sources = cairo-xlib-surface.c cairo-xlib-test.h endif if CAIRO_HAS_QUARTZ_SURFACE diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c index 302b9e7bc..be2c3d49e 100644 --- a/src/cairo-xlib-surface.c +++ b/src/cairo-xlib-surface.c @@ -36,11 +36,18 @@ #include "cairoint.h" #include "cairo-xlib.h" +#include "cairo-xlib-test.h" +#include + +/* Xlib doesn't define a typedef, so define one ourselves */ +typedef int (*cairo_xlib_error_func_t) (Display *display, + XErrorEvent *event); typedef struct _cairo_xlib_surface cairo_xlib_surface_t; typedef enum { - CAIRO_XLIB_PIXMAP, + CAIRO_XLIB_UNKNOWN, + CAIRO_XLIB_PIXMAP, CAIRO_XLIB_WINDOW } cairo_xlib_drawable_type_t; @@ -90,6 +97,24 @@ struct _cairo_xlib_surface { #define CAIRO_SURFACE_RENDER_HAS_PICTURE_TRANSFORM(surface) CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 6) #define CAIRO_SURFACE_RENDER_HAS_FILTERS(surface) CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 6) +static cairo_bool_t cairo_xlib_render_disabled = FALSE; + +/** + * cairo_test_xlib_disable_render: + * + * Disables the use of the RENDER extension. + * + * + * This function is for testing use within the Cairo distribution + * only and is in any publically installed header. + * + **/ +void +cairo_test_xlib_disable_render (void) +{ + cairo_xlib_render_disabled = TRUE; +} + static int _CAIRO_FORMAT_DEPTH (cairo_format_t format) { @@ -133,7 +158,7 @@ _cairo_xlib_surface_create_similar (void *abstract_src, _CAIRO_FORMAT_DEPTH (format)); surface = (cairo_xlib_surface_t *) - cairo_xlib_surface_create_for_pixmap (dpy, pix, format); + cairo_xlib_surface_create (dpy, pix, format); cairo_xlib_surface_set_size (&surface->base, width, height); surface->owns_pixmap = TRUE; @@ -159,6 +184,13 @@ _cairo_xlib_surface_finish (void *abstract_surface) return CAIRO_STATUS_SUCCESS; } +static int +_noop_error_handler (Display *display, + XErrorEvent *event) +{ + return False; /* return value is ignored */ +} + static void _cairo_xlib_surface_get_size (cairo_xlib_surface_t *surface, int *width, @@ -175,18 +207,60 @@ _cairo_xlib_surface_get_size (cairo_xlib_surface_t *surface, return; } - XGetGeometry (surface->dpy, - surface->drawable, - &root_ignore, &x_ignore, &y_ignore, - &width_u, &height_u, - &bwidth_ignore, &depth_ignore); - - /* The size of a pixmap can't change, so we store - * the information to avoid having to get it again + /* The first time we get the size for a drawable, we + * also want to determine whether it was a window or + * a pixmap. By calling XGetWindowAttributes(), we'll + * get: + * + * A BadWindow error if the drawable was a pixmap + * The size if the drawable was a window + * + * In the first case, we retry with XGetGeometry(). We + * could reduce all cases to a single round-trip with + * custom Xlib async code, but since this code is never + * hit when we have RENDER, or when the application calls + * cairo_xlib_surface_set_size(), it's probably not + * worth it. */ - if (surface->type == CAIRO_XLIB_PIXMAP) { - surface->width = width_u; - surface->height = height_u; + retry: + if (surface->type == CAIRO_XLIB_UNKNOWN) { + cairo_xlib_error_func_t old_handler; + XWindowAttributes xwa; + int result; + + old_handler = XSetErrorHandler (_noop_error_handler); + + result = XGetWindowAttributes (surface->dpy, + surface->drawable, + &xwa); + + XSetErrorHandler (old_handler); + + if (result) { + surface->type = CAIRO_XLIB_WINDOW; + + width_u = xwa.width; + height_u = xwa.height; + } else { + surface->type = CAIRO_XLIB_PIXMAP; + goto retry; + } + + } else { + + XGetGeometry (surface->dpy, + surface->drawable, + &root_ignore, &x_ignore, &y_ignore, + &width_u, &height_u, + &bwidth_ignore, &depth_ignore); + + if (surface->type == CAIRO_XLIB_PIXMAP) { + /* The size of a pixmap can't change, so we store + * the information to avoid having to get it again + */ + surface->width = width_u; + surface->height = height_u; + } } *width = width_u; @@ -239,7 +313,8 @@ _get_image_surface (cairo_xlib_surface_t *surface, } /* XXX: This should try to use the XShm extension if available */ - + + retry: if (surface->type == CAIRO_XLIB_WINDOW) { /* XGetImage from a window is dangerous because it can @@ -266,11 +341,25 @@ _get_image_surface (cairo_xlib_surface_t *surface, XFreePixmap (surface->dpy, pixmap); } else { + cairo_xlib_error_func_t old_handler; + + old_handler = XSetErrorHandler (_noop_error_handler); + ximage = XGetImage (surface->dpy, surface->drawable, x1, y1, x2 - x1, y2 - y1, AllPlanes, ZPixmap); + + XSetErrorHandler (old_handler); + + /* If we get an error, the surface must have been a window, + * so retry with the safe code path. + */ + if (!ximage) { + surface->type = CAIRO_XLIB_WINDOW; + goto retry; + } } if (surface->visual) { @@ -910,7 +999,6 @@ _cairo_surface_is_xlib (cairo_surface_t *surface) static cairo_surface_t * _cairo_xlib_surface_create_internal (Display *dpy, Drawable drawable, - cairo_xlib_drawable_type_t type, Visual *visual, cairo_format_t format) { @@ -922,7 +1010,7 @@ _cairo_xlib_surface_create_internal (Display *dpy, _cairo_surface_init (&surface->base, &cairo_xlib_surface_backend); - surface->type = type; + surface->type = CAIRO_XLIB_UNKNOWN; surface->dpy = dpy; @@ -962,7 +1050,8 @@ _cairo_xlib_surface_create_internal (Display *dpy, surface->visual = NULL; } - if (! XRenderQueryVersion (dpy, &surface->render_major, &surface->render_minor)) { + if (cairo_xlib_render_disabled || + ! XRenderQueryVersion (dpy, &surface->render_major, &surface->render_minor)) { surface->render_major = -1; surface->render_minor = -1; } @@ -1005,87 +1094,60 @@ _cairo_xlib_surface_create_internal (Display *dpy, } /** - * cairo_xlib_surface_create_for_pixmap: + * cairo_xlib_surface_create: * @dpy: an X display - * @pixmap: an X pixmap + * @drawable: an X drawable * @format: a standard cairo pixel data format. The depth (number of * of bits used) for the format must match the depth of * @pixmap. * - * Creates an Xlib surface that draws to the given pixmap. + * Creates an Xlib surface that draws to the given drawable. * The way that colors are represented in the pixmap is specified * by giving one of cairo's standard pixel data formats. * - * For maximum efficiency, if you know the size of the pixmap, + * For maximum efficiency, if you know the size of the drawable, * you should call cairo_xlib_surface_set_size(). * * Return value: the newly created surface **/ cairo_surface_t * -cairo_xlib_surface_create_for_pixmap (Display *dpy, - Pixmap pixmap, - cairo_format_t format) +cairo_xlib_surface_create (Display *dpy, + Drawable drawable, + cairo_format_t format) { - return _cairo_xlib_surface_create_internal (dpy, pixmap, - CAIRO_XLIB_PIXMAP, + return _cairo_xlib_surface_create_internal (dpy, drawable, NULL, format); } /** - * cairo_xlib_surface_create_for_pixmap_with_visual: + * cairo_xlib_surface_create_with_visual: * @dpy: an X display - * @pixmap: an X pixmap - * @visual: the visual to use for drawing to @pixmap. The depth - * of the visual must match the depth of the pixmap. + * @drawable: an X pixmap + * @visual: the visual to use for drawing to @drawable. The depth + * of the visual must match the depth of the drawable. * Currently, only TrueColor visuals are fully supported. * - * Creates an Xlib surface that draws to the given pixmap. - * The way that colors are represented in the pixmap is specified + * Creates an Xlib surface that draws to the given drawable. + * The way that colors are represented in the drawable is specified * by an X visual. * * Normally, you would use this function instead of - * cairo_xlib_surface_create_for_pixmap() when you double-buffering by - * using cairo to draw to pixmap and then XCopyArea() to copy the + * cairo_xlib_surface_create() when you are double-buffering by + * using cairo to draw to a pixmap and then XCopyArea() to copy the * results to a window. In that case, @visual is the visual of the * window. * - * For maximum efficiency, if you know the size of the pixmap, + * For maximum efficiency, if you know the size of the drawable, * you should call cairo_xlib_surface_set_size(). * * Return value: the newly created surface **/ cairo_surface_t * -cairo_xlib_surface_create_for_pixmap_with_visual (Display *dpy, - Pixmap pixmap, - Visual *visual) +cairo_xlib_surface_create_with_visual (Display *dpy, + Pixmap pixmap, + Visual *visual) { return _cairo_xlib_surface_create_internal (dpy, pixmap, - CAIRO_XLIB_PIXMAP, - visual, - (cairo_format_t)-1); -} - -/** - * cairo_xlib_surface_create_for_window_with_visual: - * @dpy: an X display - * @window: an X window - * @visual: the visual of @window. Currently, only TrueColor visuals - * are fully supported. - * - * Creates a new XLib backend surface that draws to the given Window. - * - * For maximum efficiency, you should use cairo_xlib_surface_set_size() - * to inform cairo of the size of the window. - * - * Return value: the newly created surface. - **/ -cairo_surface_t * -cairo_xlib_surface_create_for_window_with_visual (Display *dpy, - Window window, - Visual *visual) -{ - return _cairo_xlib_surface_create_internal (dpy, window, - CAIRO_XLIB_WINDOW, visual, (cairo_format_t)-1); } diff --git a/src/cairo-xlib-test.h b/src/cairo-xlib-test.h new file mode 100644 index 000000000..b037be14f --- /dev/null +++ b/src/cairo-xlib-test.h @@ -0,0 +1,55 @@ +/* cairo - a vector graphics library with display and print output + * + * Copyright © 2005 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it either under the terms of the GNU Lesser General Public + * License version 2.1 as published by the Free Software Foundation + * (the "LGPL") or, at your option, under the terms of the Mozilla + * Public License Version 1.1 (the "MPL"). If you do not alter this + * notice, a recipient may use your version of this file under either + * the MPL or the LGPL. + * + * You should have received a copy of the LGPL along with this library + * in the file COPYING-LGPL-2.1; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * You should have received a copy of the MPL along with this library + * in the file COPYING-MPL-1.1 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY + * OF ANY KIND, either express or implied. See the LGPL or the MPL for + * the specific language governing rights and limitations. + * + * The Original Code is the cairo graphics library. + * + * The Initial Developer of the Original Code is University of Southern + * California. + * + * Contributor(s): + * Carl D. Worth + */ + +#ifndef CAIRO_XLIB_TEST_H +#define CAIRO_XLIB_TEST_H + +#include + +#if CAIRO_HAS_XLIB_SURFACE + +#include + +CAIRO_BEGIN_DECLS + +void +cairo_test_xlib_disable_render (void); + +CAIRO_END_DECLS + +#endif /* CAIRO_HAS_XLIB_SURFACE */ +#endif /* CAIRO_XLIB_H */ + diff --git a/src/cairo-xlib.h b/src/cairo-xlib.h index 29b260dc5..3024a53bb 100644 --- a/src/cairo-xlib.h +++ b/src/cairo-xlib.h @@ -42,24 +42,18 @@ #if CAIRO_HAS_XLIB_SURFACE #include -#include CAIRO_BEGIN_DECLS cairo_surface_t * -cairo_xlib_surface_create_for_pixmap (Display *dpy, - Pixmap pixmap, - cairo_format_t format); +cairo_xlib_surface_create (Display *dpy, + Drawable drawable, + cairo_format_t format); cairo_surface_t * -cairo_xlib_surface_create_for_pixmap_with_visual (Display *dpy, - Pixmap pixmap, - Visual *visual); - -cairo_surface_t * -cairo_xlib_surface_create_for_window_with_visual (Display *dpy, - Window window, - Visual *visual); +cairo_xlib_surface_create_with_visual (Display *dpy, + Drawable drawable, + Visual *visual); void cairo_xlib_surface_set_size (cairo_surface_t *surface, diff --git a/test/Makefile.am b/test/Makefile.am index f9d648d0a..d4ec0ca8a 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -37,6 +37,10 @@ if CAIRO_HAS_PDF_SURFACE TESTS += pdf-surface endif +if CAIRO_HAS_XLIB_SURFACE +TESTS += xlib-surface +endif + # All tests which have a reference image go here. # I really don't like having to repeat this list. Anyone know a good # way to avoid it? Can I use a wildcard here? @@ -149,6 +153,7 @@ translate_show_surface_LDADD = $(LDADDS) trap_clip_LDADD = $(LDADDS) user_data_LDADD = $(LDADDS) rel_path_LDADD = $(LDADDS) +xlib_surface_LDADD = $(LDADDS) noinst_PROGRAMS = imagediff imagediff_LDADD = $(LDADDS) diff --git a/test/cairo-test.c b/test/cairo-test.c index 503091cfb..477411e6a 100644 --- a/test/cairo-test.c +++ b/test/cairo-test.c @@ -236,8 +236,8 @@ create_xlib_surface (int width, int height, void **closure) xtc->pixmap = XCreatePixmap (dpy, DefaultRootWindow (dpy), width, height, 32); - surface = cairo_xlib_surface_create_for_pixmap (dpy, xtc->pixmap, - CAIRO_FORMAT_ARGB32); + surface = cairo_xlib_surface_create (dpy, xtc->pixmap, + CAIRO_FORMAT_ARGB32); cairo_xlib_surface_set_size (surface, width, height); return surface; diff --git a/test/xlib-surface.c b/test/xlib-surface.c new file mode 100644 index 000000000..75b65713d --- /dev/null +++ b/test/xlib-surface.c @@ -0,0 +1,260 @@ +/* + * Copyright © 2005 Red Hat, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Red Hat, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. Red Hat, Inc. makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR + * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Carl D. Worth + */ + +#include +#include + +#include "cairo.h" +#include "cairo-test.h" +#include "cairo-xlib-test.h" +#include "buffer-diff.h" + +#define SIZE 100 +#define OFFSCREEN_OFFSET 50 +#define VERBOSE 0 + +cairo_bool_t result = 0; + +static void +draw_pattern (cairo_surface_t *surface) +{ + cairo_t *cr = cairo_create (surface); + int i; + + cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* white */ + cairo_paint (cr); + + cairo_set_source_rgba (cr, 0, 0.0, 0.0, 0.50); /* half-alpha-black */ + + for (i = 1; i <= 3; i++) { + int inset = SIZE / 8 * i; + + cairo_rectangle (cr, + inset, inset, + SIZE - 2 * inset, SIZE - 2 * inset); + cairo_fill (cr); + } + + cairo_destroy (cr); +} + +static void +erase_pattern (cairo_surface_t *surface) +{ + cairo_t *cr = cairo_create (surface); + + cairo_set_source_rgb (cr, 0.0, 0.0, 0.0); /* black */ + cairo_paint (cr); + + cairo_destroy (cr); +} + +static cairo_bool_t +do_test (Display *dpy, + unsigned char *reference_data, + unsigned char *test_data, + unsigned char *diff_data, + cairo_bool_t use_render, + cairo_bool_t use_pixmap, + cairo_bool_t set_size, + cairo_bool_t offscreen) +{ + cairo_surface_t *surface; + cairo_surface_t *test_surface; + cairo_t *test_cr; + cairo_bool_t result; + Drawable drawable; + int screen = DefaultScreen (dpy); + + if (use_pixmap && offscreen) + return 1; + + if (use_pixmap) { + drawable = XCreatePixmap (dpy, DefaultRootWindow (dpy), + SIZE, SIZE, DefaultDepth (dpy, screen)); + } else { + XSetWindowAttributes xwa; + int x, y; + + xwa.override_redirect = True; + + if (offscreen) { + x = - OFFSCREEN_OFFSET; + y = - OFFSCREEN_OFFSET; + } else { + x = 0; + y = 0; + } + + drawable = XCreateWindow (dpy, DefaultRootWindow (dpy), + x, y, SIZE, SIZE, 0, + DefaultDepth (dpy, screen), InputOutput, + DefaultVisual (dpy, screen), + CWOverrideRedirect, &xwa); + XMapWindow (dpy, drawable); + } + + surface = cairo_xlib_surface_create_with_visual (dpy, + drawable, + DefaultVisual (dpy, screen)); + + if (set_size) + cairo_xlib_surface_set_size (surface, SIZE, SIZE); + + draw_pattern (surface); + + test_surface = cairo_image_surface_create_for_data (test_data, + CAIRO_FORMAT_RGB24, + SIZE, SIZE, + SIZE * 4); + + test_cr = cairo_create (test_surface); + cairo_set_source_surface (test_cr, surface, 0, 0); + cairo_paint (test_cr); + + cairo_destroy (test_cr); + cairo_surface_destroy (test_surface); + + /* We erase the surface to black in case we get the same + * memory back again for the pixmap case. + */ + erase_pattern (surface); + cairo_surface_destroy (surface); + + if (use_pixmap) + XFreePixmap (dpy, drawable); + else + XDestroyWindow (dpy, drawable); + + if (offscreen) { + size_t offset = 4 * (SIZE * OFFSCREEN_OFFSET + OFFSCREEN_OFFSET); + + result = !buffer_diff (reference_data + offset, + test_data + offset, + diff_data + offset, + SIZE - OFFSCREEN_OFFSET, + SIZE - OFFSCREEN_OFFSET, + 4 * SIZE); + } else { + result = !buffer_diff (reference_data, + test_data, + diff_data, + SIZE, + SIZE, + 4 * SIZE); + } + + if (VERBOSE || !result) { + fprintf (stderr, "xlib-surface: %s, %s, %s%s: %s\n", + use_render ? " render" : "no-render", + set_size ? " size" : "no-size", + use_pixmap ? "pixmap" : "window", + use_pixmap ? + " " : + (offscreen ? ", offscreen" : ", onscreen"), + result ? "PASS" : "FAIL"); + } + + return result; +} + +static cairo_bool_t +check_visual (Display *dpy) +{ + Visual *visual = DefaultVisual (dpy, DefaultScreen (dpy)); + + if ((visual->red_mask == 0xff0000 && + visual->green_mask == 0x00ff00 && + visual->blue_mask == 0x0000ff) || + (visual->red_mask == 0x0000ff && + visual->green_mask == 0x00ff00 && + visual->blue_mask == 0xff0000)) + return 1; + else + return 0; +} + +int +main (void) +{ + Display *dpy; + unsigned char *reference_data; + unsigned char *test_data; + unsigned char *diff_data; + cairo_surface_t *reference_surface; + cairo_bool_t use_pixmap; + cairo_bool_t set_size; + cairo_bool_t offscreen; + result = 0; + + dpy = XOpenDisplay (NULL); + if (!dpy) { + fprintf (stderr, "xlib-surface: Cannot open display, skipping\n"); + return 0; + } + + if (!check_visual (dpy)) { + fprintf (stderr, "xlib-surface: default visual is not RGB24 or BGR24, skipping\n"); + return 0; + } + + reference_data = malloc (SIZE * SIZE * 4); + test_data = malloc (SIZE * SIZE * 4); + diff_data = malloc (SIZE * SIZE * 4); + + reference_surface = cairo_image_surface_create_for_data (reference_data, + CAIRO_FORMAT_RGB24, + SIZE, SIZE, + SIZE * 4); + + draw_pattern (reference_surface); + cairo_surface_destroy (reference_surface); + + for (set_size = 0; set_size <= 1; set_size++) + for (use_pixmap = 0; use_pixmap <= 1; use_pixmap++) + for (offscreen = 0; offscreen <= 1; offscreen++) + if (!do_test (dpy, + reference_data, test_data, diff_data, + 1, use_pixmap, set_size, offscreen)) + result = 1; + + cairo_test_xlib_disable_render (); + + for (set_size = 0; set_size <= 1; set_size++) + for (use_pixmap = 0; use_pixmap <= 1; use_pixmap++) + for (offscreen = 0; offscreen <= 1; offscreen++) + if (!do_test (dpy, + reference_data, test_data, diff_data, + 0, use_pixmap, set_size, offscreen)) + result = 1; + + free (reference_data); + free (test_data); + free (diff_data); + + XCloseDisplay (dpy); + + return result; +}