[Pixman] [PATCH] Introduce new FAST_PATH_SAMPLES_OPAQUE flag
Søren Sandmann Pedersen
sandmann at daimi.au.dk
Mon Aug 9 18:23:26 PDT 2010
From: Søren Sandmann Pedersen <ssp at redhat.com>
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 | 10 ++++++----
pixman/pixman-private.h | 1 +
pixman/pixman.c | 11 +++++++++++
3 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c
index 0b8bb3c..0e3601f 100644
--- a/pixman/pixman-image.c
+++ b/pixman/pixman-image.c
@@ -406,12 +406,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))
@@ -459,7 +461,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
--
1.7.1.1
More information about the Pixman
mailing list