[Pixman] [PATCH 1/3] Add new FAST_PATH_UNCOMPOSITABLE flag

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


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

This is set if the image can't be used for compositing, such as when
it's bigger than 0xffff or has size 0.
---
 pixman/pixman-image.c   |   10 ++++++++++
 pixman/pixman-private.h |    1 +
 pixman/pixman.c         |   10 +++-------
 3 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c
index 029a1df..512142d 100644
--- a/pixman/pixman-image.c
+++ b/pixman/pixman-image.c
@@ -398,6 +398,16 @@ compute_image_info (pixman_image_t *image)
 	{
 	    code = image->bits.format;
 
+	    /* 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 == 0      || image->bits.height == 0 ||
+		image->bits.width >= 0xffff || image->bits.height >= 0xffff)
+	    {
+		flags |= FAST_PATH_UNCOMPOSITABLE;
+	    }
+	    
 	    if (!image->common.transform &&
 		image->common.repeat == PIXMAN_REPEAT_NORMAL)
 	    {
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index d85868f..b05a68d 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -572,6 +572,7 @@ _pixman_choose_implementation (void);
 #define FAST_PATH_NO_NORMAL_REPEAT		(1 << 21)
 #define FAST_PATH_HAS_TRANSFORM			(1 << 22)
 #define FAST_PATH_SAMPLES_OPAQUE		(1 << 23)
+#define FAST_PATH_UNCOMPOSITABLE		(1 << 24)
 
 #define FAST_PATH_PAD_REPEAT						\
     (FAST_PATH_NO_NONE_REPEAT		|				\
diff --git a/pixman/pixman.c b/pixman/pixman.c
index 285bbfc..ea048cc 100644
--- a/pixman/pixman.c
+++ b/pixman/pixman.c
@@ -715,13 +715,6 @@ analyze_extent (pixman_image_t *image, int x, int y,
     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 ||
@@ -882,6 +875,9 @@ pixman_image_composite32 (pixman_op_t      op,
     dest_format = dest->common.extended_format_code;
     dest_flags = dest->common.flags;
 
+    if ((src_flags | dest_flags | mask_flags) & FAST_PATH_UNCOMPOSITABLE)
+	return;
+    
     /* Check for pixbufs */
     if ((mask_format == PIXMAN_a8r8g8b8 || mask_format == PIXMAN_a8b8g8r8) &&
 	(src->type == BITS && src->bits.bits == mask->bits.bits)	   &&
-- 
1.7.1.1



More information about the Pixman mailing list