[Pixman] [PATCH 0/6] Improvements for the nearest scaling, second try

Soeren Sandmann sandmann at daimi.au.dk
Mon Sep 20 15:07:52 PDT 2010


Siarhei Siamashka <siarhei.siamashka at gmail.com> writes:

> Also the new flags are being introduced or changed from time to time, like in
> this patch:
> http://lists.freedesktop.org/archives/pixman/2010-September/000531.html

Actually, I changed my mind regarding that patch. It wasn't really
correct to reject destinations bigger than 0xffff x 0xffff. So the
latest version of the following patch looks a little different (see
below).

But in general, I don't think conflicts can be avoide. Generally, it's
fine to just fix them before committing. There is no need to send the
patches to the list again.


Soren


commit f866c08f1a62c96d3b2739fae3be573ee4866c4b
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date:   Thu Sep 16 08:35:05 2010 -0400

    Move some of the FAST_PATH_COVERS_CLIP computation to pixman-image.c
    
    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.

diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c
index 029a1df..8397f6a 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 285bbfc..72779c8 100644
--- a/pixman/pixman.c
+++ b/pixman/pixman.c
@@ -708,29 +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)
-    {
-	/* During repeat mode calculations we might convert the
-	 * width/height of an image to fixed 16.16, so we need
-	 * them to be smaller than 16 bits.
-	 */
-	if (image->bits.width >= 0x7fff	|| image->bits.height >= 0x7fff)
-	    return FALSE;
-
-	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
@@ -746,6 +726,13 @@ analyze_extent (pixman_image_t *image, int x, int y,
 
     if (image->common.type == BITS)
     {
+	/* During repeat mode calculations we might convert the
+	 * width/height of an image to fixed 16.16, so we need
+	 * them to be smaller than 16 bits.
+	 */
+	if (image->bits.width >= 0x7fff	|| image->bits.height >= 0x7fff)
+	    return FALSE;
+
 	switch (image->common.filter)
 	{
 	case PIXMAN_FILTER_CONVOLUTION:
@@ -786,14 +773,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;
 
@@ -806,7 +795,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);
 	}
     }
 


More information about the Pixman mailing list