Only try to compute the FAST_SAMPLES_COVER_CLIP for bits images
authorSøren Sandmann Pedersen <ssp@redhat.com>
Mon, 16 Aug 2010 11:24:48 +0000 (07:24 -0400)
committerSøren Sandmann Pedersen <ssp@redhat.com>
Sat, 21 Aug 2010 10:29:36 +0000 (06:29 -0400)
It doesn't make sense in other cases, and the computation would make
use of image->bits.{width,height} which lead to uninitialized memory
accesses when the image wasn't of type BITS.

pixman/pixman.c

index 55c5981..ddd4935 100644 (file)
@@ -787,14 +787,17 @@ analyze_extent (pixman_image_t *image, int x, int y,
     if (!compute_sample_extents (transform, &ex, x, y, x_off, y_off, width, height))
        return FALSE;
 
-    /* Check whether the non-expanded, transformed extent is entirely within
-     * the source image, and set the FAST_PATH_SAMPLES_COVER_CLIP if it is.
-     */
-    ex = *extents;
-    if (compute_sample_extents (transform, &ex, x, y, x_off, y_off, width, height))
+    if (image->type == BITS)
     {
-       if (ex.x1 >= 0 && ex.y1 >= 0 && ex.x2 <= image->bits.width && ex.y2 <= image->bits.height)
-           *flags |= FAST_PATH_SAMPLES_COVER_CLIP;
+       /* Check whether the non-expanded, transformed extent is entirely within
+        * the source image, and set the FAST_PATH_SAMPLES_COVER_CLIP if it is.
+        */
+       ex = *extents;
+       if (compute_sample_extents (transform, &ex, x, y, x_off, y_off, width, height))
+       {
+           if (ex.x1 >= 0 && ex.y1 >= 0 && ex.x2 <= image->bits.width && ex.y2 <= image->bits.height)
+               *flags |= FAST_PATH_SAMPLES_COVER_CLIP;
+       }
     }
 
     return TRUE;