[cairo] [PATCH] Allow cairo-xlib-surface.c to compile on older systems.

Damian Frank damian.frank at gmail.com
Thu Aug 13 08:32:52 PDT 2009


Sorry, JavaScript malfunction.  What I meant to say was...

I have a patch for the xlib stuff just about ready, but I wanted to check
something first.  In the interest of removing compile-time
RENDER_MAJOR/MINOR checking, I made this change:

--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -156,13 +156,10 @@ static const XTransform identity = { {

 #define CAIRO_SURFACE_RENDER_HAS_PDF_OPERATORS(surface)
CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 11)

-#if RENDER_MAJOR > 0 || RENDER_MINOR >= 11
-#define CAIRO_SURFACE_RENDER_SUPPORTS_OPERATOR(surface, op) \
-     (((op) <= CAIRO_OPERATOR_SATURATE) ? TRUE :
(CAIRO_SURFACE_RENDER_HAS_PDF_OPERATORS (surface) ? (op) <=
CAIRO_OPERATOR_HSL_LUMINOSITY : FALSE))
-#else
-#define CAIRO_SURFACE_RENDER_SUPPORTS_OPERATOR(surface, op) \
-     ((op) <= CAIRO_OPERATOR_SATURATE)
-#endif
+#define CAIRO_SURFACE_RENDER_SUPPORTS_OPERATOR(surface, op)    \
+     ((op) <= CAIRO_OPERATOR_SATURATE ||            \
+      (CAIRO_SURFACE_RENDER_HAS_PDF_OPERATORS(surface) &&    \
+       (op) <= CAIRO_OPERATOR_HSL_LUMINOSITY))


This has the effect of making CAIRO_SURFACE_RENDER_SUPPORTS_OPERATOR do a
run-time check against the render version, as stored in the surface.  This
check should only occur for operators > SATURATE, assuming that the compiler
does proper short-circuiting.

This seems correct to me, but it clearly changes cairo's behavior and
performance when compiled on systems without the latest renderproto
headers.  Since that probably includes just about everyone right now, I
thought I'd ask first.  Does it look okay?

Damian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cairographics.org/archives/cairo/attachments/20090813/0facba10/attachment.htm 


More information about the cairo mailing list