diff --git a/boilerplate/cairo-boilerplate-xlib.c b/boilerplate/cairo-boilerplate-xlib.c index 302035d38..615fc98fa 100644 --- a/boilerplate/cairo-boilerplate-xlib.c +++ b/boilerplate/cairo-boilerplate-xlib.c @@ -25,9 +25,11 @@ */ #include "cairo-boilerplate.h" +#include "cairo-boilerplate-xlib.h" #include "cairo-boilerplate-xlib-private.h" #include +#include typedef struct _xlib_target_closure { @@ -194,3 +196,16 @@ _cairo_boilerplate_xlib_cleanup (void *closure) XCloseDisplay (xtc->dpy); free (xtc); } + +cairo_status_t +cairo_boilerplate_xlib_surface_disable_render (cairo_surface_t *abstract_surface) +{ + cairo_xlib_surface_t *surface = (cairo_xlib_surface_t*) abstract_surface; + + if (cairo_surface_get_type (abstract_surface) != CAIRO_SURFACE_TYPE_XLIB) + return CAIRO_STATUS_SURFACE_TYPE_MISMATCH; + + surface->render_major = surface->render_minor = -1; + + return CAIRO_STATUS_SUCCESS; +} diff --git a/src/Makefile.am b/src/Makefile.am index eb8edbd94..83e0bca7d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -47,7 +47,7 @@ endif if CAIRO_HAS_XLIB_SURFACE libcairo_xlib_headers = cairo-xlib.h cairo-xlib-xrender.h libcairo_xlib_sources = cairo-xlib-surface.c cairo-xlib-surface-private.h \ - cairo-xlib-screen.c cairo-xlib-private.h cairo-xlib-test.h + cairo-xlib-screen.c cairo-xlib-private.h backend_pkgconfigs += cairo-xlib.pc endif diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c index 4f0ae6d81..8d9d1073b 100644 --- a/src/cairo-xlib-surface.c +++ b/src/cairo-xlib-surface.c @@ -39,7 +39,6 @@ #include "cairoint.h" #include "cairo-xlib.h" #include "cairo-xlib-xrender.h" -#include "cairo-xlib-test.h" #include "cairo-xlib-private.h" #include "cairo-xlib-surface-private.h" #include "cairo-clip-private.h" @@ -109,25 +108,6 @@ static const XTransform identity = { { #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_xlib_test_disable_render: - * - * Disables the use of the RENDER extension. - * - * - * This function is only intended for internal - * testing use within the cairo distribution. It is not installed in - * any public header file. - * - **/ -void -_cairo_xlib_test_disable_render (void) -{ - cairo_xlib_render_disabled = TRUE; -} - static int _CAIRO_FORMAT_DEPTH (cairo_format_t format) { @@ -1848,8 +1828,7 @@ _cairo_xlib_surface_create_internal (Display *dpy, ; } - if (cairo_xlib_render_disabled || - ! XRenderQueryVersion (dpy, &surface->render_major, &surface->render_minor)) { + if (! XRenderQueryVersion (dpy, &surface->render_major, &surface->render_minor)) { surface->render_major = -1; surface->render_minor = -1; } diff --git a/src/cairo-xlib-test.h b/src/cairo-xlib-test.h deleted file mode 100644 index ec167c15c..000000000 --- a/src/cairo-xlib-test.h +++ /dev/null @@ -1,54 +0,0 @@ -/* 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 - -cairo_public void -_cairo_xlib_test_disable_render (void); - -CAIRO_END_DECLS - -#endif /* CAIRO_HAS_XLIB_SURFACE */ -#endif /* CAIRO_XLIB_H */ diff --git a/test/xlib-surface.c b/test/xlib-surface.c index 3b6d1b503..a1578cdb3 100644 --- a/test/xlib-surface.c +++ b/test/xlib-surface.c @@ -30,7 +30,8 @@ #include "cairo-xlib.h" #include "cairo-xlib-xrender.h" #include "cairo-test.h" -#include "cairo-xlib-test.h" + +#include "cairo-boilerplate-xlib.h" #include "buffer-diff.h" @@ -123,6 +124,9 @@ do_test (Display *dpy, DefaultVisual (dpy, screen), SIZE, SIZE); + if (!use_render) + cairo_boilerplate_xlib_surface_disable_render (surface); + if (set_size) { cairo_xlib_surface_set_size (surface, SIZE, SIZE); @@ -257,8 +261,6 @@ main (void) result = status; } - _cairo_xlib_test_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++) {