summaryrefslogtreecommitdiff
path: root/cfb
diff options
context:
space:
mode:
authorKaleb Keithley <kaleb@freedesktop.org>2003-11-14 16:48:57 +0000
committerKaleb Keithley <kaleb@freedesktop.org>2003-11-14 16:48:57 +0000
commit9508a382f8a9f241dab097d921b6d290c1c3a776 (patch)
treefa456480bae7040c3f971a70b390f2d091c680b5 /cfb
parentded6147bfb5d75ff1e67c858040a628b61bc17d1 (diff)
Initial revision
Diffstat (limited to 'cfb')
-rw-r--r--cfb/cfb16.h94
-rw-r--r--cfb/cfb24.h94
-rw-r--r--cfb/cfb32.h94
-rw-r--r--cfb/cfbcppl.c486
-rw-r--r--cfb/cfbunmap.h152
5 files changed, 920 insertions, 0 deletions
diff --git a/cfb/cfb16.h b/cfb/cfb16.h
new file mode 100644
index 000000000..3d51cd142
--- /dev/null
+++ b/cfb/cfb16.h
@@ -0,0 +1,94 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfb16.h,v 1.4 1998/11/28 10:42:50 dawes Exp $ */
+/*
+ * Copyright (C) 1994-1998 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ */
+
+#ifndef _CFB16_H_
+#define _CFB16_H_
+
+/*
+ * C's preprocessing language substitutes >text<, not values...
+ */
+
+#ifdef OLDPSZ
+# undef OLDPSZ
+#endif
+
+#ifdef PSZ
+
+# if (PSZ == 8)
+# define OLDPSZ 8
+# endif
+
+# if (PSZ == 16)
+# define OLDPSZ 16
+# endif
+
+# if (PSZ == 24)
+# define OLDPSZ 24
+# endif
+
+# if (PSZ == 32)
+# define OLDPSZ 32
+# endif
+
+# ifndef OLDPSZ
+ /* Maybe an #error here ? */
+# endif
+
+# undef PSZ
+
+#endif
+
+#define PSZ 16
+#define CFB_PROTOTYPES_ONLY
+#include "cfb.h"
+#undef CFB_PROTOTYPES_ONLY
+#include "cfbunmap.h"
+
+#undef PSZ
+#ifdef OLDPSZ
+
+# if (OLDPSZ == 8)
+# define PSZ 8
+# endif
+
+# if (OLDPSZ == 16)
+# define PSZ 16
+# endif
+
+# if (OLDPSZ == 24)
+# define PSZ 24
+# endif
+
+# if (OLDPSZ == 32)
+# define PSZ 32
+# endif
+
+# undef OLDPSZ
+
+#endif
+
+#endif /* _CFB16_H_ */
diff --git a/cfb/cfb24.h b/cfb/cfb24.h
new file mode 100644
index 000000000..f1876f74d
--- /dev/null
+++ b/cfb/cfb24.h
@@ -0,0 +1,94 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfb24.h,v 1.4 1998/11/28 10:42:51 dawes Exp $ */
+/*
+ * Copyright (C) 1994-1998 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ */
+
+#ifndef _CFB24_H_
+#define _CFB24_H_
+
+/*
+ * C's preprocessing language substitutes >text<, not values...
+ */
+
+#ifdef OLDPSZ
+# undef OLDPSZ
+#endif
+
+#ifdef PSZ
+
+# if (PSZ == 8)
+# define OLDPSZ 8
+# endif
+
+# if (PSZ == 16)
+# define OLDPSZ 16
+# endif
+
+# if (PSZ == 24)
+# define OLDPSZ 24
+# endif
+
+# if (PSZ == 32)
+# define OLDPSZ 32
+# endif
+
+# ifndef OLDPSZ
+ /* Maybe an #error here ? */
+# endif
+
+# undef PSZ
+
+#endif
+
+#define PSZ 24
+#define CFB_PROTOTYPES_ONLY
+#include "cfb.h"
+#undef CFB_PROTOTYPES_ONLY
+#include "cfbunmap.h"
+
+#undef PSZ
+#ifdef OLDPSZ
+
+# if (OLDPSZ == 8)
+# define PSZ 8
+# endif
+
+# if (OLDPSZ == 16)
+# define PSZ 16
+# endif
+
+# if (OLDPSZ == 24)
+# define PSZ 24
+# endif
+
+# if (OLDPSZ == 32)
+# define PSZ 32
+# endif
+
+# undef OLDPSZ
+
+#endif
+
+#endif /* _CFB24_H_ */
diff --git a/cfb/cfb32.h b/cfb/cfb32.h
new file mode 100644
index 000000000..5ea4c13c8
--- /dev/null
+++ b/cfb/cfb32.h
@@ -0,0 +1,94 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfb32.h,v 1.4 1998/11/28 10:42:51 dawes Exp $ */
+/*
+ * Copyright (C) 1994-1998 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ */
+
+#ifndef _CFB32_H_
+#define _CFB32_H_
+
+/*
+ * C's preprocessing language substitutes >text<, not values...
+ */
+
+#ifdef OLDPSZ
+# undef OLDPSZ
+#endif
+
+#ifdef PSZ
+
+# if (PSZ == 8)
+# define OLDPSZ 8
+# endif
+
+# if (PSZ == 16)
+# define OLDPSZ 16
+# endif
+
+# if (PSZ == 24)
+# define OLDPSZ 24
+# endif
+
+# if (PSZ == 32)
+# define OLDPSZ 32
+# endif
+
+# ifndef OLDPSZ
+ /* Maybe an #error here ? */
+# endif
+
+# undef PSZ
+
+#endif
+
+#define PSZ 32
+#define CFB_PROTOTYPES_ONLY
+#include "cfb.h"
+#undef CFB_PROTOTYPES_ONLY
+#include "cfbunmap.h"
+
+#undef PSZ
+#ifdef OLDPSZ
+
+# if (OLDPSZ == 8)
+# define PSZ 8
+# endif
+
+# if (OLDPSZ == 16)
+# define PSZ 16
+# endif
+
+# if (OLDPSZ == 24)
+# define PSZ 24
+# endif
+
+# if (OLDPSZ == 32)
+# define PSZ 32
+# endif
+
+# undef OLDPSZ
+
+#endif
+
+#endif /* _CFB32_H_ */
diff --git a/cfb/cfbcppl.c b/cfb/cfbcppl.c
new file mode 100644
index 000000000..20ef24e1c
--- /dev/null
+++ b/cfb/cfbcppl.c
@@ -0,0 +1,486 @@
+/*
+ * $TOG: cfb8cppl.c /main/16 1998/02/09 14:04:13 kaleb $
+ *
+Copyright 1990, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * Author: Keith Packard, MIT X Consortium
+ */
+/* $XFree86: xc/programs/Xserver/cfb/cfbcppl.c,v 1.6 2001/12/14 19:59:22 dawes Exp $ */
+
+#include "X.h"
+#include "Xmd.h"
+#include "gcstruct.h"
+#include "window.h"
+#include "pixmapstr.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "cfb.h"
+#if PSZ == 8
+#undef PSZ /* for maskbits.h */
+#include "maskbits.h"
+#define PSZ 8
+#include "mergerop.h"
+#endif
+
+
+void
+cfbCopyImagePlane (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, planemask)
+ DrawablePtr pSrcDrawable;
+ DrawablePtr pDstDrawable;
+ int rop;
+ RegionPtr prgnDst;
+ DDXPointPtr pptSrc;
+ unsigned long planemask;
+{
+#if PSZ == 8
+ cfbCopyPlane8to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
+ (unsigned long) ~0L, planemask);
+#endif
+#if PSZ == 16
+ cfbCopyPlane16to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
+ (unsigned long) ~0L, planemask);
+#endif
+#if PSZ == 24
+ cfbCopyPlane24to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
+ (unsigned long) ~0L, planemask);
+#endif
+#if PSZ == 32
+ cfbCopyPlane32to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
+ (unsigned long) ~0L, planemask);
+#endif
+}
+
+#if PSZ == 8
+
+#if BITMAP_BIT_ORDER == MSBFirst
+#define LeftMost (MFB_PPW-1)
+#define StepBit(bit, inc) ((bit) -= (inc))
+#else
+#define LeftMost 0
+#define StepBit(bit, inc) ((bit) += (inc))
+#endif
+
+#define GetBits(psrc, nBits, curBit, bitPos, bits) {\
+ bits = 0; \
+ while (nBits--) \
+ { \
+ bits |= (PixelType)(((*psrc++ >> bitPos) & 1)) << curBit; \
+ StepBit (curBit, 1); \
+ } \
+}
+
+void
+cfbCopyPlane8to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, planemask, bitPlane)
+ DrawablePtr pSrcDrawable;
+ DrawablePtr pDstDrawable;
+ int rop;
+ RegionPtr prgnDst;
+ DDXPointPtr pptSrc;
+ unsigned long planemask;
+ unsigned long bitPlane;
+{
+ int srcx, srcy, dstx, dsty, width, height;
+ unsigned char *psrcBase;
+ PixelType *pdstBase;
+ int widthSrc, widthDst;
+ unsigned char *psrcLine;
+ PixelType *pdstLine;
+ register unsigned char *psrc;
+ register int i;
+ register int curBit;
+ register int bitPos;
+ register CfbBits bits;
+ register PixelType *pdst;
+ PixelType startmask, endmask;
+ int niStart = 0, niEnd = 0;
+ int bitStart = 0, bitEnd = 0;
+ int nl, nlMiddle;
+ int nbox;
+ BoxPtr pbox;
+ MROP_DECLARE()
+
+ if (!(planemask & 1))
+ return;
+
+ if (rop != GXcopy)
+ MROP_INITIALIZE (rop, planemask);
+
+ cfbGetByteWidthAndPointer (pSrcDrawable, widthSrc, psrcBase)
+
+ mfbGetPixelWidthAndPointer (pDstDrawable, widthDst, pdstBase)
+
+ bitPos = ffs (bitPlane) - 1;
+
+ nbox = REGION_NUM_RECTS(prgnDst);
+ pbox = REGION_RECTS(prgnDst);
+ while (nbox--)
+ {
+ dstx = pbox->x1;
+ dsty = pbox->y1;
+ srcx = pptSrc->x;
+ srcy = pptSrc->y;
+ width = pbox->x2 - pbox->x1;
+ height = pbox->y2 - pbox->y1;
+ pbox++;
+ pptSrc++;
+ psrcLine = psrcBase + srcy * widthSrc + srcx;
+ pdstLine = mfbScanline(pdstBase, dstx, dsty, widthDst);
+ dstx &= MFB_PIM;
+ if (dstx + width <= MFB_PPW)
+ {
+ maskpartialbits(dstx, width, startmask);
+ nlMiddle = 0;
+ endmask = 0;
+ }
+ else
+ {
+ maskbits (dstx, width, startmask, endmask, nlMiddle);
+ }
+ if (startmask)
+ {
+ niStart = min(MFB_PPW - dstx, width);
+ bitStart = LeftMost;
+ StepBit (bitStart, dstx);
+ }
+ if (endmask)
+ {
+ niEnd = (dstx + width) & MFB_PIM;
+ bitEnd = LeftMost;
+ }
+ if (rop == GXcopy)
+ {
+ while (height--)
+ {
+ psrc = psrcLine;
+ pdst = pdstLine;
+ psrcLine += widthSrc;
+ mfbScanlineInc(pdstLine, widthDst);
+ if (startmask)
+ {
+ i = niStart;
+ curBit = bitStart;
+ GetBits (psrc, i, curBit, bitPos, bits);
+ *pdst = (*pdst & ~startmask) | bits;
+ pdst++;
+ }
+ nl = nlMiddle;
+ while (nl--)
+ {
+ i = MFB_PPW;
+ curBit = LeftMost;
+ GetBits (psrc, i, curBit, bitPos, bits);
+ *pdst++ = bits;
+ }
+ if (endmask)
+ {
+ i = niEnd;
+ curBit = bitEnd;
+ GetBits (psrc, i, curBit, bitPos, bits);
+ *pdst = (*pdst & ~endmask) | bits;
+ }
+ }
+ }
+ else
+ {
+ while (height--)
+ {
+ psrc = psrcLine;
+ pdst = pdstLine;
+ psrcLine += widthSrc;
+ mfbScanlineInc(pdstLine, widthDst);
+ if (startmask)
+ {
+ i = niStart;
+ curBit = bitStart;
+ GetBits (psrc, i, curBit, bitPos, bits);
+ *pdst = MROP_MASK(bits, *pdst, startmask);
+ pdst++;
+ }
+ nl = nlMiddle;
+ while (nl--)
+ {
+ i = MFB_PPW;
+ curBit = LeftMost;
+ GetBits (psrc, i, curBit, bitPos, bits);
+ *pdst = MROP_SOLID(bits, *pdst);
+ pdst++;
+ }
+ if (endmask)
+ {
+ i = niEnd;
+ curBit = bitEnd;
+ GetBits (psrc, i, curBit, bitPos, bits);
+ *pdst = MROP_MASK (bits, *pdst, endmask);
+ }
+ }
+ }
+ }
+}
+
+#else /* PSZ == 8 */
+
+#define mfbmaskbits(x, w, startmask, endmask, nlw) \
+ startmask = starttab[(x)&0x1f]; \
+ endmask = endtab[((x)+(w)) & 0x1f]; \
+ if (startmask) \
+ nlw = (((w) - (32 - ((x)&0x1f))) >> 5); \
+ else \
+ nlw = (w) >> 5;
+
+#define mfbmaskpartialbits(x, w, mask) \
+ mask = partmasks[(x)&0x1f][(w)&0x1f];
+
+#define LeftMost 0
+#define StepBit(bit, inc) ((bit) += (inc))
+
+
+#if PSZ == 24
+#define GetBits(psrc, nBits, curBit, bitPos, bits) {\
+ bits = 0; \
+ while (nBits--) \
+ { \
+ if (bitPos < 8) \
+ { \
+ bits |= ((*psrc++ >> bitPos) & 1) << curBit; \
+ psrc += 2; \
+ } \
+ else if (bitPos < 16) \
+ { \
+ psrc++; \
+ bits |= ((*psrc++ >> (bitPos - 8)) & 1) << curBit; \
+ psrc++; \
+ } \
+ else \
+ { \
+ psrc += 2; \
+ bits |= ((*psrc++ >> (bitPos - 16)) & 1) << curBit; \
+ } \
+ StepBit (curBit, 1); \
+ } \
+}
+#else
+#define GetBits(psrc, nBits, curBit, bitPos, bits) {\
+ bits = 0; \
+ while (nBits--) \
+ { \
+ bits |= ((*psrc++ >> bitPos) & 1) << curBit; \
+ StepBit (curBit, 1); \
+ } \
+}
+#endif
+
+void
+#if PSZ == 16
+cfbCopyPlane16to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
+ planemask, bitPlane)
+#endif
+#if PSZ == 24
+cfbCopyPlane24to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
+ planemask, bitPlane)
+#endif
+#if PSZ == 32
+cfbCopyPlane32to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc,
+ planemask, bitPlane)
+#endif
+ DrawablePtr pSrcDrawable;
+ DrawablePtr pDstDrawable;
+ int rop;
+ RegionPtr prgnDst;
+ DDXPointPtr pptSrc;
+ unsigned long planemask;
+ unsigned long bitPlane;
+{
+ int srcx, srcy, dstx, dsty, width, height;
+ CfbBits *psrcBase;
+ CfbBits *pdstBase;
+ int widthSrc, widthDst;
+#if PSZ == 16
+ unsigned short *psrcLine;
+ register unsigned short *psrc;
+#endif
+#if PSZ == 24
+ unsigned char *psrcLine;
+ register unsigned char *psrc;
+#endif
+#if PSZ == 32
+ unsigned int *psrcLine;
+ register unsigned int *psrc;
+#endif
+ unsigned int *pdstLine;
+ register unsigned int *pdst;
+ register int i;
+ register int curBit;
+ register int bitPos;
+ register unsigned int bits;
+ unsigned int startmask, endmask;
+ int niStart = 0, niEnd = 0;
+ int bitStart = 0, bitEnd = 0;
+ int nl, nlMiddle;
+ int nbox;
+ BoxPtr pbox;
+ int result;
+
+ extern int starttab[32], endtab[32];
+ extern unsigned int partmasks[32][32];
+
+
+ if (!(planemask & 1))
+ return;
+
+ /* must explicitly ask for "int" widths, as code below expects it */
+ /* on some machines (Alpha), "long" and "int" are not the same size */
+ cfbGetTypedWidthAndPointer (pSrcDrawable, widthSrc, psrcBase, int, CfbBits)
+ cfbGetTypedWidthAndPointer (pDstDrawable, widthDst, pdstBase, int, CfbBits)
+
+#if PSZ == 16
+ widthSrc <<= 1;
+#endif
+#if PSZ == 24
+ widthSrc <<= 2;
+#endif
+
+ bitPos = ffs (bitPlane) - 1;
+
+ nbox = REGION_NUM_RECTS(prgnDst);
+ pbox = REGION_RECTS(prgnDst);
+ while (nbox--)
+ {
+ dstx = pbox->x1;
+ dsty = pbox->y1;
+ srcx = pptSrc->x;
+ srcy = pptSrc->y;
+ width = pbox->x2 - pbox->x1;
+ height = pbox->y2 - pbox->y1;
+ pbox++;
+ pptSrc++;
+#if PSZ == 16
+ psrcLine = (unsigned short *)psrcBase + srcy * widthSrc + srcx;
+#endif
+#if PSZ == 24
+ psrcLine = (unsigned char *)psrcBase + srcy * widthSrc + srcx * 3;
+#endif
+#if PSZ == 32
+ psrcLine = (unsigned int *)psrcBase + srcy * widthSrc + srcx;
+#endif
+ pdstLine = (unsigned int *)pdstBase + dsty * widthDst + (dstx >> 5);
+ if (dstx + width <= 32)
+ {
+ mfbmaskpartialbits(dstx, width, startmask);
+ nlMiddle = 0;
+ endmask = 0;
+ }
+ else
+ {
+ mfbmaskbits (dstx, width, startmask, endmask, nlMiddle);
+ }
+ if (startmask)
+ {
+ niStart = 32 - (dstx & 0x1f);
+ bitStart = LeftMost;
+ StepBit (bitStart, (dstx & 0x1f));
+ }
+ if (endmask)
+ {
+ niEnd = (dstx + width) & 0x1f;
+ bitEnd = LeftMost;
+ }
+ if (rop == GXcopy)
+ {
+ while (height--)
+ {
+ psrc = psrcLine;
+ pdst = pdstLine;
+ psrcLine += widthSrc;
+ pdstLine += widthDst;
+ if (startmask)
+ {
+ i = niStart;
+ curBit = bitStart;
+ GetBits (psrc, i, curBit, bitPos, bits);
+
+ *pdst = (*pdst & ~startmask) | bits;
+ pdst++;
+ }
+ nl = nlMiddle;
+ while (nl--)
+ {
+ i = 32;
+ curBit = LeftMost;
+ GetBits (psrc, i, curBit, bitPos, bits);
+ *pdst++ = bits;
+ }
+ if (endmask)
+ {
+ i = niEnd;
+ curBit = bitEnd;
+ GetBits (psrc, i, curBit, bitPos, bits);
+
+ *pdst = (*pdst & ~endmask) | bits;
+ }
+ }
+ }
+ else
+ {
+ while (height--)
+ {
+ psrc = psrcLine;
+ pdst = pdstLine;
+ psrcLine += widthSrc;
+ pdstLine += widthDst;
+ if (startmask)
+ {
+ i = niStart;
+ curBit = bitStart;
+ GetBits (psrc, i, curBit, bitPos, bits);
+ DoRop (result, rop, bits, *pdst);
+
+ *pdst = (*pdst & ~startmask) |
+ (result & startmask);
+ pdst++;
+ }
+ nl = nlMiddle;
+ while (nl--)
+ {
+ i = 32;
+ curBit = LeftMost;
+ GetBits (psrc, i, curBit, bitPos, bits);
+ DoRop (result, rop, bits, *pdst);
+ *pdst = result;
+ ++pdst;
+ }
+ if (endmask)
+ {
+ i = niEnd;
+ curBit = bitEnd;
+ GetBits (psrc, i, curBit, bitPos, bits);
+ DoRop (result, rop, bits, *pdst);
+
+ *pdst = (*pdst & ~endmask) |
+ (result & endmask);
+ }
+ }
+ }
+ }
+}
+
+#endif /* PSZ == 8 */
diff --git a/cfb/cfbunmap.h b/cfb/cfbunmap.h
new file mode 100644
index 000000000..e94f45482
--- /dev/null
+++ b/cfb/cfbunmap.h
@@ -0,0 +1,152 @@
+/* $XFree86: xc/programs/Xserver/cfb/cfbunmap.h,v 1.5 1999/12/13 02:13:07 robin Exp $ */
+/*
+ * Copyright (C) 1994-1998 The XFree86 Project, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ */
+
+/*
+ * Unmap names
+ */
+
+#undef CFBNAME
+#undef CATNAME
+
+#undef QuartetBitsTable
+#undef QuartetPixelMaskTable
+#undef cfb8ClippedLineCopy
+#undef cfb8ClippedLineGeneral
+#undef cfb8ClippedLineXor
+#undef cfb8LineSS1Rect
+#undef cfb8LineSS1RectCopy
+#undef cfb8LineSS1RectGeneral
+#undef cfb8LineSS1RectPreviousCopy
+#undef cfb8LineSS1RectXor
+#undef cfb8SegmentSS1Rect
+#undef cfb8SegmentSS1RectCopy
+#undef cfb8SegmentSS1RectGeneral
+#undef cfb8SegmentSS1RectShiftCopy
+#undef cfb8SegmentSS1RectXor
+#undef cfbAllocatePrivates
+#undef cfbBSFuncRec
+#undef cfbBitBlt
+#undef cfbBresD
+#undef cfbBresS
+#undef cfbChangeWindowAttributes
+#undef cfbCloseScreen
+#undef cfbCopyArea
+#undef cfbCopyImagePlane
+#undef cfbCopyPixmap
+#undef cfbCopyPlane
+#undef cfbCopyRotatePixmap
+#undef cfbCopyWindow
+#undef cfbCreateGC
+#undef cfbCreatePixmap
+#undef cfbCreateScreenResources
+#undef cfbCreateWindow
+#undef cfbDestroyPixmap
+#undef cfbDestroyWindow
+#undef cfbDoBitblt
+#undef cfbDoBitbltCopy
+#undef cfbDoBitbltGeneral
+#undef cfbDoBitbltOr
+#undef cfbDoBitbltXor
+#undef cfbFillBoxSolid
+#undef cfbFillBoxTile32
+#undef cfbFillBoxTile32sCopy
+#undef cfbFillBoxTile32sGeneral
+#undef cfbFillBoxTileOdd
+#undef cfbFillBoxTileOddCopy
+#undef cfbFillBoxTileOddGeneral
+#undef cfbFillPoly1RectCopy
+#undef cfbFillPoly1RectGeneral
+#undef cfbFillRectSolidCopy
+#undef cfbFillRectSolidGeneral
+#undef cfbFillRectSolidXor
+#undef cfbFillRectTile32Copy
+#undef cfbFillRectTile32General
+#undef cfbFillRectTileOdd
+#undef cfbFillSpanTile32sCopy
+#undef cfbFillSpanTile32sGeneral
+#undef cfbFillSpanTileOddCopy
+#undef cfbFillSpanTileOddGeneral
+#undef cfbFinishScreenInit
+#undef cfbGCFuncs
+#undef cfbGetImage
+#undef cfbGetScreenPixmap
+#undef cfbGetSpans
+#undef cfbHorzS
+#undef cfbImageGlyphBlt8
+#undef cfbLineSD
+#undef cfbLineSS
+#undef cfbMapWindow
+#undef cfbMatchCommon
+#undef cfbNonTEOps
+#undef cfbNonTEOps1Rect
+#undef cfbPadPixmap
+#undef cfbPaintWindow
+#undef cfbPolyFillArcSolidCopy
+#undef cfbPolyFillArcSolidGeneral
+#undef cfbPolyFillRect
+#undef cfbPolyGlyphBlt8
+#undef cfbPolyGlyphRop8
+#undef cfbPolyPoint
+#undef cfbPositionWindow
+#undef cfbPutImage
+#undef cfbReduceRasterOp
+#undef cfbRestoreAreas
+#undef cfbSaveAreas
+#undef cfbScreenInit
+#undef cfbScreenPrivateIndex
+#undef cfbSegmentSD
+#undef cfbSegmentSS
+#undef cfbSetScanline
+#undef cfbSetScreenPixmap
+#undef cfbSetSpans
+#undef cfbSetupScreen
+#undef cfbSolidSpansCopy
+#undef cfbSolidSpansGeneral
+#undef cfbSolidSpansXor
+#undef cfbStippleStack
+#undef cfbStippleStackTE
+#undef cfbTEGlyphBlt
+#undef cfbTEOps
+#undef cfbTEOps1Rect
+#undef cfbTile32FSCopy
+#undef cfbTile32FSGeneral
+#undef cfbUnmapWindow
+#undef cfbUnnaturalStippleFS
+#undef cfbUnnaturalTileFS
+#undef cfbValidateGC
+#undef cfbVertS
+#undef cfbXRotatePixmap
+#undef cfbYRotatePixmap
+#undef cfbZeroPolyArcSS8Copy
+#undef cfbZeroPolyArcSS8General
+#undef cfbZeroPolyArcSS8Xor
+#undef cfbendpartial
+#undef cfbendtab
+#undef cfbmask
+#undef cfbrmask
+#undef cfbstartpartial
+#undef cfbstarttab