summaryrefslogtreecommitdiff
path: root/render/picture.c
diff options
context:
space:
mode:
authorAdam Jackson <ajax@nwnk.net>2006-02-13 18:09:51 +0000
committerAdam Jackson <ajax@nwnk.net>2006-02-13 18:09:51 +0000
commit4a7f6f53cad541e8c5042a6472e3b3886fc9b7e6 (patch)
tree9a6b8c54e0a3fccb57a618b0dce8852b27bd54b1 /render/picture.c
parent28ced9f3e0dd4bd81067f590a1d64ba0844edb06 (diff)
Further op reduction when both src and dst alpha are absent.
Diffstat (limited to 'render/picture.c')
-rw-r--r--render/picture.c40
1 files changed, 35 insertions, 5 deletions
diff --git a/render/picture.c b/render/picture.c
index 5b7b44b44..c146ce3fd 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -1666,10 +1666,41 @@ FreePictFormat (pointer pPictFormat,
static Bool
ReduceCompositeOp (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst)
{
+ Bool no_src_alpha, no_dst_alpha;
+
+ no_src_alpha = PICT_FORMAT_COLOR(pSrc->format) &&
+ PICT_FORMAT_A(pSrc->format) == 0 &&
+ pSrc->alphaMap == NULL &&
+ pMask == NULL;
+ no_dst_alpha = PICT_FORMAT_COLOR(pDst->format) &&
+ PICT_FORMAT_A(pDst->format) == 0 &&
+ pDst->alphaMap == NULL;
+
+ /* TODO, maybe: Conjoint and Disjoint op reductions? */
+
+ /*
+ * Deal with simplifications where both source and destination alpha are
+ * always 1. Note the (intentional) fallthrough to the later stages.
+ */
+ if (no_src_alpha && no_dst_alpha)
+ {
+ switch (op) {
+ case PictOpAtop:
+ op = PictOpSrc;
+ break;
+ case PictOpAtopReverse:
+ op = PictOpDst;
+ break;
+ case PictOpXor:
+ op = PictOpClear;
+ break;
+ default:
+ break;
+ }
+ }
+
/* Deal with simplifications where the source alpha is always 1. */
- if (PICT_FORMAT_COLOR(pSrc->format) &&
- PICT_FORMAT_A(pSrc->format) == 0 && pSrc->alphaMap == NULL &&
- pMask == NULL)
+ if (no_src_alpha)
{
switch (op) {
case PictOpOver:
@@ -1696,8 +1727,7 @@ ReduceCompositeOp (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst)
}
/* Deal with simplifications when the destination alpha is always 1 */
- if (PICT_FORMAT_COLOR(pDst->format) &&
- PICT_FORMAT_A(pDst->format) == 0 && pDst->alphaMap == NULL)
+ if (no_dst_alpha)
{
switch (op) {
case PictOpOverReverse: