Further op reduction when both src and dst alpha are absent.

This commit is contained in:
Adam Jackson 2006-02-13 18:09:51 +00:00
parent 28ced9f3e0
commit 4a7f6f53ca
2 changed files with 40 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2006-02-13 Adam Jackson <ajax@freedesktop.org>
* render/picture.c:
Further op reduction when both src and dst alpha are absent.
2006-02-13 Benjamin Herrenschmidt <benh@kernel.crashing.org>
* Xprint/Util.c: (XpOpenTmpFile):

View File

@ -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: