Index: src/ic.c =================================================================== RCS file: /cvs/cairo/libpixman/src/ic.c,v retrieving revision 1.20 diff -u -p -r1.20 ic.c --- src/ic.c 27 Apr 2005 20:02:20 -0000 1.20 +++ src/ic.c 10 Jun 2005 08:25:46 -0000 @@ -852,6 +852,138 @@ pixman_compositeSolidMask_nx1xn (pixman_ 0x0); } +static void +pixman_compositeSolidMaskIn_nx8x8 (pixman_operator_t op, + pixman_image_t *iSrc, + pixman_image_t *iMask, + pixman_image_t *iDst, + int16_t xSrc, + int16_t ySrc, + int16_t xMask, + int16_t yMask, + int16_t xDst, + int16_t yDst, + uint16_t width, + uint16_t height) +{ + uint32_t src, srca; + uint8_t *dstLine, *dst, dstMask; + uint8_t *maskLine, *mask, m; + IcStride dstStride, maskStride; + uint16_t w; + uint16_t t; + + IcComposeGetSolid(iSrc, src); + + dstMask = IcFullMask (iDst->pixels->depth); + srca = src >> 24; + + IcComposeGetStart (iDst, xDst, yDst, uint8_t, dstStride, dstLine, 1); + IcComposeGetStart (iMask, xMask, yMask, uint8_t, maskStride, maskLine, 1); + + if (srca == 0xff) { + while (height--) + { + dst = dstLine; + dstLine += dstStride; + mask = maskLine; + maskLine += maskStride; + w = width; + + while (w--) + { + m = *mask++; + if (m == 0) + { + *dst = 0; + } + else if (m != 0xff) + { + *dst = IcIntMult(m, *dst, t); + } + dst++; + } + } + } + else + { + while (height--) + { + dst = dstLine; + dstLine += dstStride; + mask = maskLine; + maskLine += maskStride; + w = width; + + while (w--) + { + m = *mask++; + m = IcIntMult(m, srca, t); + if (m == 0) + { + *dst = 0; + } + else if (m != 0xff) + { + *dst = IcIntMult(m, *dst, t); + } + dst++; + } + } + } +} + + +static void +pixman_compositeSrcIn_8x8 (pixman_operator_t op, + pixman_image_t *iSrc, + pixman_image_t *iMask, + pixman_image_t *iDst, + int16_t xSrc, + int16_t ySrc, + int16_t xMask, + int16_t yMask, + int16_t xDst, + int16_t yDst, + uint16_t width, + uint16_t height) +{ + uint8_t *dstLine, *dst; + uint8_t *srcLine, *src; + IcStride dstStride, srcStride; + uint16_t w; + uint8_t s; + uint16_t t; + + IcComposeGetStart (iSrc, xSrc, ySrc, uint8_t, srcStride, srcLine, 1); + IcComposeGetStart (iDst, xDst, yDst, uint8_t, dstStride, dstLine, 1); + + while (height--) + { + dst = dstLine; + dstLine += dstStride; + src = srcLine; + srcLine += srcStride; + w = width; + + while (w--) + { + s = *src++; + if (s == 0) + { + *dst = 0; + } + else if (s != 0xff) + { + *dst = IcIntMult(s, *dst, t); + } + dst++; + } + } +} + + + void pixman_composite (pixman_operator_t op, pixman_image_t *iSrc, @@ -1071,6 +1203,38 @@ pixman_composite (pixman_operator_t op, } } break; + case PIXMAN_OPERATOR_IN: + if (iMask) + { + if (srcRepeat && + iSrc->pixels->width == 1 && + iSrc->pixels->height == 1) + { + if (PICT_FORMAT_COLOR(iSrc->format_code)) { + switch (iMask->format_code) { + case PICT_a8: + switch (iDst->format_code) { + case PICT_a8: + srcRepeat = 0; + func = pixman_compositeSolidMaskIn_nx8x8; + break; + } + } + } + } + } + else + { + switch (iSrc->format_code) { + case PICT_a8: + switch (iDst->format_code) { + case PICT_a8: + func = pixman_compositeSrcIn_8x8; + break; + } + } + } + break; default: func = pixman_compositeGeneral; break;