Only apply the workaround if the clip region extends beyond the drawable.
authorSøren Sandmann Pedersen <sandmann@redhat.com>
Tue, 21 Jul 2009 04:17:15 +0000 (00:17 -0400)
committerSøren Sandmann Pedersen <sandmann@redhat.com>
Tue, 21 Jul 2009 05:27:46 +0000 (01:27 -0400)
This works because the X server always attempts to set a clip region
within the bounds of the drawable, and it only fails at it when it is
computing the wrong translation and therefore needs the workaround.

pixman/pixman-bits-image.c

index be28ebc..ff29620 100644 (file)
@@ -809,25 +809,18 @@ source_image_needs_out_of_bounds_workaround (bits_image_t *image)
        image->common.have_clip_region                  &&
         out_of_bounds_workaround)
     {
-       const pixman_box32_t *boxes;
-       int n;
-
        if (!image->common.client_clip)
        {
            /* There is no client clip, so the drawable in question
-            * is a window if the clip region is different from the
-            * full drawable
+            * is a window if the clip region extends beyond the
+            * drawable geometry.
             */
-           boxes = pixman_region32_rectangles (&image->common.clip_region, &n);
-           if (n == 1)
+           const pixman_box32_t *extents = pixman_region32_extents (&image->common.clip_region);
+
+           if (extents->x1 >= 0 && extents->x2 < image->width &&
+               extents->y1 >= 0 && extents->y2 < image->height)
            {
-               if (boxes[0].x1 == 0 && boxes[0].y1 == 0 &&
-                   boxes[0].x2 == image->width &&
-                   boxes[0].y2 == image->height)
-               {
-                   /* pixmap */
-                   return FALSE;
-               }
+               return FALSE;
            }
        }