Introduce new FAST_PATH_SAMPLES_OPAQUE flag
authorSøren Sandmann Pedersen <ssp@redhat.com>
Tue, 10 Aug 2010 00:54:49 +0000 (20:54 -0400)
committerSøren Sandmann Pedersen <ssp@redhat.com>
Mon, 16 Aug 2010 10:28:23 +0000 (06:28 -0400)
This flag is set whenever the pixels of a bits image don't have an
alpha channel. Together with FAST_PATH_SAMPLES_COVER_CLIP it implies
that the image effectively is opaque, so we can do operator reductions
such as OVER->SRC.

pixman/pixman-image.c
pixman/pixman-private.h
pixman/pixman.c

index cdc9c40..cfee865 100644 (file)
@@ -409,12 +409,14 @@ compute_image_info (pixman_image_t *image)
            }
        }
 
-       if (image->common.repeat != PIXMAN_REPEAT_NONE                          &&
-           !PIXMAN_FORMAT_A (image->bits.format)                               &&
+       if (!PIXMAN_FORMAT_A (image->bits.format)                               &&
            PIXMAN_FORMAT_TYPE (image->bits.format) != PIXMAN_TYPE_GRAY         &&
            PIXMAN_FORMAT_TYPE (image->bits.format) != PIXMAN_TYPE_COLOR)
        {
-           flags |= FAST_PATH_IS_OPAQUE;
+           flags |= FAST_PATH_SAMPLES_OPAQUE;
+
+           if (image->common.repeat != PIXMAN_REPEAT_NONE)
+               flags |= FAST_PATH_IS_OPAQUE;
        }
 
        if (source_image_needs_out_of_bounds_workaround (&image->bits))
@@ -462,7 +464,7 @@ compute_image_info (pixman_image_t *image)
        image->common.filter == PIXMAN_FILTER_CONVOLUTION       ||
        image->common.component_alpha)
     {
-       flags &= ~FAST_PATH_IS_OPAQUE;
+       flags &= ~(FAST_PATH_IS_OPAQUE | FAST_PATH_SAMPLES_OPAQUE);
     }
 
     image->common.flags = flags;
index c4e6bb8..dedea0b 100644 (file)
@@ -571,6 +571,7 @@ _pixman_choose_implementation (void);
 #define FAST_PATH_BILINEAR_FILTER              (1 << 20)
 #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_PAD_REPEAT                                           \
     (FAST_PATH_NO_NONE_REPEAT          |                               \
index e79e135..55c5981 100644 (file)
@@ -884,6 +884,17 @@ do_composite (pixman_op_t         op,
     if (!analyze_extent (mask, dest_x - mask_x, dest_y - mask_y, extents, &mask_flags))
        goto out;
 
+    /* If the clip is within the source samples, and the samples are opaque,
+     * then the source is effectively opaque.
+     */
+#define BOTH (FAST_PATH_SAMPLES_OPAQUE | FAST_PATH_SAMPLES_COVER_CLIP)
+
+    if ((src_flags & BOTH) == BOTH)
+       src_flags |= FAST_PATH_IS_OPAQUE;
+    
+    if ((mask_flags & BOTH) == BOTH)
+       mask_flags |= FAST_PATH_IS_OPAQUE;
+    
     /*
      * Check if we can replace our operator by a simpler one
      * if the src or dest are opaque. The output operator should be