xserver/dix colormap.c,3.14,3.15

Keith Packard xserver-commit at pdx.freedesktop.org
Tue Feb 8 14:40:54 PST 2005


Committed by: keithp

Update of /cvs/xserver/xserver/dix
In directory gabe:/tmp/cvs-serv18572/dix

Modified Files:
	colormap.c 
Log Message:
2005-02-08  Keith Packard  <keithp at keithp.com>

	* dix/colormap.c: (CopyFree), (AllocColor), (AllocDirect):
	Change where the 'alpha bits' live in visuals.


Index: colormap.c
===================================================================
RCS file: /cvs/xserver/xserver/dix/colormap.c,v
retrieving revision 3.14
retrieving revision 3.15
diff -u -d -r3.14 -r3.15
--- colormap.c	14 Feb 2004 15:19:54 -0000	3.14
+++ colormap.c	8 Feb 2005 22:40:51 -0000	3.15
@@ -192,9 +192,10 @@
 #define NUMRED(vis) ((vis->redMask >> vis->offsetRed) + 1)
 #define NUMGREEN(vis) ((vis->greenMask >> vis->offsetGreen) + 1)
 #define NUMBLUE(vis) ((vis->blueMask >> vis->offsetBlue) + 1)
-#ifdef COMPOSITE
-#define NUMALPHA(vis)	((vis->alphaMask >> vis->offsetAlpha) + 1)
-#define ALPHAMASK(vis)	(vis->alphaMask)
+
+#if COMPOSITE
+#define ALPHAMASK(vis)	((vis)->nplanes < 32 ? 0 : \
+			 (CARD32) ~((vis)->redMask|(vis)->greenMask|(vis)->blueMask))
 #else
 #define NUMALPHA(vis)	0
 #define ALPHAMASK(vis)	0
@@ -601,7 +602,7 @@
 static void
 CopyFree (int channel, int client, ColormapPtr pmapSrc, ColormapPtr pmapDst)
 {
-    int		z, npix, oldFree;
+    int		z, npix;
     EntryPtr	pentSrcFirst, pentDstFirst;
     EntryPtr	pentSrc, pentDst;
     Pixel	*ppix;
@@ -615,21 +616,18 @@
 	npix = (pmapSrc->numPixelsRed)[client];
 	pentSrcFirst = pmapSrc->red;
 	pentDstFirst = pmapDst->red;
-	oldFree = pmapSrc->freeRed;
 	break;
       case GREENMAP:
 	ppix = (pmapSrc->clientPixelsGreen)[client];
 	npix = (pmapSrc->numPixelsGreen)[client];
 	pentSrcFirst = pmapSrc->green;
 	pentDstFirst = pmapDst->green;
-	oldFree = pmapSrc->freeGreen;
 	break;
       case BLUEMAP:
 	ppix = (pmapSrc->clientPixelsBlue)[client];
 	npix = (pmapSrc->numPixelsBlue)[client];
 	pentSrcFirst = pmapSrc->blue;
 	pentDstFirst = pmapDst->blue;
-	oldFree = pmapSrc->freeBlue;
 	break;
     }
     nalloc = 0;
@@ -859,10 +857,8 @@
 	pixB = FindBestPixel(pmap->blue, NUMBLUE(pVisual), &rgb, BLUEMAP);
 	*pPix = (pixR << pVisual->offsetRed) |
 		(pixG << pVisual->offsetGreen) |
-		(pixB << pVisual->offsetBlue);
-#ifdef COMPOSITE
-	*pPix |= pVisual->alphaMask;
-#endif
+		(pixB << pVisual->offsetBlue) |
+		ALPHAMASK(pVisual);
 	*pred = pmap->red[pixR].co.local.red;
 	*pgreen = pmap->green[pixG].co.local.green;
 	*pblue = pmap->blue[pixB].co.local.blue;
@@ -952,10 +948,7 @@
 	    (void)FreeCo(pmap, client, REDMAP, 1, &pixR, (Pixel)0);
 	    return (BadAlloc);
 	}
-	*pPix = pixR | pixG | pixB;
-#ifdef COMPOSITE
-	*pPix |= pVisual->alphaMask;
-#endif
+	*pPix = pixR | pixG | pixB | ALPHAMASK(pVisual);
 	break;
     }
 
@@ -1880,7 +1873,7 @@
     pmap->freeBlue -= npixB;
 #ifdef COMPOSITE
     for (pDst = pixels; pDst < pixels + c; pDst++)
-	*pDst |= pmap->pVisual->alphaMask;
+	*pDst |= ALPHAMASK(pmap->pVisual);
 #endif
 
     DEALLOCATE_LOCAL(ppixBlue);



More information about the xserver-commit mailing list