summaryrefslogtreecommitdiff
path: root/mi/miexpose.c
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@freedesktop.org>2009-05-29 14:09:41 -0700
committerJeremy Huddleston <jeremyhu@freedesktop.org>2009-05-29 14:48:18 -0700
commitf2151f1b0dcbfec23488a29a7ea887fbfd53b760 (patch)
tree4308b4742db8c4179a2c7021301a07eef075bcce /mi/miexpose.c
parent7c158ffa766d32f5e8ec459693da5ef6ba0892e9 (diff)
XQuartz: Fix alpha to be 1 (screenshots bug, etc)
This is related to: bc964ff1e3f3d8ab590eab40d767c6241e9480d4 XQuartz: Stab at fixing the alpha 0/1 bug (screenshots, etc) by pulling in some old code that got gutted from rootless. which was on the 1.4 branch and implemented in fbPaintWindow. Now that fbPaintWindow is gone, this is now in miPaintWindow(). (cherry picked from commit 032173f693f75385a40e144ffe2b7b5378bb6f2e)
Diffstat (limited to 'mi/miexpose.c')
-rw-r--r--mi/miexpose.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/mi/miexpose.c b/mi/miexpose.c
index 2c43d9824..6ce56ee85 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -522,7 +522,7 @@ void
miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
- ChangeGCVal gcval[5];
+ ChangeGCVal gcval[6];
BITS32 gcmask;
GCPtr pGC;
int i;
@@ -590,18 +590,35 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
gcval[0].val = GXcopy;
gcmask = GCFunction;
+#ifdef ROOTLESS_SAFEALPHA
+/* Bit mask for alpha channel with a particular number of bits per
+ * pixel. Note that we only care for 32bpp data. Mac OS X uses planar
+ * alpha for 16bpp.
+ */
+#define RootlessAlphaMask(bpp) ((bpp) == 32 ? 0xFF000000 : 0)
+#endif
+
if (solid)
{
+#ifdef ROOTLESS_SAFEALPHA
+ gcval[1].val = fill.pixel | RootlessAlphaMask(pWin->drawable.bitsPerPixel);
+#else
gcval[1].val = fill.pixel;
+#endif
gcval[2].val = FillSolid;
gcmask |= GCForeground | GCFillStyle;
}
else
{
- gcval[1].val = FillTiled;
- gcval[2].ptr = (pointer)fill.pixmap;
- gcval[3].val = tile_x_off;
- gcval[4].val = tile_y_off;
+ int c=1;
+#ifdef ROOTLESS_SAFEALPHA
+ gcval[c++].val = ((CARD32)-1) & ~RootlessAlphaMask(pWin->drawable.bitsPerPixel);
+ gcmask |= GCPlaneMask;
+#endif
+ gcval[c++].val = FillTiled;
+ gcval[c++].ptr = (pointer)fill.pixmap;
+ gcval[c++].val = tile_x_off;
+ gcval[c++].val = tile_y_off;
gcmask |= GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin;
}