summaryrefslogtreecommitdiff
path: root/composite/compinit.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2004-08-13 08:16:14 +0000
committerKeith Packard <keithp@keithp.com>2004-08-13 08:16:14 +0000
commita29bfbd3d0a5d39ccee5b83ac1ba632091b031bb (patch)
treeb087d11fa09d5f36f7a3b34e6333bfa8b0e6d50c /composite/compinit.c
parent24bed5cff908a6f8b1857e3dadac22d6db54c69e (diff)
Empty damage object when freeing pixmap.
Wrap InstallColormap so that the DDX doesn't see colormaps from our ARGB visual (avoids lovely green tint to screen). Also, set visual->nplanes of ARGB visual to all used (including alpha) planes so DIX can set pixel values correctly. Translate automatic update regions correctly to account for borders When nplanes == 32 (ARGB visuals), mask in all ones for alpha values to allocated pixel values. Remove redundant fbAddTraps declaration Fix fbCopyWindow to work on non-screen pixmaps (not needed yet) Replace broken clipping code with that from modular tree. Respect subWindowMode.
Diffstat (limited to 'composite/compinit.c')
-rw-r--r--composite/compinit.c37
1 files changed, 30 insertions, 7 deletions
diff --git a/composite/compinit.c b/composite/compinit.c
index 759c1d3f9..5109a74fa 100644
--- a/composite/compinit.c
+++ b/composite/compinit.c
@@ -40,6 +40,7 @@ compCloseScreen (int index, ScreenPtr pScreen)
pScreen->CloseScreen = cs->CloseScreen;
pScreen->BlockHandler = cs->BlockHandler;
+ pScreen->InstallColormap = cs->InstallColormap;
pScreen->ReparentWindow = cs->ReparentWindow;
pScreen->MoveWindow = cs->MoveWindow;
pScreen->ResizeWindow = cs->ResizeWindow;
@@ -60,6 +61,23 @@ compCloseScreen (int index, ScreenPtr pScreen)
}
static void
+compInstallColormap (ColormapPtr pColormap)
+{
+ VisualPtr pVisual = pColormap->pVisual;
+ ScreenPtr pScreen = pColormap->pScreen;
+ CompScreenPtr cs = GetCompScreen (pScreen);
+ int a;
+
+ for (a = 0; a < NUM_COMP_ALTERNATE_VISUALS; a++)
+ if (pVisual->vid == cs->alternateVisuals[a])
+ return;
+ pScreen->InstallColormap = cs->InstallColormap;
+ (*pScreen->InstallColormap) (pColormap);
+ cs->InstallColormap = pScreen->InstallColormap;
+ pScreen->InstallColormap = compInstallColormap;
+}
+
+static void
compScreenUpdate (ScreenPtr pScreen)
{
CompScreenPtr cs = GetCompScreen (pScreen);
@@ -126,7 +144,9 @@ typedef struct _alternateVisual {
} CompAlternateVisual;
static CompAlternateVisual altVisuals[NUM_COMP_ALTERNATE_VISUALS] = {
+#if COMP_INCLUDE_RGB24_VISUAL
{ 24, PICT_r8g8b8 },
+#endif
{ 32, PICT_a8r8g8b8 },
};
@@ -164,10 +184,6 @@ compAddAlternateVisuals (ScreenPtr pScreen, CompScreenPtr cs)
continue;
/*
- * Ok, create a visual id for this format
- */
- cs->alternateVisuals[numAlternate] = FakeClientID (0);
- /*
* Allocate vid list for this depth
*/
vids[numAlternate] = xalloc (sizeof (VisualID));
@@ -235,6 +251,7 @@ compAddAlternateVisuals (ScreenPtr pScreen, CompScreenPtr cs)
DepthPtr depth = depths[alt];
PictFormatPtr pPictFormat = pPictFormats[alt];
VisualPtr visual = &visuals[numVisuals + alt];
+ unsigned long alphaMask;
/*
* Initialize the visual
@@ -249,16 +266,19 @@ compAddAlternateVisuals (ScreenPtr pScreen, CompScreenPtr cs)
pPictFormat->direct.green);
visual->blueMask = (((unsigned long) pPictFormat->direct.blueMask) <<
pPictFormat->direct.blue);
+ alphaMask = (((unsigned long) pPictFormat->direct.alphaMask) <<
+ pPictFormat->direct.alpha);
visual->offsetRed = pPictFormat->direct.red;
visual->offsetGreen = pPictFormat->direct.green;
visual->offsetBlue = pPictFormat->direct.blue;
/*
- * follow GLX and set nplanes to just the bits
- * used for the RGB value, not A
+ * Include A bits in this (unlike GLX which includes only RGB)
+ * This lets DIX compute suitable masks for colormap allocations
*/
visual->nplanes = Ones (visual->redMask |
visual->greenMask |
- visual->blueMask);
+ visual->blueMask |
+ alphaMask);
/*
* find widest component
*/
@@ -355,6 +375,9 @@ compScreenInit (ScreenPtr pScreen)
cs->ReparentWindow = pScreen->ReparentWindow;
pScreen->ReparentWindow = compReparentWindow;
+ cs->InstallColormap = pScreen->InstallColormap;
+ pScreen->InstallColormap = compInstallColormap;
+
cs->BlockHandler = pScreen->BlockHandler;
pScreen->BlockHandler = compBlockHandler;