[PATCH 1/1] XCB: Fix clip-fill-{eo,nz}-unbounded tests

Uli Schlachter psychon at znc.in
Sat Nov 27 12:52:59 PST 2010


The X server calculates the bounding box for traps and then allocates a
temporary picture for this. When the X server calculates different values than
cairo got in extents->bounded, unbounded operators will have wrong results. The
X server only ever calculates bounds that are larger than the real value.

Fix this by explicitly clipping the drawing to the expected bounds.

Signed-off-by: Uli Schlachter <psychon at znc.in>
---
 src/cairo-xcb-surface-render.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/cairo-xcb-surface-render.c b/src/cairo-xcb-surface-render.c
index 1ec63ca..94e3717 100644
--- a/src/cairo-xcb-surface-render.c
+++ b/src/cairo-xcb-surface-render.c
@@ -2391,6 +2391,7 @@ _clip_and_composite (cairo_xcb_surface_t	*dst,
 {
     cairo_status_t status;
     cairo_region_t *clip_region = NULL;
+    cairo_region_t *region_extents = NULL;
     cairo_bool_t need_clip_surface = FALSE;
 
     if (clip != NULL) {
@@ -2414,6 +2415,14 @@ _clip_and_composite (cairo_xcb_surface_t	*dst,
 	    if (unlikely (is_empty && extents->is_bounded))
 		return CAIRO_STATUS_SUCCESS;
 	}
+    } else if (!extents->is_bounded) {
+	/* The X server will estimate the affected region of the unbounded
+	 * operation and will apply the operation to that rectangle.
+	 * However, there are cases where this estimate is too high (e.g.
+	 * the test suite's clip-fill-{eo,nz}-unbounded tests).
+	 */
+	region_extents = cairo_region_create_rectangle (&extents->unbounded);
+	clip_region = region_extents;
     }
 
     status = _cairo_xcb_connection_acquire (dst->connection);
@@ -2482,6 +2491,7 @@ _clip_and_composite (cairo_xcb_surface_t	*dst,
 
     if (clip_region != NULL)
 	_cairo_xcb_surface_clear_clip_region (dst);
+    cairo_region_destroy (region_extents);
 
     _cairo_xcb_connection_release (dst->connection);
 
-- 
1.7.2.3


--------------030909060606000900090300
Content-Type: application/octet-stream;
 name="0001-XCB-Fix-clip-fill-eo-nz-unbounded-tests.patch.sig"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="0001-XCB-Fix-clip-fill-eo-nz-unbounded-tests.patch.sig"

iQEcBAABCAAGBQJM9AXmAAoJECLkKOvLj8sGy3QH/3M243LAR9D1v1FUk6GqSgCylWrwumCz
HZgICXPl6TFx7RtMrzfvk7etNVgIpwyFudIXkg5w1b+Xx0g8JjjrggwxskqYLtxL20hMNy1L
SVu9j1OvNdSJ9lbN9FTiV1X0ExIRBMxQOYESQSMo2SyEtwoL0Vy2bOnq3Ds9hcueZKjrR9ps
zy+Hz9C/HKN/k6P5ntCuspyUZaVL+H1t7AB1+v760YzCQ40zpYeNPYytWgdk1OG90G+DdbCU
tP4MFaiEg8uFcrL5l0GNqY6TQEiGyPMrcRiEUxXv/lzm4Bpw5rNAuyv8gkB3O2RwU9kx2Rcb
vRQX+6pwcgSsTwk7ckQtG6E=
--------------030909060606000900090300--


More information about the cairo mailing list