diff options
author | Soren Sandmann Pedersen <sandmann@redhat.com> | 2007-05-21 20:00:25 -0400 |
---|---|---|
committer | Soren Sandmann Pedersen <sandmann@redhat.com> | 2007-05-21 20:00:25 -0400 |
commit | 56fd92715567cd32e4b725b3791de9ac4e3879aa (patch) | |
tree | 4e569de7a4f22f7f194b8a0fa1568b93c84dd727 /fb | |
parent | 7e2c935920cafadbd87c351f1a3239932864fb90 (diff) |
Remove fast path code from fbpict.c
Remove the various fast path functions from fbpict, and instead use
pixman_image_composite().
Diffstat (limited to 'fb')
-rw-r--r-- | fb/fbpict.c | 1529 | ||||
-rw-r--r-- | fb/fbpict.h | 191 |
2 files changed, 23 insertions, 1697 deletions
diff --git a/fb/fbpict.c b/fb/fbpict.c index 84d19ac29..eb78ceda6 100644 --- a/fb/fbpict.c +++ b/fb/fbpict.c @@ -39,898 +39,6 @@ #include "fbpict.h" #include "fbmmx.h" -CARD32 -fbOver (CARD32 x, CARD32 y) -{ - CARD16 a = ~x >> 24; - CARD16 t; - CARD32 m,n,o,p; - - m = FbOverU(x,y,0,a,t); - n = FbOverU(x,y,8,a,t); - o = FbOverU(x,y,16,a,t); - p = FbOverU(x,y,24,a,t); - return m|n|o|p; -} - -CARD32 -fbOver24 (CARD32 x, CARD32 y) -{ - CARD16 a = ~x >> 24; - CARD16 t; - CARD32 m,n,o; - - m = FbOverU(x,y,0,a,t); - n = FbOverU(x,y,8,a,t); - o = FbOverU(x,y,16,a,t); - return m|n|o; -} - -CARD32 -fbIn (CARD32 x, CARD8 y) -{ - CARD16 a = y; - CARD16 t; - CARD32 m,n,o,p; - - m = FbInU(x,0,a,t); - n = FbInU(x,8,a,t); - o = FbInU(x,16,a,t); - p = FbInU(x,24,a,t); - return m|n|o|p; -} - -/* - * Naming convention: - * - * opSRCxMASKxDST - */ - -void -fbCompositeSolidMask_nx8x8888 (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height) -{ - CARD32 src, srca; - CARD32 *dstLine, *dst, d, dstMask; - CARD8 *maskLine, *mask, m; - FbStride dstStride, maskStride; - CARD16 w; - - fbComposeGetSolid(pSrc, src, pDst->format); - - dstMask = FbFullMask (pDst->pDrawable->depth); - srca = src >> 24; - if (src == 0) - return; - - fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1); - fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1); - - while (height--) - { - dst = dstLine; - dstLine += dstStride; - mask = maskLine; - maskLine += maskStride; - w = width; - - while (w--) - { - m = READ(mask++); - if (m == 0xff) - { - if (srca == 0xff) - WRITE(dst, src & dstMask); - else - WRITE(dst, fbOver (src, READ(dst)) & dstMask); - } - else if (m) - { - d = fbIn (src, m); - WRITE(dst, fbOver (d, READ(dst)) & dstMask); - } - dst++; - } - } - - fbFinishAccess (pMask->pDrawable); - fbFinishAccess (pDst->pDrawable); -} - -void -fbCompositeSolidMask_nx8888x8888C (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height) -{ - CARD32 src, srca; - CARD32 *dstLine, *dst, d, dstMask; - CARD32 *maskLine, *mask, ma; - FbStride dstStride, maskStride; - CARD16 w; - CARD32 m, n, o, p; - - fbComposeGetSolid(pSrc, src, pDst->format); - - dstMask = FbFullMask (pDst->pDrawable->depth); - srca = src >> 24; - if (src == 0) - return; - - fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1); - fbComposeGetStart (pMask, xMask, yMask, CARD32, maskStride, maskLine, 1); - - while (height--) - { - dst = dstLine; - dstLine += dstStride; - mask = maskLine; - maskLine += maskStride; - w = width; - - while (w--) - { - ma = READ(mask++); - if (ma == 0xffffffff) - { - if (srca == 0xff) - WRITE(dst, src & dstMask); - else - WRITE(dst, fbOver (src, READ(dst)) & dstMask); - } - else if (ma) - { - d = READ(dst); -#define FbInOverC(src,srca,msk,dst,i,result) { \ - CARD16 __a = FbGet8(msk,i); \ - CARD32 __t, __ta; \ - CARD32 __i; \ - __t = FbIntMult (FbGet8(src,i), __a,__i); \ - __ta = (CARD8) ~FbIntMult (srca, __a,__i); \ - __t = __t + FbIntMult(FbGet8(dst,i),__ta,__i); \ - __t = (CARD32) (CARD8) (__t | (-(__t >> 8))); \ - result = __t << (i); \ -} - FbInOverC (src, srca, ma, d, 0, m); - FbInOverC (src, srca, ma, d, 8, n); - FbInOverC (src, srca, ma, d, 16, o); - FbInOverC (src, srca, ma, d, 24, p); - WRITE(dst, m|n|o|p); - } - dst++; - } - } - - fbFinishAccess (pMask->pDrawable); - fbFinishAccess (pDst->pDrawable); -} - -void -fbCompositeSolidMask_nx8x0888 (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height) -{ - CARD32 src, srca; - CARD8 *dstLine, *dst; - CARD32 d; - CARD8 *maskLine, *mask, m; - FbStride dstStride, maskStride; - CARD16 w; - - fbComposeGetSolid(pSrc, src, pDst->format); - - srca = src >> 24; - if (src == 0) - return; - - fbComposeGetStart (pDst, xDst, yDst, CARD8, dstStride, dstLine, 3); - fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1); - - while (height--) - { - dst = dstLine; - dstLine += dstStride; - mask = maskLine; - maskLine += maskStride; - w = width; - - while (w--) - { - m = READ(mask++); - if (m == 0xff) - { - if (srca == 0xff) - d = src; - else - { - d = Fetch24(dst); - d = fbOver24 (src, d); - } - Store24(dst,d); - } - else if (m) - { - d = fbOver24 (fbIn(src,m), Fetch24(dst)); - Store24(dst,d); - } - dst += 3; - } - } - - fbFinishAccess (pMask->pDrawable); - fbFinishAccess (pDst->pDrawable); -} - -void -fbCompositeSolidMask_nx8x0565 (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height) -{ - CARD32 src, srca; - CARD16 *dstLine, *dst; - CARD32 d; - CARD8 *maskLine, *mask, m; - FbStride dstStride, maskStride; - CARD16 w; - - fbComposeGetSolid(pSrc, src, pDst->format); - - srca = src >> 24; - if (src == 0) - return; - - fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1); - fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1); - - while (height--) - { - dst = dstLine; - dstLine += dstStride; - mask = maskLine; - maskLine += maskStride; - w = width; - - while (w--) - { - m = READ(mask++); - if (m == 0xff) - { - if (srca == 0xff) - d = src; - else - { - d = READ(dst); - d = fbOver24 (src, cvt0565to0888(d)); - } - WRITE(dst, cvt8888to0565(d)); - } - else if (m) - { - d = READ(dst); - d = fbOver24 (fbIn(src,m), cvt0565to0888(d)); - WRITE(dst, cvt8888to0565(d)); - } - dst++; - } - } - - fbFinishAccess (pMask->pDrawable); - fbFinishAccess (pDst->pDrawable); -} - -void -fbCompositeSolidMask_nx8888x0565C (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height) -{ - CARD32 src, srca; - CARD16 src16; - CARD16 *dstLine, *dst; - CARD32 d; - CARD32 *maskLine, *mask, ma; - FbStride dstStride, maskStride; - CARD16 w; - CARD32 m, n, o; - - fbComposeGetSolid(pSrc, src, pDst->format); - - srca = src >> 24; - if (src == 0) - return; - - src16 = cvt8888to0565(src); - - fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1); - fbComposeGetStart (pMask, xMask, yMask, CARD32, maskStride, maskLine, 1); - - while (height--) - { - dst = dstLine; - dstLine += dstStride; - mask = maskLine; - maskLine += maskStride; - w = width; - - while (w--) - { - ma = READ(mask++); - if (ma == 0xffffffff) - { - if (srca == 0xff) - { - WRITE(dst, src16); - } - else - { - d = READ(dst); - d = fbOver24 (src, cvt0565to0888(d)); - WRITE(dst, cvt8888to0565(d)); - } - } - else if (ma) - { - d = READ(dst); - d = cvt0565to0888(d); - FbInOverC (src, srca, ma, d, 0, m); - FbInOverC (src, srca, ma, d, 8, n); - FbInOverC (src, srca, ma, d, 16, o); - d = m|n|o; - WRITE(dst, cvt8888to0565(d)); - } - dst++; - } - } - - fbFinishAccess (pMask->pDrawable); - fbFinishAccess (pDst->pDrawable); -} - -void -fbCompositeSrc_8888x8888 (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height) -{ - CARD32 *dstLine, *dst, dstMask; - CARD32 *srcLine, *src, s; - FbStride dstStride, srcStride; - CARD8 a; - CARD16 w; - - fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1); - fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1); - - dstMask = FbFullMask (pDst->pDrawable->depth); - - while (height--) - { - dst = dstLine; - dstLine += dstStride; - src = srcLine; - srcLine += srcStride; - w = width; - - while (w--) - { - s = READ(src++); - a = s >> 24; - if (a == 0xff) - WRITE(dst, s & dstMask); - else if (a) - WRITE(dst, fbOver (s, READ(dst)) & dstMask); - dst++; - } - } - - fbFinishAccess (pSrc->pDrawable); - fbFinishAccess (pDst->pDrawable); -} - -void -fbCompositeSrc_8888x0888 (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height) -{ - CARD8 *dstLine, *dst; - CARD32 d; - CARD32 *srcLine, *src, s; - CARD8 a; - FbStride dstStride, srcStride; - CARD16 w; - - fbComposeGetStart (pDst, xDst, yDst, CARD8, dstStride, dstLine, 3); - fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1); - - while (height--) - { - dst = dstLine; - dstLine += dstStride; - src = srcLine; - srcLine += srcStride; - w = width; - - while (w--) - { - s = READ(src++); - a = s >> 24; - if (a) - { - if (a == 0xff) - d = s; - else - d = fbOver24 (s, Fetch24(dst)); - Store24(dst,d); - } - dst += 3; - } - } - - fbFinishAccess (pSrc->pDrawable); - fbFinishAccess (pDst->pDrawable); -} - -void -fbCompositeSrc_8888x0565 (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height) -{ - CARD16 *dstLine, *dst; - CARD32 d; - CARD32 *srcLine, *src, s; - CARD8 a; - FbStride dstStride, srcStride; - CARD16 w; - - fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1); - fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1); - - while (height--) - { - dst = dstLine; - dstLine += dstStride; - src = srcLine; - srcLine += srcStride; - w = width; - - while (w--) - { - s = READ(src++); - a = s >> 24; - if (a) - { - if (a == 0xff) - d = s; - else - { - d = READ(dst); - d = fbOver24 (s, cvt0565to0888(d)); - } - WRITE(dst, cvt8888to0565(d)); - } - dst++; - } - } - - fbFinishAccess (pDst->pDrawable); - fbFinishAccess (pSrc->pDrawable); -} - -void -fbCompositeSrcAdd_8000x8000 (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height) -{ - CARD8 *dstLine, *dst; - CARD8 *srcLine, *src; - FbStride dstStride, srcStride; - CARD16 w; - CARD8 s, d; - CARD16 t; - - fbComposeGetStart (pSrc, xSrc, ySrc, CARD8, srcStride, srcLine, 1); - fbComposeGetStart (pDst, xDst, yDst, CARD8, dstStride, dstLine, 1); - - while (height--) - { - dst = dstLine; - dstLine += dstStride; - src = srcLine; - srcLine += srcStride; - w = width; - - while (w--) - { - s = READ(src++); - if (s) - { - if (s != 0xff) - { - d = READ(dst); - t = d + s; - s = t | (0 - (t >> 8)); - } - WRITE(dst, s); - } - dst++; - } - } - - fbFinishAccess (pDst->pDrawable); - fbFinishAccess (pSrc->pDrawable); -} - -void -fbCompositeSrcAdd_8888x8888 (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height) -{ - CARD32 *dstLine, *dst; - CARD32 *srcLine, *src; - FbStride dstStride, srcStride; - CARD16 w; - CARD32 s, d; - CARD16 t; - CARD32 m,n,o,p; - - fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1); - fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1); - - while (height--) - { - dst = dstLine; - dstLine += dstStride; - src = srcLine; - srcLine += srcStride; - w = width; - - while (w--) - { - s = READ(src++); - if (s) - { - if (s != 0xffffffff) - { - d = READ(dst); - if (d) - { - m = FbAdd(s,d,0,t); - n = FbAdd(s,d,8,t); - o = FbAdd(s,d,16,t); - p = FbAdd(s,d,24,t); - s = m|n|o|p; - } - } - WRITE(dst, s); - } - dst++; - } - } - - fbFinishAccess (pDst->pDrawable); - fbFinishAccess (pSrc->pDrawable); -} - -static void -fbCompositeSrcAdd_8888x8x8 (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height) -{ - CARD8 *dstLine, *dst; - CARD8 *maskLine, *mask; - FbStride dstStride, maskStride; - CARD16 w; - CARD32 src; - CARD8 sa; - - fbComposeGetStart (pDst, xDst, yDst, CARD8, dstStride, dstLine, 1); - fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1); - fbComposeGetSolid (pSrc, src, pDst->format); - sa = (src >> 24); - - while (height--) - { - dst = dstLine; - dstLine += dstStride; - mask = maskLine; - maskLine += maskStride; - w = width; - - while (w--) - { - CARD16 tmp; - CARD16 a; - CARD32 m, d; - CARD32 r; - - a = READ(mask++); - d = READ(dst); - - m = FbInU (sa, 0, a, tmp); - r = FbAdd (m, d, 0, tmp); - - WRITE(dst++, r); - } - } - - fbFinishAccess(pDst->pDrawable); - fbFinishAccess(pMask->pDrawable); -} - -void -fbCompositeSrcAdd_1000x1000 (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height) -{ - FbBits *dstBits, *srcBits; - FbStride dstStride, srcStride; - int dstBpp, srcBpp; - int dstXoff, dstYoff; - int srcXoff, srcYoff; - - fbGetDrawable(pSrc->pDrawable, srcBits, srcStride, srcBpp, srcXoff, srcYoff); - - fbGetDrawable(pDst->pDrawable, dstBits, dstStride, dstBpp, dstXoff, dstYoff); - - fbBlt (srcBits + srcStride * (ySrc + srcYoff), - srcStride, - xSrc + srcXoff, - - dstBits + dstStride * (yDst + dstYoff), - dstStride, - xDst + dstXoff, - - width, - height, - - GXor, - FB_ALLONES, - srcBpp, - - FALSE, - FALSE); - - fbFinishAccess(pDst->pDrawable); - fbFinishAccess(pSrc->pDrawable); -} - -void -fbCompositeSolidMask_nx1xn (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height) -{ - FbBits *dstBits; - FbStip *maskBits; - FbStride dstStride, maskStride; - int dstBpp, maskBpp; - int dstXoff, dstYoff; - int maskXoff, maskYoff; - FbBits src; - - fbComposeGetSolid(pSrc, src, pDst->format); - fbGetStipDrawable (pMask->pDrawable, maskBits, maskStride, maskBpp, maskXoff, maskYoff); - fbGetDrawable (pDst->pDrawable, dstBits, dstStride, dstBpp, dstXoff, dstYoff); - - switch (dstBpp) { - case 32: - break; - case 24: - break; - case 16: - src = cvt8888to0565(src); - break; - } - - src = fbReplicatePixel (src, dstBpp); - - fbBltOne (maskBits + maskStride * (yMask + maskYoff), - maskStride, - xMask + maskXoff, - - dstBits + dstStride * (yDst + dstYoff), - dstStride, - (xDst + dstXoff) * dstBpp, - dstBpp, - - width * dstBpp, - height, - - 0x0, - src, - FB_ALLONES, - 0x0); - - fbFinishAccess (pDst->pDrawable); - fbFinishAccess (pMask->pDrawable); -} - -# define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b)) - -/* - * Apply a constant alpha value in an over computation - */ -static void -fbCompositeSrcSrc_nxn (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height); - -/* - * Simple bitblt - */ - -static void -fbCompositeSrcSrc_nxn (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height) -{ - FbBits *dst; - FbBits *src; - FbStride dstStride, srcStride; - int srcXoff, srcYoff; - int dstXoff, dstYoff; - int srcBpp; - int dstBpp; - Bool reverse = FALSE; - Bool upsidedown = FALSE; - - fbGetDrawable(pSrc->pDrawable,src,srcStride,srcBpp,srcXoff,srcYoff); - fbGetDrawable(pDst->pDrawable,dst,dstStride,dstBpp,dstXoff,dstYoff); - - fbBlt (src + (ySrc + srcYoff) * srcStride, - srcStride, - (xSrc + srcXoff) * srcBpp, - - dst + (yDst + dstYoff) * dstStride, - dstStride, - (xDst + dstXoff) * dstBpp, - - (width) * dstBpp, - (height), - - GXcopy, - FB_ALLONES, - dstBpp, - - reverse, - upsidedown); - - fbFinishAccess(pSrc->pDrawable); - fbFinishAccess(pDst->pDrawable); -} - static pixman_image_t * create_solid_fill_image (PicturePtr pict) { @@ -1153,39 +261,7 @@ image_from_pict (PicturePtr pict) return image; } -static void -fbCompositeRectWrapper (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height) -{ - pixman_image_t *src = image_from_pict (pSrc); - pixman_image_t *dest = image_from_pict (pDst); - pixman_image_t *mask = image_from_pict (pMask); - - if (!src || !dest || (pMask && !mask)) - goto out; - - pixman_image_composite_rect (op, src, mask, dest, - xSrc, ySrc, xMask, yMask, xDst, yDst, - width, height); - -out: - if (src) - pixman_image_unref (src); - if (mask) - pixman_image_unref (mask); - if (dest) - pixman_image_unref (dest); -} +#define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b)) void fbWalkCompositeRegion (CARD8 op, @@ -1305,591 +381,32 @@ fbComposite (CARD8 op, CARD16 width, CARD16 height) { - Bool srcRepeat = pSrc->pDrawable && pSrc->repeatType == RepeatNormal; - Bool maskRepeat = FALSE; - Bool srcTransform = pSrc->transform != 0; - Bool maskTransform = FALSE; - Bool srcAlphaMap = pSrc->alphaMap != 0; - Bool maskAlphaMap = FALSE; - Bool dstAlphaMap = pDst->alphaMap != 0; - CompositeFunc func = NULL; - -#ifdef USE_MMX - static Bool mmx_setup = FALSE; - if (!mmx_setup) { - fbComposeSetupMMX(); - mmx_setup = TRUE; - } -#endif - - if (srcRepeat && srcTransform && - pSrc->pDrawable->width == 1 && - pSrc->pDrawable->height == 1) - srcTransform = FALSE; + pixman_region16_t region; + pixman_image_t *src, *mask, *dest; - if (pMask && pMask->pDrawable) - { - maskRepeat = pMask->repeatType == RepeatNormal; - - if (pMask->filter == PictFilterConvolution) - maskTransform = TRUE; - - maskAlphaMap = pMask->alphaMap != 0; - - if (maskRepeat && maskTransform && - pMask->pDrawable->width == 1 && - pMask->pDrawable->height == 1) - maskTransform = FALSE; - } + if (!miComputeCompositeRegion (®ion, pSrc, pMask, pDst, xSrc, ySrc, + xMask, yMask, xDst, yDst, width, height)) + return; - if (pSrc->pDrawable && (!pMask || pMask->pDrawable) - && !srcTransform && !maskTransform - && !maskAlphaMap && !srcAlphaMap && !dstAlphaMap - && (pSrc->filter != PictFilterConvolution) - && (!pMask || pMask->filter != PictFilterConvolution)) - switch (op) { - case PictOpOver: - if (pMask) - { - if (fbCanGetSolid(pSrc) && - !maskRepeat) - { - if (PICT_FORMAT_COLOR(pSrc->format)) { - switch (pMask->format) { - case PICT_a8: - switch (pDst->format) { - case PICT_r5g6b5: - case PICT_b5g6r5: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeSolidMask_nx8x0565mmx; - else -#endif - func = fbCompositeSolidMask_nx8x0565; - break; - case PICT_r8g8b8: - case PICT_b8g8r8: - func = fbCompositeSolidMask_nx8x0888; - break; - case PICT_a8r8g8b8: - case PICT_x8r8g8b8: - case PICT_a8b8g8r8: - case PICT_x8b8g8r8: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeSolidMask_nx8x8888mmx; - else -#endif - func = fbCompositeSolidMask_nx8x8888; - break; - default: - break; - } - break; - case PICT_a8r8g8b8: - if (pMask->componentAlpha) { - switch (pDst->format) { - case PICT_a8r8g8b8: - case PICT_x8r8g8b8: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeSolidMask_nx8888x8888Cmmx; - else -#endif - func = fbCompositeSolidMask_nx8888x8888C; - break; - case PICT_r5g6b5: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeSolidMask_nx8888x0565Cmmx; - else -#endif - func = fbCompositeSolidMask_nx8888x0565C; - break; - default: - break; - } - } -#if 0 - else - { - switch (pDst->format) { - case PICT_r5g6b5: - func = fbCompositeSolidMask_nx8888x0565; - break; - default: - break; - } - } -#endif - break; - case PICT_a8b8g8r8: - if (pMask->componentAlpha) { - switch (pDst->format) { - case PICT_a8b8g8r8: - case PICT_x8b8g8r8: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeSolidMask_nx8888x8888Cmmx; - else -#endif - func = fbCompositeSolidMask_nx8888x8888C; - break; - case PICT_b5g6r5: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeSolidMask_nx8888x0565Cmmx; - else -#endif - func = fbCompositeSolidMask_nx8888x0565C; - break; - default: - break; - } - } -#if 0 - else - { - switch (pDst->format) { - case PICT_b5g6r5: - func = fbCompositeSolidMask_nx8888x0565; - break; - default: - break; - } - } -#endif - break; - case PICT_a1: - switch (pDst->format) { - case PICT_r5g6b5: - case PICT_b5g6r5: - case PICT_r8g8b8: - case PICT_b8g8r8: - case PICT_a8r8g8b8: - case PICT_x8r8g8b8: - case PICT_a8b8g8r8: - case PICT_x8b8g8r8: - { - FbBits src; + src = image_from_pict (pSrc); + mask = image_from_pict (pMask); + dest = image_from_pict (pDst); - fbComposeGetSolid(pSrc, src, pDst->format); - if ((src & 0xff000000) == 0xff000000) - func = fbCompositeSolidMask_nx1xn; - break; - } - default: - break; - } - break; - default: - break; - } - } - if (func) - srcRepeat = FALSE; - } - else if (!srcRepeat) /* has mask and non-repeating source */ - { - if (pSrc->pDrawable == pMask->pDrawable && - xSrc + pSrc->pDrawable->x == xMask + pMask->pDrawable->x && - ySrc + pSrc->pDrawable->y == yMask + pMask->pDrawable->y && - !pMask->componentAlpha && !maskRepeat) - { - /* source == mask: non-premultiplied data */ - switch (pSrc->format) { - case PICT_x8b8g8r8: - switch (pMask->format) { - case PICT_a8r8g8b8: - case PICT_a8b8g8r8: - switch (pDst->format) { - case PICT_a8r8g8b8: - case PICT_x8r8g8b8: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeSrc_8888RevNPx8888mmx; -#endif - break; - case PICT_r5g6b5: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeSrc_8888RevNPx0565mmx; -#endif - break; - default: - break; - } - break; - default: - break; - } - break; - case PICT_x8r8g8b8: - switch (pMask->format) { - case PICT_a8r8g8b8: - case PICT_a8b8g8r8: - switch (pDst->format) { - case PICT_a8b8g8r8: - case PICT_x8b8g8r8: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeSrc_8888RevNPx8888mmx; -#endif - break; - case PICT_r5g6b5: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeSrc_8888RevNPx0565mmx; -#endif - break; - default: - break; - } - break; - default: - break; - } - break; - default: - break; - } - break; - } - else if (maskRepeat && - pMask->pDrawable->width == 1 && - pMask->pDrawable->height == 1) - { - switch (pSrc->format) { -#ifdef USE_MMX - case PICT_x8r8g8b8: - if ((pDst->format == PICT_a8r8g8b8 || - pDst->format == PICT_x8r8g8b8) && - pMask->format == PICT_a8 && fbHaveMMX()) - func = fbCompositeSrc_x888x8x8888mmx; - break; - case PICT_x8b8g8r8: - if ((pDst->format == PICT_a8b8g8r8 || - pDst->format == PICT_x8b8g8r8) && - pMask->format == PICT_a8 && fbHaveMMX()) - func = fbCompositeSrc_x888x8x8888mmx; - break; - case PICT_a8r8g8b8: - if ((pDst->format == PICT_a8r8g8b8 || - pDst->format == PICT_x8r8g8b8) && - pMask->format == PICT_a8 && fbHaveMMX()) - func = fbCompositeSrc_8888x8x8888mmx; - break; - case PICT_a8b8g8r8: - if ((pDst->format == PICT_a8b8g8r8 || - pDst->format == PICT_x8b8g8r8) && - pMask->format == PICT_a8 && fbHaveMMX()) - func = fbCompositeSrc_8888x8x8888mmx; - break; -#endif - default: - break; - } - - if (func) - maskRepeat = FALSE; - } - } - } - else /* no mask */ - { - if (fbCanGetSolid(pSrc)) - { - /* no mask and repeating source */ - switch (pSrc->format) { - case PICT_a8r8g8b8: - switch (pDst->format) { - case PICT_a8r8g8b8: - case PICT_x8r8g8b8: -#ifdef USE_MMX - if (fbHaveMMX()) - { - srcRepeat = FALSE; - func = fbCompositeSolid_nx8888mmx; - } -#endif - break; - case PICT_r5g6b5: -#ifdef USE_MMX - if (fbHaveMMX()) - { - srcRepeat = FALSE; - func = fbCompositeSolid_nx0565mmx; - } -#endif - break; - default: - break; - } - break; - default: - break; - } - } - else if (! srcRepeat) - { - /* - * Formats without alpha bits are just Copy with Over - */ - if (pSrc->format == pDst->format && !PICT_FORMAT_A(pSrc->format)) - { -#ifdef USE_MMX - if (fbHaveMMX() && - (pSrc->format == PICT_x8r8g8b8 || pSrc->format == PICT_x8b8g8r8)) - func = fbCompositeCopyAreammx; - else -#endif - func = fbCompositeSrcSrc_nxn; - } - else switch (pSrc->format) { - case PICT_a8r8g8b8: - switch (pDst->format) { - case PICT_a8r8g8b8: - case PICT_x8r8g8b8: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeSrc_8888x8888mmx; - else -#endif - func = fbCompositeSrc_8888x8888; - break; - case PICT_r8g8b8: - func = fbCompositeSrc_8888x0888; - break; - case PICT_r5g6b5: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeSrc_8888x0565mmx; - else -#endif - func = fbCompositeSrc_8888x0565; - break; - default: - break; - } - break; - case PICT_x8r8g8b8: - switch (pDst->format) { - case PICT_a8r8g8b8: - case PICT_x8r8g8b8: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeCopyAreammx; -#endif - break; - default: - break; - } - case PICT_x8b8g8r8: - switch (pDst->format) { - case PICT_a8b8g8r8: - case PICT_x8b8g8r8: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeCopyAreammx; -#endif - break; - default: - break; - } - break; - case PICT_a8b8g8r8: - switch (pDst->format) { - case PICT_a8b8g8r8: - case PICT_x8b8g8r8: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeSrc_8888x8888mmx; - else -#endif - func = fbCompositeSrc_8888x8888; - break; - case PICT_b8g8r8: - func = fbCompositeSrc_8888x0888; - break; - case PICT_b5g6r5: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeSrc_8888x0565mmx; - else -#endif - func = fbCompositeSrc_8888x0565; - break; - default: - break; - } - break; - default: - break; - } - } - } - break; - case PictOpAdd: - if (pMask == 0) - { - switch (pSrc->format) { - case PICT_a8r8g8b8: - switch (pDst->format) { - case PICT_a8r8g8b8: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeSrcAdd_8888x8888mmx; - else -#endif - func = fbCompositeSrcAdd_8888x8888; - break; - default: - break; - } - break; - case PICT_a8b8g8r8: - switch (pDst->format) { - case PICT_a8b8g8r8: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeSrcAdd_8888x8888mmx; - else -#endif - func = fbCompositeSrcAdd_8888x8888; - break; - default: - break; - } - break; - case PICT_a8: - switch (pDst->format) { - case PICT_a8: -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeSrcAdd_8000x8000mmx; - else -#endif - func = fbCompositeSrcAdd_8000x8000; - break; - default: - break; - } - break; - case PICT_a1: - switch (pDst->format) { - case PICT_a1: - func = fbCompositeSrcAdd_1000x1000; - break; - default: - break; - } - break; - default: - break; - } - } - else - { - if ((pSrc->format == PICT_a8r8g8b8 || - pSrc->format == PICT_a8b8g8r8) && - fbCanGetSolid (pSrc) && - pMask->format == PICT_a8 && - pDst->format == PICT_a8) - { - srcRepeat = FALSE; -#ifdef USE_MMX - if (fbHaveMMX()) - func = fbCompositeSrcAdd_8888x8x8mmx; - else -#endif - func = fbCompositeSrcAdd_8888x8x8; - } - } - break; - case PictOpSrc: - if (pMask) - { -#ifdef USE_MMX - if (fbCanGetSolid (pSrc)) - { - if (pMask->format == PICT_a8) - { - switch (pDst->format) - { - case PICT_a8r8g8b8: - case PICT_x8r8g8b8: - case PICT_a8b8g8r8: - case PICT_x8b8g8r8: - if (fbHaveMMX()) - { - srcRepeat = FALSE; - func = fbCompositeSolidMaskSrc_nx8x8888mmx; - } - break; - default: - break; - } - } - } -#endif - } - else - { - if (pSrc->format == pDst->format) - { -#ifdef USE_MMX - if (pSrc->pDrawable != pDst->pDrawable && fbHaveMMX() && - (PICT_FORMAT_BPP (pSrc->format) == 16 || - PICT_FORMAT_BPP (pSrc->format) == 32)) - func = fbCompositeCopyAreammx; - else -#endif - func = fbCompositeSrcSrc_nxn; - } - } - break; - case PictOpIn: -#ifdef USE_MMX - if (pSrc->format == PICT_a8 && - pDst->format == PICT_a8 && - !pMask) - { - if (fbHaveMMX()) - func = fbCompositeIn_8x8mmx; - } - else if (srcRepeat && pMask && !pMask->componentAlpha && - (pSrc->format == PICT_a8r8g8b8 || - pSrc->format == PICT_a8b8g8r8) && - (pMask->format == PICT_a8) && - pDst->format == PICT_a8) - { - if (fbHaveMMX()) - { - srcRepeat = FALSE; - func = fbCompositeIn_nx8x8mmx; - } - } -#else - func = NULL; -#endif - break; - default: - break; - } - - if (!func) { - func = fbCompositeRectWrapper; + if (src && dest && !(pMask && !mask)) + { + pixman_image_composite (op, src, mask, dest, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height, ®ion); } - - /* if we are transforming, we handle repeats in fbFetchTransformed */ - if (srcTransform) - srcRepeat = FALSE; - if (maskTransform) - maskRepeat = FALSE; - - fbWalkCompositeRegion (op, pSrc, pMask, pDst, xSrc, ySrc, - xMask, yMask, xDst, yDst, width, height, - srcRepeat, maskRepeat, func); + + pixman_region_fini (®ion); + + if (src) + pixman_image_unref (src); + if (mask) + pixman_image_unref (mask); + if (dest) + pixman_image_unref (dest); } void diff --git a/fb/fbpict.h b/fb/fbpict.h index 11cab3da9..3bd0a78a3 100644 --- a/fb/fbpict.h +++ b/fb/fbpict.h @@ -425,197 +425,6 @@ fbRasterizeEdges (FbBits *buf, xFixed b); /* fbpict.c */ -CARD32 -fbOver (CARD32 x, CARD32 y); - -CARD32 -fbOver24 (CARD32 x, CARD32 y); - -CARD32 -fbIn (CARD32 x, CARD8 y); - -void -fbCompositeSolidMask_nx8x8888 (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height); - -void -fbCompositeSolidMask_nx8x0888 (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height); - -void -fbCompositeSolidMask_nx8888x8888C (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height); - -void -fbCompositeSolidMask_nx8x0565 (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height); - -void -fbCompositeSolidMask_nx8888x0565C (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height); - -void -fbCompositeSrc_8888x8888 (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height); - -void -fbCompositeSrc_8888x0888 (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height); - -void -fbCompositeSrc_8888x0565 (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height); - -void -fbCompositeSrc_0565x0565 (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height); - -void -fbCompositeSrcAdd_8000x8000 (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height); - -void -fbCompositeSrcAdd_8888x8888 (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height); - -void -fbCompositeSrcAdd_1000x1000 (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height); - -void -fbCompositeSolidMask_nx1xn (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height); - void fbComposite (CARD8 op, PicturePtr pSrc, |