From 64e25c0215f38f8ced823a3a83cb5a384e83929c Mon Sep 17 00:00:00 2001
From: Massimo Valentini <mvalentini@src.gnome.org>
Date: Wed, 24 Sep 2014 17:08:10 +0200
Subject: [PATCH] fix clip-polygons.xcb-render-0_0.argb32

---
 src/cairo-xcb-surface-render.c | 48 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/src/cairo-xcb-surface-render.c b/src/cairo-xcb-surface-render.c
index 0f297b5..83e1aad 100644
--- a/src/cairo-xcb-surface-render.c
+++ b/src/cairo-xcb-surface-render.c
@@ -1691,6 +1691,54 @@ get_clip_surface (const cairo_clip_t *clip,
     cairo_surface_t *surface;
     cairo_status_t status;
 
+    if (clip->path && clip->path->prev) {
+	cairo_surface_t *image;
+
+	surface = _cairo_xcb_surface_create_similar (target,
+						     CAIRO_CONTENT_ALPHA,
+						     clip->extents.width,
+						     clip->extents.height);
+	if (unlikely (surface->status))
+	  return (cairo_xcb_surface_t *) surface;
+
+	((cairo_xcb_surface_t *)surface)->deferred_clear_color = *CAIRO_COLOR_TRANSPARENT;
+	((cairo_xcb_surface_t *)surface)->deferred_clear = TRUE;
+	surface->is_clear = TRUE;
+
+	image = cairo_surface_create_similar_image (surface,
+						    CAIRO_FORMAT_A8,
+						    clip->extents.width,
+						    clip->extents.height);
+	status = image->status;
+
+	if (status == CAIRO_STATUS_SUCCESS) {
+	    cairo_clip_t *copy = _cairo_clip_copy_with_translation (clip,
+								    -clip->extents.x,
+								    -clip->extents.y);
+
+	    status = _cairo_surface_paint (image, CAIRO_OPERATOR_ADD,
+					   &_cairo_pattern_white.base,
+					   copy);
+
+	    _cairo_image_surface_set_parent (to_image_surface (image),
+					     cairo_surface_reference (surface));
+
+	    cairo_surface_unmap_image (surface, image);
+
+	    _cairo_clip_destroy (copy);
+	}
+
+	if (unlikely (status)) {
+	    cairo_surface_destroy (surface);
+	    surface = _cairo_surface_create_in_error (status);
+	}
+
+	*tx = clip->extents.x;
+	*ty = clip->extents.y;
+
+	return (cairo_xcb_surface_t *) surface;
+    }
+
     surface = _cairo_surface_create_scratch (&target->base,
 					    CAIRO_CONTENT_ALPHA,
 					    clip->extents.width,
-- 
1.9.3

