xserver/fb fbcompose.c, 1.37, 1.38 fbmmx.c, 1.14, 1.15 fbpict.c, 1.43, 1.44 fbpict.h, 1.25, 1.26

Billy Biggs xserver-commit at pdx.freedesktop.org
Sun Sep 18 20:41:48 PDT 2005


Committed by: vektor

Update of /cvs/xserver/xserver/fb
In directory gabe:/tmp/cvs-serv6219/fb

Modified Files:
	fbcompose.c fbmmx.c fbpict.c fbpict.h 
Log Message:
	Bug #4260, fix by Owen Taylor.
 
 	* fb/fbcompose.c (fbStore_a8b8g8r8, fbStore_x8b8g8r8): Use & not
 	&& for bitwise AND.
 
 	* fb/fbpict.h (fbComposeGetSolid) fb/fbpict.c fb/fbmmx.c: Take
 	'dest' as an argument, if pict and dest don't match for RGB, BGR,
 	swap result.



Index: fbcompose.c
===================================================================
RCS file: /cvs/xserver/xserver/fb/fbcompose.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- fbcompose.c	28 Aug 2005 02:36:40 -0000	1.37
+++ fbcompose.c	19 Sep 2005 03:41:46 -0000	1.38
@@ -1018,7 +1018,7 @@
     int i;
     CARD32 *pixel = (CARD32 *)bits + x;
     for (i = 0; i < width; ++i)
-        *pixel++ = (values[i] & 0xff00ff00) | ((values[i] >> 16) && 0xff) | ((values[i] & 0xff) << 16);
+        *pixel++ = (values[i] & 0xff00ff00) | ((values[i] >> 16) & 0xff) | ((values[i] & 0xff) << 16);
 }
 
 static FASTCALL void
@@ -1027,7 +1027,7 @@
     int i;
     CARD32 *pixel = (CARD32 *)bits + x;
     for (i = 0; i < width; ++i)
-        *pixel++ = (values[i] & 0x0000ff00) | ((values[i] >> 16) && 0xff) | ((values[i] & 0xff) << 16);
+        *pixel++ = (values[i] & 0x0000ff00) | ((values[i] >> 16) & 0xff) | ((values[i] & 0xff) << 16);
 }
 
 static FASTCALL void

Index: fbmmx.c
===================================================================
RCS file: /cvs/xserver/xserver/fb/fbmmx.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- fbmmx.c	29 Aug 2005 03:32:56 -0000	1.14
+++ fbmmx.c	19 Sep 2005 03:41:46 -0000	1.15
@@ -886,7 +886,7 @@
     
     CHECKPOINT();
     
-    fbComposeGetSolid(pSrc, src);
+    fbComposeGetSolid(pSrc, pDst, src);
     
     if (src >> 24 == 0)
 	return;
@@ -964,7 +964,7 @@
     
     CHECKPOINT();
     
-    fbComposeGetSolid(pSrc, src);
+    fbComposeGetSolid(pSrc, pDst, src);
     
     if (src >> 24 == 0)
 	return;
@@ -1049,7 +1049,7 @@
     
     CHECKPOINT();
     
-    fbComposeGetSolid(pSrc, src);
+    fbComposeGetSolid(pSrc, pDst, src);
     
     srca = src >> 24;
     if (srca == 0)
@@ -1423,7 +1423,7 @@
     
     CHECKPOINT();
     
-    fbComposeGetSolid(pSrc, src);
+    fbComposeGetSolid(pSrc, pDst, src);
     
     srca = src >> 24;
     if (srca == 0)
@@ -1538,7 +1538,7 @@
     
     CHECKPOINT();
     
-    fbComposeGetSolid(pSrc, src);
+    fbComposeGetSolid(pSrc, pDst, src);
     
     srca = src >> 24;
     if (srca == 0)
@@ -1669,7 +1669,7 @@
     
     CHECKPOINT();
     
-    fbComposeGetSolid(pSrc, src);
+    fbComposeGetSolid(pSrc, pDst, src);
     
     srca = src >> 24;
     if (srca == 0)
@@ -2010,7 +2010,7 @@
     
     CHECKPOINT();
     
-    fbComposeGetSolid(pSrc, src);
+    fbComposeGetSolid(pSrc, pDst, src);
     
     srca = src >> 24;
     if (srca == 0)

