commit 55aa03c08525ca04cb2d434e4d60944eb93cea63 Author: Owen W. Taylor Date: Sat Apr 5 14:11:30 2008 -0400 Don't reduce OpOver to OpSrc unconditionally for RepeatNone. Only do no-source-alpha optimizations for a RepeatNone source if we can easily prove that we won't sample outside the edges of the source. http://bugs.freedesktop.org/show_bug.cgi?id=15369 diff --git a/render/picture.c b/render/picture.c index 35e2a28..7710179 100644 --- a/render/picture.c +++ b/render/picture.c @@ -1547,12 +1547,24 @@ FreePictFormat (pointer pPictFormat, * being careful to avoid these cases. */ static CARD8 -ReduceCompositeOp (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst) +ReduceCompositeOp (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, + INT16 xSrc, INT16 ySrc, CARD16 width, CARD16 height) { Bool no_src_alpha, no_dst_alpha; + /* Sampling off the edge of a RepeatNone picture introduces alpha + * even if the picture itself doesn't have alpha. We don't try to + * detect every case where we don't sample off the edge, just the + * simplest case where there is no transform on the source + * picture. + */ no_src_alpha = PICT_FORMAT_COLOR(pSrc->format) && PICT_FORMAT_A(pSrc->format) == 0 && + (pSrc->repeatType != RepeatNone || + (!pSrc->transform && + xSrc >= 0 && ySrc >= 0 && + xSrc + width <= pSrc->pDrawable->width && + ySrc + height <= pSrc->pDrawable->height)) && pSrc->alphaMap == NULL && pMask == NULL; no_dst_alpha = PICT_FORMAT_COLOR(pDst->format) && @@ -1654,7 +1666,7 @@ CompositePicture (CARD8 op, ValidatePicture (pMask); ValidatePicture (pDst); - op = ReduceCompositeOp (op, pSrc, pMask, pDst); + op = ReduceCompositeOp (op, pSrc, pMask, pDst, xSrc, ySrc, width, height); if (op == PictOpDst) return;