Work around X server bug.
authorSøren Sandmann Pedersen <sandmann@redhat.com>
Wed, 10 Jun 2009 12:52:31 +0000 (08:52 -0400)
committerSøren Sandmann Pedersen <sandmann@redhat.com>
Sat, 13 Jun 2009 14:20:19 +0000 (10:20 -0400)
X servers prior to

ebfd6688d1927288155221e7a78fbca9f9293952

relied on pixman not clipping to destination geometry whenever an
explicit clip region was set. Since only X servers set
source_clipping, we can just trigger off of that.

TODO
pixman/pixman-compute-region.c

diff --git a/TODO b/TODO
index 6abeb0b..52d7377 100644 (file)
--- a/TODO
+++ b/TODO
@@ -14,6 +14,8 @@
         the required precision by simply adding offset_x/y to the
         relevant rendering API?
 
+      - Get rid of workaround for X server bug.
+
       - pixman_image_set_indexed() should copy its argument, and X
         should be ported over to use a pixman_image as the
         representation of a Picture, rather than creating one on each
index 70ffa3f..72fd9e8 100644 (file)
@@ -136,8 +136,17 @@ pixman_compute_composite_region32 (pixman_region32_t *     pRegion,
 
     pRegion->extents.x1 = MAX (pRegion->extents.x1, 0);
     pRegion->extents.y1 = MAX (pRegion->extents.y1, 0);
-    pRegion->extents.x2 = MIN (pRegion->extents.x2, pDst->bits.width);
-    pRegion->extents.y2 = MIN (pRegion->extents.y2, pDst->bits.height);
+    
+    /* Some X servers rely on an old bug, where pixman would just believe the
+     * set clip_region and not clip against the destination geometry. So, 
+     * since only X servers set "source clip", we only clip against destination
+     * geometry when that is set.
+     */
+    if (!pDst->common.clip_sources)
+    {
+       pRegion->extents.x2 = MIN (pRegion->extents.x2, pDst->bits.width);
+       pRegion->extents.y2 = MIN (pRegion->extents.y2, pDst->bits.height);
+    }
     
     pRegion->data = 0;