From: Søren Sandmann Pedersen Date: Tue, 10 Aug 2010 00:54:49 +0000 (-0400) Subject: Introduce new FAST_PATH_SAMPLES_OPAQUE flag X-Git-Tag: pixman-0.19.2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=da6f33a798bf2ea10df610ccf1d9506d63d1a28c;p=platform%2Fupstream%2Fpixman.git Introduce new FAST_PATH_SAMPLES_OPAQUE flag 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. --- diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c index cdc9c40..cfee865 100644 --- a/pixman/pixman-image.c +++ b/pixman/pixman-image.c @@ -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; diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h index c4e6bb8..dedea0b 100644 --- a/pixman/pixman-private.h +++ b/pixman/pixman-private.h @@ -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 | \ diff --git a/pixman/pixman.c b/pixman/pixman.c index e79e135..55c5981 100644 --- a/pixman/pixman.c +++ b/pixman/pixman.c @@ -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