xserver/composite compinit.c,1.13,1.14
Keith Packard
xserver-commit at pdx.freedesktop.org
Fri Jun 4 09:10:52 PDT 2004
Committed by: keithp
Update of /cvs/xserver/xserver/composite
In directory pdx:/tmp/cvs-serv724/composite
Modified Files:
compinit.c
Log Message:
2004-06-04 Keith Packard <keithp at keithp.com>
* configure.ac:
* hw/Makefile.am:
Add top-level build support for GL X server (not working yet)
* composite/compinit.c: (compAddAlternateVisuals):
Fix a few allocation bugs with alternate visual ids
Allow for non-8/8/8 alternate visuals
* hw/kdrive/src/kshadow.c: (KdShadowSet):
Turn off any existing shadow before enabling it again
(avoids re-registering existing damage)
* miext/damage/damage.c: (damageRemoveDamage),
(damageInsertDamage), (DamageRegister), (DamageUnregister):
Add some validation code to catch re-registered damages
Index: compinit.c
===================================================================
RCS file: /cvs/xserver/xserver/composite/compinit.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- a/compinit.c 21 May 2004 03:32:27 -0000 1.13
+++ b/compinit.c 4 Jun 2004 16:10:50 -0000 1.14
@@ -171,7 +171,7 @@
* Allocate vid list for this depth
*/
vids[numAlternate] = xalloc (sizeof (VisualID));
- if (!vids)
+ if (!vids[numAlternate])
continue;
depths[numAlternate] = depth;
pPictFormats[numAlternate] = pPictFormat;
@@ -187,7 +187,8 @@
installedCmaps = xalloc (pScreen->maxInstalledCmaps * sizeof (XID));
if (!installedCmaps)
{
- xfree (vids);
+ for (alt = 0; alt < numAlternate; alt++)
+ xfree (vids[alt]);
return FALSE;
}
numInstalledCmaps = (*pScreen->ListInstalledColormaps) (pScreen,
@@ -201,14 +202,17 @@
(numVisuals + numAlternate) * sizeof (VisualRec));
if (!visuals)
{
- for (i = 0; i < numAlternate; i++)
- xfree (vids[i]);
+ for (alt = 0; alt < numAlternate; alt++)
+ xfree (vids[alt]);
xfree (installedCmaps);
return FALSE;
}
/*
- * Fix up the default colormaps
+ * Fix up any existing installed colormaps -- we'll assume that
+ * the only ones created so far have been installed. If this
+ * isn't true, we'll have to walk the resource database looking
+ * for all colormaps.
*/
for (i = 0; i < numInstalledCmaps; i++)
{
@@ -226,21 +230,17 @@
pScreen->visuals = visuals;
pScreen->numVisuals = numVisuals + numAlternate;
- for (i = 0; i < numAlternate; i++)
+ for (alt = 0; alt < numAlternate; alt++)
{
- DepthPtr depth = depths[i];
- PictFormatPtr pPictFormat = pPictFormats[i];
- VisualPtr visual = &visuals[numVisuals + i];
+ DepthPtr depth = depths[alt];
+ PictFormatPtr pPictFormat = pPictFormats[alt];
+ VisualPtr visual = &visuals[numVisuals + alt];
/*
* Initialize the visual
*/
visual->class = TrueColor;
visual->bitsPerRGBValue = 8;
- visual->ColormapEntries = (1 << 8);
- visual->nplanes = 24; /* follow GLX and set this to just the bits
- * used for the RGB value, not A
- */
visual->vid = FakeClientID (0);
visual->redMask = (((unsigned long) pPictFormat->direct.redMask) <<
@@ -255,18 +255,31 @@
visual->alphaMask = (((unsigned long) pPictFormat->direct.alphaMask) <<
pPictFormat->direct.alpha);
visual->offsetAlpha = pPictFormat->direct.alpha;
+ /*
+ * follow GLX and set nplanes to just the bits
+ * used for the RGB value, not A
+ */
+ visual->nplanes = Ones (visual->redMask |
+ visual->greenMask |
+ visual->blueMask);
+ /*
+ * find widest component
+ */
+ visual->ColormapEntries = (1 << max (Ones (visual->redMask),
+ max (Ones (visual->greenMask),
+ Ones (visual->blueMask))));
/*
* remember the visual ID to detect auto-update windows
*/
- cs->alternateVisuals[i] = visual->vid;
+ cs->alternateVisuals[alt] = visual->vid;
/*
* Fix up the depth
*/
- vids[i][0] = visual->vid;
+ vids[alt][0] = visual->vid;
depth->numVids = 1;
- depth->vids = vids[i];
+ depth->vids = vids[alt];
}
return TRUE;
}
More information about the xserver-commit
mailing list