XQuartz: Fix alpha to be 1 (screenshots bug, etc)

This is related to: bc964ff1e3
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().
This commit is contained in:
Jeremy Huddleston 2009-05-29 14:09:41 -07:00
parent 4975c08725
commit 032173f693
2 changed files with 23 additions and 6 deletions

View File

@ -1676,7 +1676,7 @@ if test "x$XQUARTZ" = xyes; then
AC_CHECK_LIB([Xplugin],[xp_init],[:])
CFLAGS="${CFLAGS} -DROOTLESS_WORKAROUND -DNO_ALLOCA"
CFLAGS="${CFLAGS} -DROOTLESS_WORKAROUND -DROOTLESS_SAFEALPHA -DNO_ALLOCA"
PKG_CHECK_MODULES(XPBPROXY, [applewmproto >= 1.2] [applewm >= 1.2] xfixes fixesproto x11)

View File

@ -535,7 +535,7 @@ _X_EXPORT 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;
@ -603,18 +603,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;
}