[Pixman] [PATCH 2/3] Move some of the FAST_PATH_COVERS_CLIP computation to pixman-image.c

Søren Sandmann sandmann at daimi.au.dk
Thu Sep 16 06:53:40 PDT 2010


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

When an image is solid or repeating, the FAST_PATH_COVERS_CLIP flag
can be set in compute_image_info().

Also the code that turned this flag off in pixman.c was not correct;
it didn't take transformations into account. With this patch, pixman.c
doesn't set the flag by default, but instead relies on the call to
compute_samples_extents() to set it when possible.
---
 pixman/pixman-image.c |   25 +++++++++++++++++++++----
 pixman/pixman.c       |   21 +++++----------------
 2 files changed, 26 insertions(+), 20 deletions(-)

diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c
index 512142d..8d92dd9 100644
--- a/pixman/pixman-image.c
+++ b/pixman/pixman-image.c
@@ -353,19 +353,34 @@ compute_image_info (pixman_image_t *image)
     switch (image->common.repeat)
     {
     case PIXMAN_REPEAT_NONE:
-	flags |= FAST_PATH_NO_REFLECT_REPEAT | FAST_PATH_NO_PAD_REPEAT | FAST_PATH_NO_NORMAL_REPEAT;
+	flags |=
+	    FAST_PATH_NO_REFLECT_REPEAT		|
+	    FAST_PATH_NO_PAD_REPEAT		|
+	    FAST_PATH_NO_NORMAL_REPEAT;
 	break;
 
     case PIXMAN_REPEAT_REFLECT:
-	flags |= FAST_PATH_NO_PAD_REPEAT | FAST_PATH_NO_NONE_REPEAT | FAST_PATH_NO_NORMAL_REPEAT;
+	flags |=
+	    FAST_PATH_NO_PAD_REPEAT		|
+	    FAST_PATH_NO_NONE_REPEAT		|
+	    FAST_PATH_NO_NORMAL_REPEAT		|
+	    FAST_PATH_COVERS_CLIP;
 	break;
 
     case PIXMAN_REPEAT_PAD:
-	flags |= FAST_PATH_NO_REFLECT_REPEAT | FAST_PATH_NO_NONE_REPEAT | FAST_PATH_NO_NORMAL_REPEAT;
+	flags |=
+	    FAST_PATH_NO_REFLECT_REPEAT		|
+	    FAST_PATH_NO_NONE_REPEAT		|
+	    FAST_PATH_NO_NORMAL_REPEAT		|
+	    FAST_PATH_COVERS_CLIP;
 	break;
 
     default:
-	flags |= FAST_PATH_NO_REFLECT_REPEAT | FAST_PATH_NO_PAD_REPEAT | FAST_PATH_NO_NONE_REPEAT;
+	flags |=
+	    FAST_PATH_NO_REFLECT_REPEAT		|
+	    FAST_PATH_NO_PAD_REPEAT		|
+	    FAST_PATH_NO_NONE_REPEAT		|
+	    FAST_PATH_COVERS_CLIP;
 	break;
     }
 
@@ -385,6 +400,8 @@ compute_image_info (pixman_image_t *image)
 
 	if (image->solid.color.alpha == 0xffff)
 	    flags |= FAST_PATH_IS_OPAQUE;
+
+	flags |= FAST_PATH_COVERS_CLIP;
 	break;
 
     case BITS:
diff --git a/pixman/pixman.c b/pixman/pixman.c
index ea048cc..bf7de7d 100644
--- a/pixman/pixman.c
+++ b/pixman/pixman.c
@@ -708,22 +708,9 @@ analyze_extent (pixman_image_t *image, int x, int y,
     pixman_fixed_t width, height;
     pixman_box32_t ex;
 
-    *flags |= FAST_PATH_COVERS_CLIP;
     if (!image)
 	return TRUE;
 
-    transform = image->common.transform;
-    if (image->common.type == BITS)
-    {
-	if (image->common.repeat == PIXMAN_REPEAT_NONE &&
-	    (x > extents->x1 || y > extents->y1 ||
-	     x + image->bits.width < extents->x2 ||
-	     y + image->bits.height < extents->y2))
-	{
-	    (*flags) &= ~FAST_PATH_COVERS_CLIP;
-	}
-    }
-
     /* Some compositing functions walk one step
      * outside the destination rectangle, so we
      * check here that the expanded-by-one source
@@ -779,14 +766,16 @@ analyze_extent (pixman_image_t *image, int x, int y,
     }
 
     /* Check that the extents expanded by one don't overflow. This ensures that
-     * compositing functions can simply walk the source space using 16.16 variables
-     * without worrying about overflow.
+     * compositing functions can simply walk the source space using 16.16
+     * variables without worrying about overflow.
      */
     ex.x1 = extents->x1 - 1;
     ex.y1 = extents->y1 - 1;
     ex.x2 = extents->x2 + 1;
     ex.y2 = extents->y2 + 1;
 
+    transform = image->common.transform;
+
     if (!compute_sample_extents (transform, &ex, x, y, x_off, y_off, width, height))
 	return FALSE;
 
@@ -799,7 +788,7 @@ analyze_extent (pixman_image_t *image, int x, int y,
 	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;
+		*flags |= (FAST_PATH_SAMPLES_COVER_CLIP | FAST_PATH_COVERS_CLIP);
 	}
     }
 
-- 
1.7.1.1



More information about the Pixman mailing list