[xserver-commit] xserver/fb fbpict.c,1.21,1.22

Jaymz Julian xserver-commit@pdx.freedesktop.org
Fri, 19 Dec 2003 05:08:03 -0800


Committed by: jaymz

Update of /cvs/xserver/xserver/fb
In directory pdx:/tmp/cvs-serv16639/fb

Modified Files:
	fbpict.c 
Log Message:

Changed fbCompositeTrans_0565xnx0565 to have an aligned path similar to
the 24bit version of same, as well as making it do it's alpha blend in 
a single pass for 2x16bit values rather than a seperate pass for the
high/low 16 bits



Index: fbpict.c
===================================================================
RCS file: /cvs/xserver/xserver/fb/fbpict.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- fbpict.c	19 Dec 2003 10:28:09 -0000	1.21
+++ fbpict.c	19 Dec 2003 13:08:01 -0000	1.22
@@ -169,11 +169,18 @@
 	*destptr++=((((drb>>8) + dstrb) & 0x00FF00FF) | ((((dag>>8) + dstag) << 8) & 0xFF00FF00)); \
 	}
 
-// Note: this macro expects 6 bits of alpha, not 8!
+// Note: this macro expects 5 bits of alpha, not 8!
+// (single op can actually be changed to take 6 bits, but double op can't)
 #define fastCombine0565(alpha, source, destval, destptr) { \
 	CARD16 dstrb = destval & 0xf81f; CARD16 dstg  = destval & 0x7e0; \
 	CARD32 drb = ((source&0xf81f)-dstrb)*alpha; CARD32 dg=((source & 0x7e0)-dstg)*alpha; \
-	destptr= ((((drb>>6) + dstrb)&0xf81f) | (((dg>>6)  + dstg) & 0x7e0)); \
+	destptr= ((((drb>>5) + dstrb)&0xf81f) | (((dg>>5)  + dstg) & 0x7e0)); \
+	}
+
+#define fastCombine2x0565(alpha, source, destval, destptr) { \
+	CARD32 dstrb = destval & 0x07e0f81f; CARD32 dstg  = (destval & 0xf81f07e0)>>5; \
+	CARD32 drb = ((source&0x07e0f81f)-dstrb)*alpha; CARD32 dg=(((source & 0xf81f07e0)>>5)-dstg)*alpha; \
+	destptr= ((((drb>>5) + dstrb)&0x07e0f81f) | ((((dg>>5)  + dstg)<<5) & 0xf81f07e0)); \
 	}
 
 #if IMAGE_BYTE_ORDER == LSBFirst
@@ -461,7 +468,7 @@
     src16 = cvt8888to0565(src);
     
     rsrca = src >> 24;
-	srca=rsrca>>2;
+	srca=rsrca>>3;
     if (src == 0)
 		return;
     
@@ -493,7 +500,7 @@
 			}
 			else if (m)
 			{
-				na=(rsrca*(int)m)>>10;
+				na=(rsrca*(int)m)>>11;
 				d = *dst;
 				fastCombine0565(na, src16, d, *dst++);
 			}
@@ -1001,7 +1008,7 @@
     CARD32	s_32, d_32, i_32, r_32;
     
     fbComposeGetSolid (pMask, mask);
-    maskAlpha = mask >> 26;
+    maskAlpha = mask >> 27;
     
     if (!maskAlpha)
 	return;
@@ -1018,7 +1025,7 @@
 
     while (height--)
 	{
-		CARD32 *isrc;
+		CARD32 *isrc, *idst;
 		dst = dstLine;
 		dstLine += dstStride;
 		src = srcLine;
@@ -1033,9 +1040,20 @@
 			w--;
 		}
 		isrc=(CARD32 *)src;
-		while (w>1)
+		if(((int)dst&1)==0)
+		{
+			idst=(CARD32 *)dst;
+			while (w>1)
+			{
+				s_32 = *isrc++;
+				d_32 = *idst;
+				fastCombine2x0565(maskAlpha,s_32,d_32,*idst++);
+				w-=2;
+			}
+			dst=(CARD16 *)idst;
+		}
+		else
 		{
-			s_32=*isrc++;
 #if IMAGE_BYTE_ORDER == LSBFirst
 			s_16=s_32&0xffff;
 #else