[cairo-commit] src/cairo-image-surface.c src/cairo-xlib-surface.c

Chris Wilson ickle at kemper.freedesktop.org
Thu Jul 16 06:21:01 PDT 2009


 src/cairo-image-surface.c |   10 +++++----
 src/cairo-xlib-surface.c  |   48 +++++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 51 insertions(+), 7 deletions(-)

New commits:
commit 34d5b862bce3e9273391eb5d2c384394cca94d2d
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Jul 16 14:18:13 2009 +0100

    [xlib] Enable Render support for the extended PDF operators
    
    With the latest 0.11 release of renderproto we now have the ability to
    use the extended PDF operators via Render.

diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index d8d57c6..278654a 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -946,13 +946,13 @@ _pixman_operator (cairo_operator_t op)
     case CAIRO_OPERATOR_DARKEN:
 	return PIXMAN_OP_DARKEN;
     case CAIRO_OPERATOR_LIGHTEN:
- 	return PIXMAN_OP_LIGHTEN;
+	return PIXMAN_OP_LIGHTEN;
     case CAIRO_OPERATOR_COLOR_DODGE:
- 	return PIXMAN_OP_COLOR_DODGE;
+	return PIXMAN_OP_COLOR_DODGE;
     case CAIRO_OPERATOR_COLOR_BURN:
- 	return PIXMAN_OP_COLOR_BURN;
+	return PIXMAN_OP_COLOR_BURN;
     case CAIRO_OPERATOR_HARD_LIGHT:
- 	return PIXMAN_OP_HARD_LIGHT;
+	return PIXMAN_OP_HARD_LIGHT;
     case CAIRO_OPERATOR_SOFT_LIGHT:
 	return PIXMAN_OP_SOFT_LIGHT;
     case CAIRO_OPERATOR_DIFFERENCE:
@@ -967,7 +967,9 @@ _pixman_operator (cairo_operator_t op)
 	return PIXMAN_OP_HSL_COLOR;
     case CAIRO_OPERATOR_HSL_LUMINOSITY:
 	return PIXMAN_OP_HSL_LUMINOSITY;
+
     default:
+	ASSERT_NOT_REACHED;
 	return PIXMAN_OP_OVER;
     }
 }
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index e7d30b2..1aae288 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -131,6 +131,16 @@ 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)
 
+#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) \
+    (CAIRO_SURFACE_RENDER_HAS_PDF_OPERATORS (surface) ? (op) <= CAIRO_OPERATOR_HSL_LUMINOSITY : (op) <= CAIRO_OPERATOR_SATURATE)
+#else
+#define CAIRO_SURFACE_RENDER_SUPPORTS_OPERATOR(surface, op) \
+     ((op) <= CAIRO_OPERATOR_SATURATE)
+#endif
+
 static cairo_surface_t *
 _cairo_xlib_surface_create_similar_with_format (void	       *abstract_src,
 						cairo_format_t	format,
@@ -327,8 +337,6 @@ _cairo_xlib_surface_finish (void *abstract_surface)
     return status;
 }
 
-#define CAIRO_SURFACE_RENDER_SUPPORTS_OPERATOR(surface, op)	((op) <= CAIRO_OPERATOR_SATURATE)
-
 static int
 _noop_error_handler (Display     *display,
 		     XErrorEvent *event)
@@ -1734,24 +1742,58 @@ _render_operator (cairo_operator_t op)
     case CAIRO_OPERATOR_SATURATE:
 	return PictOpSaturate;
 
+#if RENDER_MAJOR > 0 || RENDER_MINOR >= 11
     case CAIRO_OPERATOR_MULTIPLY:
+	return PictOpMultiply;
     case CAIRO_OPERATOR_SCREEN:
+	return PictOpScreen;
     case CAIRO_OPERATOR_OVERLAY:
+	return PictOpOverlay;
     case CAIRO_OPERATOR_DARKEN:
+	return PictOpDarken;
     case CAIRO_OPERATOR_LIGHTEN:
+	return PictOpLighten;
     case CAIRO_OPERATOR_COLOR_DODGE:
+	return PictOpColorDodge;
     case CAIRO_OPERATOR_COLOR_BURN:
+	return PictOpColorBurn;
     case CAIRO_OPERATOR_HARD_LIGHT:
+	return PictOpHardLight;
     case CAIRO_OPERATOR_SOFT_LIGHT:
+	return PictOpSoftLight;
     case CAIRO_OPERATOR_DIFFERENCE:
+	return PictOpDifference;
     case CAIRO_OPERATOR_EXCLUSION:
+	return PictOpExclusion;
     case CAIRO_OPERATOR_HSL_HUE:
+	return PictOpHSLHue;
     case CAIRO_OPERATOR_HSL_SATURATION:
+	return PictOpHSLSaturation;
     case CAIRO_OPERATOR_HSL_COLOR:
+	return PictOpHSLColor;
     case CAIRO_OPERATOR_HSL_LUMINOSITY:
-	ASSERT_NOT_REACHED;
+	return PictOpHSLLuminosity;
+#else
+    case CAIRO_OPERATOR_MULTIPLY:
+    case CAIRO_OPERATOR_SCREEN:
+    case CAIRO_OPERATOR_OVERLAY:
+    case CAIRO_OPERATOR_DARKEN:
+    case CAIRO_OPERATOR_LIGHTEN:
+    case CAIRO_OPERATOR_COLOR_DODGE:
+    case CAIRO_OPERATOR_COLOR_BURN:
+    case CAIRO_OPERATOR_HARD_LIGHT:
+    case CAIRO_OPERATOR_SOFT_LIGHT:
+    case CAIRO_OPERATOR_DIFFERENCE:
+    case CAIRO_OPERATOR_EXCLUSION:
+    case CAIRO_OPERATOR_HSL_HUE:
+    case CAIRO_OPERATOR_HSL_SATURATION:
+    case CAIRO_OPERATOR_HSL_COLOR:
+    case CAIRO_OPERATOR_HSL_LUMINOSITY:
+	/* silence the compiler */
+#endif
 
     default:
+	ASSERT_NOT_REACHED;
 	return PictOpOver;
     }
 }


More information about the cairo-commit mailing list