summaryrefslogtreecommitdiff
path: root/composite
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
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')
-rw-r--r--composite/compalloc.c1
-rw-r--r--composite/compinit.c37
-rw-r--r--composite/compint.h13
-rw-r--r--composite/compwindow.c25
4 files changed, 67 insertions, 9 deletions
diff --git a/composite/compalloc.c b/composite/compalloc.c
index f63c475a7..8e2881e85 100644
--- a/composite/compalloc.c
+++ b/composite/compalloc.c
@@ -460,6 +460,7 @@ compFreePixmap (WindowPtr pWin)
{
DamageUnregister (&pWin->drawable, cw->damage);
cw->damageRegistered = FALSE;
+ DamageEmpty (cw->damage);
}
/*
* Move the parent-constrained border clip region back into
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;
diff --git a/composite/compint.h b/composite/compint.h
index 80496da30..78a138a74 100644
--- a/composite/compint.h
+++ b/composite/compint.h
@@ -75,7 +75,15 @@ typedef struct _CompSubwindows {
CompClientWindowPtr clients;
} CompSubwindowsRec, *CompSubwindowsPtr;
+#ifndef COMP_INCLUDE_RGB24_VISUAL
+#define COMP_INCLUDE_RGB24_VISUAL 0
+#endif
+
+#if COMP_INCLUDE_RGB24_VISUAL
#define NUM_COMP_ALTERNATE_VISUALS 2
+#else
+#define NUM_COMP_ALTERNATE_VISUALS 1
+#endif
typedef struct _CompScreen {
PositionWindowProcPtr PositionWindow;
@@ -99,6 +107,11 @@ typedef struct _CompScreen {
*/
ReparentWindowProcPtr ReparentWindow;
+ /*
+ * Colormaps for new visuals better not get installed
+ */
+ InstallColormapProcPtr InstallColormap;
+
ScreenBlockHandlerProcPtr BlockHandler;
CloseScreenProcPtr CloseScreen;
Bool damaged;
diff --git a/composite/compwindow.c b/composite/compwindow.c
index 29883666e..314593f25 100644
--- a/composite/compwindow.c
+++ b/composite/compwindow.c
@@ -667,15 +667,32 @@ compWindowUpdateAutomatic (WindowPtr pWin)
&subwindowMode,
serverClient,
&error);
-
+
+ /*
+ * First move the region from window to screen coordinates
+ */
REGION_TRANSLATE (pScreen, pRegion,
- pSrcPixmap->screen_x, pSrcPixmap->screen_y);
+ pWin->drawable.x, pWin->drawable.y);
+
+ /*
+ * Clip against the "real" border clip
+ */
REGION_INTERSECT (pScreen, pRegion, pRegion, &cw->borderClip);
+
+ /*
+ * Now translate from screen to pixmap coordinates
+ */
REGION_TRANSLATE (pScreen, pRegion,
-pSrcPixmap->screen_x, -pSrcPixmap->screen_y);
+ /*
+ * Clip the picture
+ */
SetPictureClipRegion (pSrcPicture, 0, 0, pRegion);
+ /*
+ * And paint
+ */
CompositePicture (PictOpSrc,
pSrcPicture,
0,
@@ -689,6 +706,10 @@ compWindowUpdateAutomatic (WindowPtr pWin)
pSrcPixmap->drawable.height);
FreePicture (pSrcPicture, 0);
FreePicture (pDstPicture, 0);
+ /*
+ * Empty the damage region. This has the nice effect of
+ * rendering the translations above harmless
+ */
DamageEmpty (cw->damage);
}