[xlib] Get rid of _cairo_xlib_test_disable_render

in favor of cairo_boilerplate_xlib_surface_disable_render.
This commit is contained in:
Behdad Esfahbod 2007-04-20 02:27:19 -04:00
parent 908418cb4d
commit cd72167ede
5 changed files with 22 additions and 80 deletions

View file

@ -25,9 +25,11 @@
*/
#include "cairo-boilerplate.h"
#include "cairo-boilerplate-xlib.h"
#include "cairo-boilerplate-xlib-private.h"
#include <cairo-xlib-xrender.h>
#include <cairo-xlib-surface-private.h>
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;
}

View file

@ -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

View file

@ -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.
*
* <note>
* This function is <emphasis>only</emphasis> intended for internal
* testing use within the cairo distribution. It is not installed in
* any public header file.
* </note>
**/
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;
}

View file

@ -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 <cworth@cworth.org>
*/
#ifndef CAIRO_XLIB_TEST_H
#define CAIRO_XLIB_TEST_H
#include <cairo.h>
#if CAIRO_HAS_XLIB_SURFACE
#include <cairo-xlib.h>
CAIRO_BEGIN_DECLS
cairo_public void
_cairo_xlib_test_disable_render (void);
CAIRO_END_DECLS
#endif /* CAIRO_HAS_XLIB_SURFACE */
#endif /* CAIRO_XLIB_H */

View file

@ -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++) {