[xserver-commit] xserver/dix colormap.c,3.12,3.13
Keith Packard
xserver-commit@pdx.freedesktop.org
Thu, 15 Jan 2004 00:53:47 -0800
Committed by: keithp
Update of /cvs/xserver/xserver/dix
In directory pdx:/tmp/cvs-serv2073/dix
Modified Files:
colormap.c
Log Message:
2004-01-15 Keith Packard <keithp@keithp.com>
* composite/compinit.c: (compAddArgbVisual):
* dix/colormap.c:
* fb/fbcmap.c: (fbInitVisuals):
* include/scrnintstr.h:
Add alphaMask to visual so that pixel allocations for ARGB
visuals can include an opaque pixel value.
Index: colormap.c
===================================================================
RCS file: /cvs/xserver/xserver/dix/colormap.c,v
retrieving revision 3.12
retrieving revision 3.13
diff -u -d -r3.12 -r3.13
--- colormap.c 11 Sep 2003 05:12:50 -0000 3.12
+++ colormap.c 15 Jan 2004 08:53:44 -0000 3.13
@@ -224,7 +224,15 @@
#define NUMRED(vis) ((vis->redMask >> vis->offsetRed) + 1)
#define NUMGREEN(vis) ((vis->greenMask >> vis->offsetGreen) + 1)
#define NUMBLUE(vis) ((vis->blueMask >> vis->offsetBlue) + 1)
-#define RGBMASK(vis) (vis->redMask | vis->greenMask | vis->blueMask)
+#ifdef COMPOSITE
+#define NUMALPHA(vis) ((vis->alphaMask >> vis->offsetAlpha) + 1)
+#define ALPHAMASK(vis) (vis->alphaMask)
+#else
+#define NUMALPHA(vis) 0
+#define ALPHAMASK(vis) 0
+#endif
+
+#define RGBMASK(vis) (vis->redMask | vis->greenMask | vis->blueMask | ALPHAMASK(vis))
/* GetNextBitsOrBreak(bits, mask, base) --
* (Suggestion: First read the macro, then read this explanation.
@@ -903,6 +911,9 @@
*pPix = (pixR << pVisual->offsetRed) |
(pixG << pVisual->offsetGreen) |
(pixB << pVisual->offsetBlue);
+#ifdef COMPOSITE
+ *pPix |= pVisual->alphaMask;
+#endif
*pred = pmap->red[pixR].co.local.red;
*pgreen = pmap->green[pixG].co.local.green;
*pblue = pmap->blue[pixB].co.local.blue;
@@ -993,6 +1004,9 @@
return (BadAlloc);
}
*pPix = pixR | pixG | pixB;
+#ifdef COMPOSITE
+ *pPix |= pVisual->alphaMask;
+#endif
break;
}
@@ -1970,6 +1984,10 @@
}
pmap->numPixelsBlue[client] += npixB;
pmap->freeBlue -= npixB;
+#ifdef COMPOSITE
+ for (pDst = pixels; pDst < pixels + c; pDst++)
+ *pDst |= pmap->pVisual->alphaMask;
+#endif
DEALLOCATE_LOCAL(ppixBlue);
DEALLOCATE_LOCAL(ppixGreen);