summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-10-14 11:51:44 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2011-10-14 11:51:44 +0100
commite5e27528ffeb74f404823c678e04e847cf2109aa (patch)
tree52b7831ce1b3a346e18a903c31093eb223125096
parent3f5289b29962c3e5d94deb30782a156292d20053 (diff)
sna/blt: Add a pair of operator reductions for opaque fills
Extend the coverage of the BLT for a couple more composite operations, though they be relatively infrequent. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_blt.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/sna/sna_blt.c b/src/sna/sna_blt.c
index 1375a7a3..9d847474 100644
--- a/src/sna/sna_blt.c
+++ b/src/sna/sna_blt.c
@@ -580,6 +580,20 @@ pixel_is_opaque(uint32_t pixel, uint32_t format)
}
static Bool
+pixel_is_white(uint32_t pixel, uint32_t format)
+{
+ switch (PICT_FORMAT_TYPE(format)) {
+ case PICT_TYPE_A:
+ case PICT_TYPE_ARGB:
+ case PICT_TYPE_ABGR:
+ case PICT_TYPE_BGRA:
+ return pixel == ((1 << PICT_FORMAT_BPP(format)) - 1);
+ default:
+ return FALSE;
+ }
+}
+
+static Bool
is_opaque_solid(PicturePtr picture)
{
if (picture->pSourcePict) {
@@ -589,6 +603,16 @@ is_opaque_solid(PicturePtr picture)
return pixel_is_opaque(get_pixel(picture), picture->format);
}
+static Bool
+is_white(PicturePtr picture)
+{
+ if (picture->pSourcePict) {
+ PictSolidFill *fill = (PictSolidFill *) picture->pSourcePict;
+ return fill->color == 0xffffffff;
+ } else
+ return pixel_is_white(get_pixel(picture), picture->format);
+}
+
fastcall
static void blt_fill_composite(struct sna *sna,
const struct sna_composite_op *op,
@@ -1096,6 +1120,10 @@ sna_blt_composite(struct sna *sna,
if (is_solid(src)) {
if (op == PictOpOver && is_opaque_solid(src))
op = PictOpSrc;
+ if (op == PictOpAdd && is_white(src))
+ op = PictOpSrc;
+ if (op == PictOpOutReverse && is_opaque_solid(src))
+ return prepare_blt_clear(sna, tmp);
if (op != PictOpSrc) {
DBG(("%s: unsuported op [%d] for blitting\n",