[PATCH 1/5] xlib, xcb: Hand off EXTEND_PAD/EXTEND_REFLECT to Render

Thomas Jaeger ThJaeger at gmail.com
Thu Feb 19 09:02:41 PST 2009


---
 src/cairo-xcb-surface.c  |   17 +++++++++++++++--
 src/cairo-xlib-surface.c |   12 ++++++++++++
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c
index 8d0090b..2819653 100644
--- a/src/cairo-xcb-surface.c
+++ b/src/cairo-xcb-surface.c
@@ -101,6 +101,8 @@ typedef struct cairo_xcb_surface {
 
 #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_REPEAT_PAD(surface)	CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 10)
+#define CAIRO_SURFACE_RENDER_HAS_REPEAT_REFLECT(surface)	CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 10)
 
 static void
 _cairo_xcb_surface_ensure_gc (cairo_xcb_surface_t *surface);
@@ -839,13 +841,24 @@ _cairo_xcb_surface_set_attributes (cairo_xcb_surface_t	      *surface,
 
     switch (attributes->extend) {
     case CAIRO_EXTEND_NONE:
-	_cairo_xcb_surface_set_repeat (surface, 0);
+	_cairo_xcb_surface_set_repeat (surface, XCB_RENDER_REPEAT_NONE);
 	break;
     case CAIRO_EXTEND_REPEAT:
-	_cairo_xcb_surface_set_repeat (surface, 1);
+	_cairo_xcb_surface_set_repeat (surface, XCB_RENDER_REPEAT_NORMAL);
 	break;
     case CAIRO_EXTEND_REFLECT:
+	if (CAIRO_SURFACE_RENDER_HAS_REPEAT_REFLECT(surface))
+	    _cairo_xcb_surface_set_repeat (surface, XCB_RENDER_REPEAT_REFLECT);
+	else
+	    return CAIRO_INT_STATUS_UNSUPPORTED;
+	break;
     case CAIRO_EXTEND_PAD:
+	if (CAIRO_SURFACE_RENDER_HAS_REPEAT_PAD(surface))
+	    _cairo_xcb_surface_set_repeat (surface, XCB_RENDER_REPEAT_PAD);
+	else
+	    return CAIRO_INT_STATUS_UNSUPPORTED;
+	break;
+    default:
 	return CAIRO_INT_STATUS_UNSUPPORTED;
     }
 
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index b56b340..7d2032d 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -123,6 +123,8 @@ 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_REPEAT_PAD(surface)	CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 10)
+#define CAIRO_SURFACE_RENDER_HAS_REPEAT_REFLECT(surface)	CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 10)
 
 static cairo_surface_t *
 _cairo_xlib_surface_create_similar_with_format (void	       *abstract_src,
@@ -1446,7 +1448,17 @@ _cairo_xlib_surface_set_attributes (cairo_xlib_surface_t	    *surface,
 	_cairo_xlib_surface_set_repeat (surface, RepeatNormal);
 	break;
     case CAIRO_EXTEND_REFLECT:
+	if (CAIRO_SURFACE_RENDER_HAS_REPEAT_REFLECT(surface))
+	    _cairo_xlib_surface_set_repeat (surface, RepeatReflect);
+	else
+	    return CAIRO_INT_STATUS_UNSUPPORTED;
+	break;
     case CAIRO_EXTEND_PAD:
+	if (CAIRO_SURFACE_RENDER_HAS_REPEAT_PAD(surface))
+	    _cairo_xlib_surface_set_repeat (surface, RepeatPad);
+	else
+	    return CAIRO_INT_STATUS_UNSUPPORTED;
+	break;
     default:
 	return CAIRO_INT_STATUS_UNSUPPORTED;
     }
-- 
1.6.3


--------------010101010805020406070805
Content-Type: text/x-patch;
 name="0002-pattern-Use-pixman-for-REPEAT_PAD.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="0002-pattern-Use-pixman-for-REPEAT_PAD.patch"



More information about the cairo mailing list