[cairo] Adding a cairo_content_t value to solid patterns

Jeff Muizelaar jeff at infidigm.net
Wed Apr 25 13:29:32 PDT 2007


On Wed, Apr 25, 2007 at 12:13:42PM -0700, Carl Worth wrote:
> On Wed, 25 Apr 2007 14:46:13 -0400, Jeff Muizelaar wrote:
> > Ok, how about adding this fix as well.
> > On line 1232 of fbmmx.c we have:
> >             __m64 vs = *(__m64 *)dst;
> >             __m64 vd = *(__m64 *)src;
> > but we want:
> >             __m64 vs = *(__m64 *)src;
> >             __m64 vd = *(__m64 *)dst;
> >
> > This change puts the src and dst in the variables that the code following it expects it to be.
> 
> That fixes the fill-and-stroke-alpha failure, but the mask and
> push-group failures remain.

This patch should fix the remaining issues. However, it has only been
lightly tested. 

The problem was that the code was using:
fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1);
when it should have been using:
fbComposeGetSolid (pMask, pDst, mask);

This was causing the the mask value to read from random places in memory depending
on xMask and yMask.

-Jeff
-------------- next part --------------
diff --git a/pixman/src/fbmmx.c b/pixman/src/fbmmx.c
index dcb3786..57dcd14 100644
--- a/pixman/src/fbmmx.c
+++ b/pixman/src/fbmmx.c
@@ -1194,10 +1194,9 @@ fbCompositeSrc_8888x8x8888mmx (pixman_operator_t	op,
 {
     CARD32	*dstLine, *dst;
     CARD32	*srcLine, *src;
-    CARD8	*maskLine;
     CARD32	mask;
     __m64	vmask;
-    FbStride	dstStride, srcStride, maskStride;
+    FbStride	dstStride, srcStride;
     CARD16	w;
     __m64  srca;
 
@@ -1205,9 +1204,9 @@ fbCompositeSrc_8888x8x8888mmx (pixman_operator_t	op,
 
     fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1);
     fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1);
-    fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1);
 
-    mask = *maskLine << 24 | *maskLine << 16 | *maskLine << 8 | *maskLine;
+    fbComposeGetSolid (pMask, pDst, mask);
+    mask = mask | mask >> 8 | mask >> 16 | mask >> 24;
     vmask = load8888 (mask);
     srca = MC(4x00ff);
 
@@ -1224,7 +1223,7 @@ fbCompositeSrc_8888x8x8888mmx (pixman_operator_t	op,
 	    __m64 s = load8888 (*src);
 	    __m64 d = load8888 (*dst);
 
-	    *dst = store8888 (over (s, expand_alpha (s), d));
+	    *dst = store8888 (in_over (s, expand_alpha (s), vmask, d));
 
 	    w--;
 	    dst++;
@@ -1233,8 +1232,8 @@ fbCompositeSrc_8888x8x8888mmx (pixman_operator_t	op,
 
 	while (w >= 2)
 	{
-	    __m64 vs = *(__m64 *)dst;
-	    __m64 vd = *(__m64 *)src;
+	    __m64 vs = *(__m64 *)src;
+	    __m64 vd = *(__m64 *)dst;
 	    __m64 vsrc0 = expand8888 (vs, 0);
 	    __m64 vsrc1 = expand8888 (vs, 1);
 
@@ -1279,10 +1278,9 @@ fbCompositeSrc_x888x8x8888mmx (pixman_operator_t	op,
 {
     CARD32	*dstLine, *dst;
     CARD32	*srcLine, *src;
-    CARD8	*maskLine;
     CARD32	mask;
     __m64	vmask;
-    FbStride	dstStride, srcStride, maskStride;
+    FbStride	dstStride, srcStride;
     CARD16	w;
     __m64  srca;
 
@@ -1290,9 +1288,9 @@ fbCompositeSrc_x888x8x8888mmx (pixman_operator_t	op,
 
     fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1);
     fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1);
-    fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1);
+    fbComposeGetSolid (pMask, pDst, mask);
 
-    mask = *maskLine << 24 | *maskLine << 16 | *maskLine << 8 | *maskLine;
+    mask = mask | mask >> 8 | mask >> 16 | mask >> 24;
     vmask = load8888 (mask);
     srca = MC(4x00ff);
 
diff --git a/pixman/src/fbpict.c b/pixman/src/fbpict.c
index 03f75f1..2d71402 100644
--- a/pixman/src/fbpict.c
+++ b/pixman/src/fbpict.c
@@ -1653,14 +1653,12 @@ pixman_composite (pixman_operator_t	op,
 				pMask->format_code == PICT_a8 && fbHaveMMX())
 				func = fbCompositeSrc_x888x8x8888mmx;
 			    break;
-#if 0 /* This case fails rendercheck for me */
 			case PICT_a8r8g8b8:
-			    if ((pDst->format == PICT_a8r8g8b8 ||
-				 pDst->format == PICT_x8r8g8b8) &&
-				pMask->format == PICT_a8 && fbHaveMMX())
+			    if ((pDst->format_code == PICT_a8r8g8b8 ||
+				 pDst->format_code == PICT_x8r8g8b8) &&
+				pMask->format_code == PICT_a8 && fbHaveMMX())
 				func = fbCompositeSrc_8888x8x8888mmx;
 			    break;
-#endif
 			case PICT_a8b8g8r8:
 			    if ((pDst->format_code == PICT_a8b8g8r8 ||
 				 pDst->format_code == PICT_x8b8g8r8) &&


More information about the cairo mailing list