[Pixman] [PATCH] Only try to compute the FAST_SAMPLES_COVER_CLIP for bits images

Søren Sandmann Pedersen sandmann at daimi.au.dk
Mon Aug 16 04:28:30 PDT 2010


From: Søren Sandmann Pedersen <ssp at redhat.com>

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 |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/pixman/pixman.c b/pixman/pixman.c
index 55c5981..ddd4935 100644
--- a/pixman/pixman.c
+++ b/pixman/pixman.c
@@ -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;
-- 
1.7.1.1



More information about the Pixman mailing list