Index: fbpict.c
===================================================================
RCS file: /cvs/xserver/xserver/fb/fbpict.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- fbpict.c	28 Aug 2005 02:36:40 -0000	1.43
+++ fbpict.c	19 Sep 2005 03:41:46 -0000	1.44
@@ -184,7 +184,7 @@
     FbStride	dstStride, maskStride;
     CARD16	w;
 
-    fbComposeGetSolid(pSrc, src);
+    fbComposeGetSolid(pSrc, pDst, src);
 
     dstMask = FbFullMask (pDst->pDrawable->depth);
     srca = src >> 24;
@@ -243,7 +243,7 @@
     CARD16	w;
     CARD32	m, n, o, p;
 
-    fbComposeGetSolid(pSrc, src);
+    fbComposeGetSolid(pSrc, pDst, src);
 
     dstMask = FbFullMask (pDst->pDrawable->depth);
     srca = src >> 24;
@@ -317,7 +317,7 @@
     CARD16	w;
 	CARD32 rs,gs,bs,rd,gd,bd;
 
-    fbComposeGetSolid(pSrc, src);
+    fbComposeGetSolid(pSrc, pDst, src);
 
     srca = src >> 24;
     srcia = 255-srca;
@@ -413,7 +413,7 @@
     FbStride	dstStride, maskStride;
     CARD16	w,src16;
 
-    fbComposeGetSolid(pSrc, src);
+    fbComposeGetSolid(pSrc, pDst, src);
 
     if (src == 0)
 	return;
@@ -491,7 +491,7 @@
     FbStride	dstStride, maskStride;
     CARD16	w, src16;
 
-    fbComposeGetSolid(pSrc, src);
+    fbComposeGetSolid(pSrc, pDst, src);
 
     if (src == 0)
 	return;
@@ -570,7 +570,7 @@
     CARD16	w;
     CARD32	m, n, o;
 
-    fbComposeGetSolid(pSrc, src);
+    fbComposeGetSolid(pSrc, pDst, src);
 
     srca = src >> 24;
     if (src == 0)
@@ -939,7 +939,7 @@
     int		maskXoff, maskYoff;
     FbBits	src;
 
-    fbComposeGetSolid(pSrc, src);
+    fbComposeGetSolid(pSrc, pDst, src);
 
     if ((src & 0xff000000) != 0xff000000)
     {
@@ -1008,7 +1008,7 @@
     CARD16	s_16, d_16;
     CARD32	s_32, d_32;
 
-    fbComposeGetSolid (pMask, mask);
+    fbComposeGetSolid (pMask, pDst, mask);
     maskAlpha = mask >> 27;
 
     if (!maskAlpha)
@@ -1110,7 +1110,7 @@
     FbBits	mask;
     CARD16	maskAlpha,maskiAlpha;
 
-    fbComposeGetSolid (pMask, mask);
+    fbComposeGetSolid (pMask, pDst, mask);
     maskAlpha = mask >> 24;
 	maskiAlpha= 255-maskAlpha;
 

Index: fbpict.h
===================================================================
RCS file: /cvs/xserver/xserver/fb/fbpict.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- fbpict.h	11 Aug 2005 01:04:31 -0000	1.25
+++ fbpict.h	19 Sep 2005 03:41:46 -0000	1.26
@@ -66,7 +66,9 @@
 #define Green(x) (((x) >> 8) & 0xff)
 #define Blue(x) ((x) & 0xff)
 
-#define fbComposeGetSolid(pict, bits) { \
+#define IsRGB(pict) (PICT_FORMAT_TYPE((pict)->format) == PICT_TYPE_ARGB)
+
+#define fbComposeGetSolid(pict, dest, bits) { \
     FbBits	*__bits__; \
     FbStride	__stride__; \
     int		__bpp__; \
@@ -98,6 +100,12 @@
     /* manage missing src alpha */ \
     if ((pict)->pFormat->direct.alphaMask == 0) \
 	(bits) |= 0xff000000; \
+    /* Handle RGB/BGR mismatch */ \
+    if (dest && IsRGB(dest) != IsRGB(pict)) \
+        bits = (((bits & 0xff000000)) | \
+		((bits & 0x00ff0000) >> 16) | \
+		((bits & 0x0000ff00)) | \
+		((bits & 0x000000ff) << 16)); \
 }
 
 #define fbComposeGetStart(pict,x,y,type,stride,line,mul) {\



More information about the xserver-commit mailing list