From 37af236d77cc3eb8bc9f4bc020e4cdbce747dcc0 Mon Sep 17 00:00:00 2001 From: Andrea Canciani Date: Mon, 7 Feb 2011 22:13:53 +0100 Subject: [PATCH] xlib: Fix compilation when gradient functions are not available It is not correct to rely on the version defined in render.h. The Xrender.h header is independent and might not define some functions available in RENDER 0.10. Their availability must be detected at configure time and the stubs must be defined only if the functions are not available. Fixes https://bugs.freedesktop.org/show_bug.cgi?id=31906 --- configure.ac | 8 ++++++++ src/cairo-xlib-xrender-private.h | 23 ++++++++++++++--------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index 09bdd9f..74e9828 100644 --- a/configure.ac +++ b/configure.ac @@ -86,6 +86,14 @@ CAIRO_ENABLE_SURFACE_BACKEND(xlib_xrender, Xlib Xrender, auto, [ fi ]) +old_CFLAGS=$CFLAGS +old_LIBS=$LIBS +CFLAGS="$CFLAGS $xlib_CFLAGS $xlib_NONPKGCONFIG_CFLAGS $xlib_xrender_CFLAGS $xlib_xrender_NONPKGCONFIG_CFLAGS" +LIBS="$LIBS $xlib_LIBS $xlib_NONPKGCONFIG_LIBS $xlib_xrender_LIBS $xlib_xrender_NONPKGCONFIG_LIBS" +AC_CHECK_FUNCS([XRenderCreateLinearGradient XRenderCreateRadialGradient XRenderCreateConicalGradient]) +CFLAGS=$old_CFLAGS +LIBS=$old_LIBS + dnl =========================================================================== CAIRO_ENABLE_SURFACE_BACKEND(xcb, XCB, auto, [ diff --git a/src/cairo-xlib-xrender-private.h b/src/cairo-xlib-xrender-private.h index 52f4159..bf3199c 100644 --- a/src/cairo-xlib-xrender-private.h +++ b/src/cairo-xlib-xrender-private.h @@ -96,26 +96,31 @@ __attribute__((__unused__)) static void _void_consume_free (Display *p, XID #define PictOpBlendMaximum 0x3e #endif -/* There doesn't appear to be a simple #define that we can conditionalize - * on. Instead, use the version; gradients were introdiced in 0.10. */ -#if RENDER_MAJOR == 0 && RENDER_MINOR < 10 +#if !HAVE_XRENDERCREATELINEARGRADIENT #define XRenderCreateLinearGradient _int_consume + +typedef struct _XLinearGradient { + XPointFixed p1; + XPointFixed p2; +} XLinearGradient; +#endif + +#if !HAVE_XRENDERCREATERADIALGRADIENT #define XRenderCreateRadialGradient _int_consume -#define XRenderCreateConicalGradient _int_consume + typedef struct _XCircle { XFixed x; XFixed y; XFixed radius; } XCircle; -typedef struct _XLinearGradient { - XPointFixed p1; - XPointFixed p2; -} XLinearGradient; - typedef struct _XRadialGradient { XCircle inner; XCircle outer; } XRadialGradient; +#endif + +#if !HAVE_XRENDERCREATECONICALGRADIENT +#define XRenderCreateConicalGradient _int_consume typedef struct _XConicalGradient { XPointFixed center; -- 1.7.1