diff options
author | Søren Sandmann Pedersen <ssp@redhat.com> | 2010-08-09 20:54:49 -0400 |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@redhat.com> | 2010-08-16 06:28:23 -0400 |
commit | da6f33a798bf2ea10df610ccf1d9506d63d1a28c (patch) | |
tree | b458ac4a3d9e154665e85e6618e43393debe489f | |
parent | 4e5d6f00bf409259ff6f5d5c3ef4b016146bcbb3 (diff) |
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.
-rw-r--r-- | pixman/pixman-image.c | 10 | ||||
-rw-r--r-- | pixman/pixman-private.h | 1 | ||||
-rw-r--r-- | pixman/pixman.c | 11 |
3 files changed, 18 insertions, 4 deletions
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 |