summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter@cs.unisa.edu.au>2008-04-22 18:04:05 +0930
committerPeter Hutterer <peter@cs.unisa.edu.au>2008-04-22 18:04:05 +0930
commit8190ef87547b704848231bde10b1cdffc6442790 (patch)
tree29cb6d5bdefcee879d103953a140373635726f17
parent179a082c26f9e562492ee2e59e7f44f949f39f9c (diff)
parent2ddbfd345786aa39b6ccaed82a1ca5c145284ee3 (diff)
Merge branch 'master' into mpx
Conflicts: Xext/EVI.c Xext/appgroup.c Xext/cup.c Xext/mitmisc.c Xext/sampleEVI.c dix/window.c
-rw-r--r--.gitignore3
-rw-r--r--GL/glx/glxglcore.c4
-rw-r--r--GL/glx/glxscreens.c2
-rw-r--r--Makefile.am9
-rw-r--r--Xext/EVI.c200
-rw-r--r--Xext/Makefile.am23
-rw-r--r--Xext/appgroup.c775
-rw-r--r--Xext/appgroup.h67
-rw-r--r--Xext/cup.c342
-rw-r--r--Xext/mitmisc.c155
-rw-r--r--Xext/sampleEVI.c123
-rw-r--r--Xext/security.c8
-rw-r--r--Xext/xres.c2
-rw-r--r--acinclude.m4172
-rw-r--r--cfb/Makefile.am21
-rw-r--r--cfb/Makefile.am.inc153
-rw-r--r--cfb/cfb.h1268
-rw-r--r--cfb/cfb16.h93
-rw-r--r--cfb/cfb24.h97
-rw-r--r--cfb/cfb32.h93
-rw-r--r--cfb/cfb8bit.c469
-rw-r--r--cfb/cfb8bit.h1570
-rw-r--r--cfb/cfb8line.c1503
-rw-r--r--cfb/cfballpriv.c70
-rw-r--r--cfb/cfbbitblt.c1455
-rw-r--r--cfb/cfbblt.c933
-rw-r--r--cfb/cfbbres.c340
-rw-r--r--cfb/cfbbresd.c404
-rw-r--r--cfb/cfbcmap.c119
-rw-r--r--cfb/cfbcppl.c486
-rw-r--r--cfb/cfbfillarc.c374
-rw-r--r--cfb/cfbfillrct.c305
-rw-r--r--cfb/cfbfillsp.c1004
-rw-r--r--cfb/cfbgc.c799
-rw-r--r--cfb/cfbgetsp.c213
-rw-r--r--cfb/cfbglblt8.c477
-rw-r--r--cfb/cfbhrzvert.c554
-rw-r--r--cfb/cfbigblt8.c106
-rw-r--r--cfb/cfbimage.c206
-rw-r--r--cfb/cfbline.c756
-rw-r--r--cfb/cfbmap.h210
-rw-r--r--cfb/cfbmskbits.c1400
-rw-r--r--cfb/cfbmskbits.h854
-rw-r--r--cfb/cfbpixmap.c375
-rw-r--r--cfb/cfbply1rct.c363
-rw-r--r--cfb/cfbpolypnt.c202
-rw-r--r--cfb/cfbpush8.c184
-rw-r--r--cfb/cfbrctstp8.c593
-rw-r--r--cfb/cfbrrop.c227
-rw-r--r--cfb/cfbrrop.h343
-rw-r--r--cfb/cfbscrinit.c223
-rw-r--r--cfb/cfbsetsp.c316
-rw-r--r--cfb/cfbsolid.c1365
-rw-r--r--cfb/cfbteblt8.c589
-rw-r--r--cfb/cfbtegblt.c218
-rw-r--r--cfb/cfbtile32.c517
-rw-r--r--cfb/cfbtileodd.c1245
-rw-r--r--cfb/cfbunmap.h161
-rw-r--r--cfb/cfbwindow.c160
-rw-r--r--cfb/cfbzerarc.c322
-rw-r--r--cfb/stip68kgnu.h121
-rw-r--r--cfb/stipmips.s281
-rw-r--r--cfb/stipsparc.s290
-rw-r--r--cfb/stipsprc32.s291
-rw-r--r--cfb32/Makefile.am9
-rw-r--r--configure.ac70
-rw-r--r--dix/Makefile.am14
-rw-r--r--dix/devices.c4
-rw-r--r--dix/dispatch.c9
-rw-r--r--dix/dixutils.c3
-rw-r--r--dix/events.c7
-rw-r--r--dix/main.c14
-rw-r--r--dix/window.c71
-rw-r--r--exa/exa.c124
-rw-r--r--exa/exa.h2
-rw-r--r--exa/exa_accel.c32
-rw-r--r--exa/exa_offscreen.c49
-rw-r--r--exa/exa_priv.h1
-rw-r--r--exa/exa_render.c13
-rw-r--r--fb/Makefile.am6
-rw-r--r--fb/fb.h2
-rw-r--r--fb/fbpseudocolor.c2248
-rw-r--r--fb/fbpseudocolor.h20
-rw-r--r--fb/wfbrename.h8
-rw-r--r--hw/dmx/dmx-config.h2
-rw-r--r--hw/dmx/dmxextension.c1
-rw-r--r--hw/kdrive/ephyr/ephyr_draw.c1
-rw-r--r--hw/kdrive/ephyr/ephyrlog.h4
-rw-r--r--hw/kdrive/src/kinput.c4
-rw-r--r--hw/xfree86/Makefile.am8
-rw-r--r--hw/xfree86/common/compiler.h2
-rw-r--r--hw/xfree86/common/xf86.h1
-rw-r--r--hw/xfree86/common/xf86AutoConfig.c8
-rw-r--r--hw/xfree86/common/xf86Config.c37
-rw-r--r--hw/xfree86/common/xf86Privstr.h3
-rw-r--r--hw/xfree86/common/xf86Xinput.c12
-rw-r--r--hw/xfree86/dixmods/Makefile.am13
-rw-r--r--hw/xfree86/dixmods/cfb32module.c57
-rw-r--r--hw/xfree86/dixmods/cfbmodule.c57
-rw-r--r--hw/xfree86/dixmods/extmod/Makefile.am1
-rw-r--r--hw/xfree86/dixmods/extmod/modinit.c27
-rw-r--r--hw/xfree86/dixmods/extmod/modinit.h26
-rw-r--r--hw/xfree86/doc/man/xorg.conf.man.pre8
-rw-r--r--hw/xfree86/loader/dixsym.c12
-rw-r--r--hw/xfree86/loader/loader.c2
-rw-r--r--hw/xfree86/modes/xf86EdidModes.c6
-rw-r--r--hw/xfree86/os-support/bsd/Makefile.am1
-rw-r--r--hw/xfree86/os-support/bsd/bsdResource.c2
-rw-r--r--hw/xfree86/os-support/bsd/bsd_jstk.c183
-rw-r--r--hw/xfree86/os-support/bsd/i386_video.c8
-rw-r--r--hw/xfree86/os-support/bus/Pci.h2
-rw-r--r--hw/xfree86/os-support/linux/Makefile.am1
-rw-r--r--hw/xfree86/os-support/linux/lnx_jstk.c180
-rw-r--r--hw/xfree86/utils/xorgcfg/loadmod.c4
-rw-r--r--hw/xfree86/x86emu/prim_ops.c2
-rw-r--r--hw/xfree86/x86emu/x86emu/prim_x86_gcc.h2
-rw-r--r--hw/xfree86/x86emu/x86emu/types.h2
-rw-r--r--hw/xfree86/xf8_32bpp/Makefile.am37
-rw-r--r--hw/xfree86/xf8_32bpp/cfb8_32.h191
-rw-r--r--hw/xfree86/xf8_32bpp/cfb8_32module.c39
-rw-r--r--hw/xfree86/xf8_32bpp/cfbcpyarea.c549
-rw-r--r--hw/xfree86/xf8_32bpp/cfbcpyplane.c41
-rw-r--r--hw/xfree86/xf8_32bpp/cfbgc.c646
-rw-r--r--hw/xfree86/xf8_32bpp/cfbgcmisc.c150
-rw-r--r--hw/xfree86/xf8_32bpp/cfbgcunder.c620
-rw-r--r--hw/xfree86/xf8_32bpp/cfbimage.c174
-rw-r--r--hw/xfree86/xf8_32bpp/cfbpntwin.c51
-rw-r--r--hw/xfree86/xf8_32bpp/cfbscrinit.c311
-rw-r--r--hw/xfree86/xf8_32bpp/cfbwindow.c116
-rw-r--r--hw/xfree86/xf8_32bpp/xf86overlay.c1179
-rw-r--r--hw/xgl/egl/kinput.c4
-rw-r--r--hw/xnest/Args.c5
-rw-r--r--hw/xprint/Makefile.am3
-rw-r--r--hw/xprint/ps/psout.h2
-rw-r--r--hw/xquartz/Makefile.am8
-rw-r--r--hw/xquartz/X11Application.h3
-rw-r--r--hw/xquartz/X11Application.m43
-rw-r--r--hw/xquartz/X11Controller.h8
-rw-r--r--hw/xquartz/X11Controller.m70
-rw-r--r--hw/xquartz/applewm.c2
-rw-r--r--hw/xquartz/darwin.c40
-rw-r--r--hw/xquartz/darwin.h4
-rw-r--r--hw/xquartz/darwinEvents.c416
-rw-r--r--hw/xquartz/darwinEvents.h6
-rw-r--r--hw/xquartz/darwinKeyboard.c1019
-rw-r--r--hw/xquartz/quartz.c4
-rw-r--r--hw/xquartz/quartz.h5
-rw-r--r--hw/xquartz/quartzAudio.c2
-rw-r--r--hw/xquartz/quartzCocoa.m6
-rw-r--r--hw/xquartz/quartzCommon.h11
-rw-r--r--hw/xquartz/quartzKeyboard.c1010
-rw-r--r--hw/xquartz/quartzKeyboard.h13
-rw-r--r--hw/xquartz/quartzStartup.c8
-rw-r--r--hw/xquartz/sanitizedCarbon.h32
-rw-r--r--hw/xquartz/sanitizedCocoa.h27
-rw-r--r--hw/xquartz/threadSafety.c60
-rw-r--r--hw/xquartz/threadSafety.h (renamed from hw/xquartz/darwinKeyboard.h)42
-rw-r--r--hw/xquartz/xpr/Makefile.am7
-rw-r--r--hw/xquartz/xpr/dri.h2
-rw-r--r--hw/xquartz/xpr/xpr.h3
-rw-r--r--hw/xquartz/xpr/xprAppleWM.c2
-rw-r--r--hw/xquartz/xpr/xprCursor.c4
-rw-r--r--hw/xquartz/xpr/xprEvent.c91
-rw-r--r--hw/xquartz/xpr/xprEvent.h34
-rw-r--r--hw/xquartz/xpr/xprFrame.c2
-rw-r--r--hw/xquartz/xpr/xprScreen.c14
-rw-r--r--include/dix-config.h.in15
-rw-r--r--include/dixstruct.h4
-rw-r--r--include/globals.h16
-rw-r--r--include/servermd.h2
-rw-r--r--include/windowstr.h3
-rw-r--r--include/xorg-server.h.in6
-rw-r--r--mi/micoord.h2
-rw-r--r--mi/miinitext.c55
-rw-r--r--miext/rootless/Makefile.am2
-rw-r--r--miext/rootless/README.txt4
-rw-r--r--miext/rootless/accel/Makefile.am15
-rw-r--r--miext/rootless/accel/rlAccel.c147
-rw-r--r--miext/rootless/accel/rlAccel.h140
-rw-r--r--miext/rootless/accel/rlBlt.c408
-rw-r--r--miext/rootless/accel/rlCopy.c106
-rw-r--r--miext/rootless/accel/rlFill.c220
-rw-r--r--miext/rootless/accel/rlFillRect.c117
-rw-r--r--miext/rootless/accel/rlFillSpans.c105
-rw-r--r--miext/rootless/accel/rlGlyph.c169
-rw-r--r--miext/rootless/accel/rlSolid.c111
-rw-r--r--miext/rootless/rootlessConfig.h3
-rw-r--r--miext/rootless/rootlessGC.c8
-rw-r--r--miext/rootless/rootlessWindow.c72
-rw-r--r--miext/rootless/rootlessWindow.h4
-rw-r--r--os/WaitFor.c6
-rw-r--r--os/connection.c3
-rw-r--r--os/utils.c12
-rw-r--r--xkb/xkbActions.c2
-rw-r--r--xorg-server.pc.in2
195 files changed, 2129 insertions, 36734 deletions
diff --git a/.gitignore b/.gitignore
index 837b0380b..a6925d98f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,6 +24,7 @@ config.sub
configure
configure.lineno
depcomp
+doltcompile
install-sh
libtool
ltmain.sh
@@ -277,6 +278,8 @@ hw/xprint/doc/Xprt.1x
hw/xprint/doc/Xprt.man
hw/xprint/dpmsstubs-wrapper.c
hw/xprint/miinitext-wrapper.c
+hw/xquartz/xpr/Xquartz
+hw/xquartz/xpr/Xquartz.1
include/dix-config.h
include/kdrive-config.h
include/xgl-config.h
diff --git a/GL/glx/glxglcore.c b/GL/glx/glxglcore.c
index 972ab88e6..c8a2514d2 100644
--- a/GL/glx/glxglcore.c
+++ b/GL/glx/glxglcore.c
@@ -317,9 +317,10 @@ createFBConfigsForVisual(__GLXscreen *screen, ScreenPtr pScreen,
for (back = numBack - 1; back >= 0; back--)
for (depth = 0; depth < numDepth; depth++)
for (stencil = 0; stencil < numStencil; stencil++) {
- config->next = xalloc(sizeof *config);
+ config->next = xcalloc(sizeof(*config), 1);
config = config->next;
+ config->visualRating = GLX_NONE;
config->visualType = glx_visual_types[visual->class];
config->xRenderable = GL_TRUE;
config->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT;
@@ -431,6 +432,7 @@ __glXMesaScreenProbe(ScreenPtr pScreen)
screen->base.destroy = __glXMesaScreenDestroy;
screen->base.createContext = __glXMesaScreenCreateContext;
screen->base.createDrawable = __glXMesaScreenCreateDrawable;
+ screen->base.swapInterval = NULL;
screen->base.pScreen = pScreen;
return &screen->base;
diff --git a/GL/glx/glxscreens.c b/GL/glx/glxscreens.c
index b49a775b5..41ee029e6 100644
--- a/GL/glx/glxscreens.c
+++ b/GL/glx/glxscreens.c
@@ -488,7 +488,7 @@ addMinimalSet(__GLXscreen *pGlxScreen)
continue;
pGlxScreen->visuals[j] = config;
- config->visualID = visuals[j].vid;
+ config->visualID = visuals[i].vid;
j++;
}
diff --git a/Makefile.am b/Makefile.am
index 71ba2c429..d2e10acaf 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -9,11 +9,6 @@ if XTRAP
XTRAP_DIR=XTrap
endif
-if CFB
-CFB_DIR=cfb
-CFB32_DIR=cfb32
-endif
-
if AFB
AFB_DIR=afb
endif
@@ -50,8 +45,6 @@ SUBDIRS = \
$(DBE_DIR) \
$(MFB_DIR) \
$(AFB_DIR) \
- $(CFB_DIR) \
- $(CFB32_DIR) \
$(RECORD_DIR) \
xfixes \
damageext \
@@ -96,8 +89,6 @@ DIST_SUBDIRS = \
dbe \
mfb \
afb \
- cfb \
- cfb32 \
record \
xfixes \
damageext \
diff --git a/Xext/EVI.c b/Xext/EVI.c
deleted file mode 100644
index 6b9118771..000000000
--- a/Xext/EVI.c
+++ /dev/null
@@ -1,200 +0,0 @@
-/************************************************************
-Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
-Permission to use, copy, modify, and distribute this
-software and its documentation for any purpose and without
-fee is hereby granted, provided that the above copyright
-notice appear in all copies and that both that copyright
-notice and this permission notice appear in supporting
-documentation, and that the name of Silicon Graphics not be
-used in advertising or publicity pertaining to distribution
-of the software without specific prior written permission.
-Silicon Graphics makes no representation about the suitability
-of this software for any purpose. It is provided "as is"
-without any express or implied warranty.
-SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
-SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
-GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
-DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
-DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
-THE USE OR PERFORMANCE OF THIS SOFTWARE.
-********************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "dixstruct.h"
-#include "extnsionst.h"
-#include "dix.h"
-#define _XEVI_SERVER_
-#include <X11/extensions/XEVIstr.h>
-#include "EVIstruct.h"
-#include "modinit.h"
-#include "scrnintstr.h"
-
-static EviPrivPtr eviPriv;
-
-static int
-ProcEVIQueryVersion(ClientPtr client)
-{
- /* REQUEST(xEVIQueryVersionReq); */
- xEVIQueryVersionReply rep;
- int n;
- REQUEST_SIZE_MATCH (xEVIQueryVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.majorVersion = XEVI_MAJOR_VERSION;
- rep.minorVersion = XEVI_MAJOR_VERSION;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swaps(&rep.majorVersion, n);
- swaps(&rep.minorVersion, n);
- }
- WriteToClient(client, sizeof (xEVIQueryVersionReply), (char *)&rep);
- return (client->noClientException);
-}
-#define swapEviInfo(eviInfo, l) \
-{ \
- int l1 = l; \
- xExtendedVisualInfo *eviInfo1 = eviInfo; \
- while (l1-- > 0) { \
- swapl(&eviInfo1->core_visual_id, n); \
- swapl(&eviInfo1->transparency_value, n); \
- swaps(&eviInfo1->num_colormap_conflicts, n); \
- eviInfo1++; \
- } \
-}
-#define swapVisual(visual, l) \
-{ \
- int l1 = l; \
- VisualID32 *visual1 = visual; \
- while (l1-- > 0) { \
- swapl(visual1, n); \
- visual1++; \
- } \
-}
-
-static int
-ProcEVIGetVisualInfo(ClientPtr client)
-{
- REQUEST(xEVIGetVisualInfoReq);
- xEVIGetVisualInfoReply rep;
- int i, n, n_conflict, n_info, sz_info, sz_conflict;
- VisualID32 *conflict;
- unsigned int total_visuals = 0;
- xExtendedVisualInfo *eviInfo;
- int status;
-
- /*
- * do this first, otherwise REQUEST_FIXED_SIZE can overflow. we assume
- * here that you don't have more than 2^32 visuals over all your screens;
- * this seems like a safe assumption.
- */
- for (i = 0; i < screenInfo.numScreens; i++)
- total_visuals += screenInfo.screens[i]->numVisuals;
- if (stuff->n_visual > total_visuals)
- return BadValue;
-
- REQUEST_FIXED_SIZE(xEVIGetVisualInfoReq, stuff->n_visual * sz_VisualID32);
- status = eviPriv->getVisualInfo((VisualID32 *)&stuff[1], (int)stuff->n_visual,
- &eviInfo, &n_info, &conflict, &n_conflict);
- if (status != Success)
- return status;
- sz_info = n_info * sz_xExtendedVisualInfo;
- sz_conflict = n_conflict * sz_VisualID32;
- rep.type = X_Reply;
- rep.n_info = n_info;
- rep.n_conflicts = n_conflict;
- rep.sequenceNumber = client->sequence;
- rep.length = (sz_info + sz_conflict) >> 2;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swapl(&rep.n_info, n);
- swapl(&rep.n_conflicts, n);
- swapEviInfo(eviInfo, n_info);
- swapVisual(conflict, n_conflict);
- }
- WriteToClient(client, sz_xEVIGetVisualInfoReply, (char *)&rep);
- WriteToClient(client, sz_info, (char *)eviInfo);
- WriteToClient(client, sz_conflict, (char *)conflict);
- eviPriv->freeVisualInfo(eviInfo, conflict);
- return (client->noClientException);
-}
-
-static int
-ProcEVIDispatch(ClientPtr client)
-{
- REQUEST(xReq);
- switch (stuff->data) {
- case X_EVIQueryVersion:
- return ProcEVIQueryVersion (client);
- case X_EVIGetVisualInfo:
- return ProcEVIGetVisualInfo (client);
- default:
- return BadRequest;
- }
-}
-
-static int
-SProcEVIQueryVersion(ClientPtr client)
-{
- REQUEST(xEVIQueryVersionReq);
- int n;
- swaps(&stuff->length, n);
- return ProcEVIQueryVersion(client);
-}
-
-static int
-SProcEVIGetVisualInfo(ClientPtr client)
-{
- int n;
- REQUEST(xEVIGetVisualInfoReq);
- swaps(&stuff->length, n);
- return ProcEVIGetVisualInfo(client);
-}
-
-static int
-SProcEVIDispatch(ClientPtr client)
-{
- REQUEST(xReq);
- switch (stuff->data)
- {
- case X_EVIQueryVersion:
- return SProcEVIQueryVersion (client);
- case X_EVIGetVisualInfo:
- return SProcEVIGetVisualInfo (client);
- default:
- return BadRequest;
- }
-}
-
-/*ARGSUSED*/
-static void
-EVIResetProc(ExtensionEntry *extEntry)
-{
- eviDDXReset();
-}
-
-/****************
- * XEVIExtensionInit
- *
- * Called from InitExtensions in main() or from QueryExtension() if the
- * extension is dynamically loaded.
- *
- ****************/
-void
-EVIExtensionInit(INITARGS)
-{
- if (AddExtension(EVINAME, 0, 0,
- ProcEVIDispatch, SProcEVIDispatch,
- EVIResetProc, StandardMinorOpcode)) {
- eviPriv = eviDDXInit();
- }
-}
diff --git a/Xext/Makefile.am b/Xext/Makefile.am
index 9cfb458cf..42aa279d8 100644
--- a/Xext/Makefile.am
+++ b/Xext/Makefile.am
@@ -29,7 +29,6 @@ BUILTIN_SRCS = \
# Sources always included in libXextmodule.la & libXext.la
MODULE_SRCS = \
bigreq.c \
- mitmisc.c \
shape.c \
sync.c \
xcmisc.c
@@ -106,25 +105,6 @@ if XPRINT
BUILTIN_SRCS += $(XPRINT_SRCS)
endif
-# AppGroup
-APPGROUP_SRCS = appgroup.c appgroup.h
-if APPGROUP
-BUILTIN_SRCS += $(APPGROUP_SRCS)
-endif
-
-# Colormap Utilization Protocol: Less flashing when switching between
-# PsuedoColor apps and better sharing of limited colormap slots
-CUP_SRCS = cup.c
-if CUP
-MODULE_SRCS += $(CUP_SRCS)
-endif
-
-# Extended Visual Information
-EVI_SRCS = EVI.c sampleEVI.c EVIstruct.h
-if EVI
-MODULE_SRCS += $(EVI_SRCS)
-endif
-
# Multi-buffering extension
MULTIBUFFER_SRCS = mbuf.c
EXTRA_MULTIBUFFER_SRCS = mbufbf.c mbufpx.c
@@ -171,9 +151,6 @@ EXTRA_DIST = \
$(XINERAMA_SRCS) \
$(XEVIE_SRCS) \
$(XPRINT_SRCS) \
- $(APPGROUP_SRCS) \
- $(CUP_SRCS) \
- $(EVI_SRCS) \
$(MULTIBUFFER_SRCS) \
$(EXTRA_MULTIBUFFER_SRCS) \
$(FONTCACHE_SRCS) \
diff --git a/Xext/appgroup.c b/Xext/appgroup.c
deleted file mode 100644
index 76487a0a0..000000000
--- a/Xext/appgroup.c
+++ /dev/null
@@ -1,775 +0,0 @@
-/*
-Copyright 1996, 1998, 2001 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.
-*/
-
-#define NEED_REPLIES
-#define NEED_EVENTS
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "dixstruct.h"
-#include "extnsionst.h"
-#include "scrnintstr.h"
-#include "windowstr.h"
-#include "colormapst.h"
-#include "servermd.h"
-#define _XAG_SERVER_
-#include <X11/extensions/Xagstr.h>
-#include "xacestr.h"
-#include "securitysrv.h"
-#include <X11/Xfuncproto.h>
-
-#define XSERV_t
-#include <X11/Xtrans/Xtrans.h>
-#include "../os/osdep.h"
-
-#include <stdio.h>
-
-#include "modinit.h"
-#include "appgroup.h"
-
-typedef struct _AppGroupRec {
- struct _AppGroupRec* next;
- XID appgroupId;
- ClientPtr* clients;
- int nclients;
- ClientPtr leader;
- Bool single_screen;
- Window default_root;
- VisualID root_visual;
- Colormap default_colormap;
- Pixel black_pixel;
- Pixel white_pixel;
- xConnSetupPrefix connSetupPrefix;
- char* ConnectionInfo;
-} AppGroupRec, *AppGroupPtr;
-
-static int ProcXagDispatch(ClientPtr client);
-static int SProcXagDispatch(ClientPtr client);
-static void XagResetProc(ExtensionEntry* extEntry);
-
-static int XagCallbackRefCount = 0;
-
-static RESTYPE RT_APPGROUP;
-static AppGroupPtr appGrpList = NULL;
-
-extern xConnSetupPrefix connSetupPrefix;
-extern char* ConnectionInfo;
-extern int connBlockScreenStart;
-
-static
-int XagAppGroupFree(
- pointer what,
- XID id) /* unused */
-{
- int i;
- AppGroupPtr pAppGrp = (AppGroupPtr) what;
-
- if (pAppGrp->leader)
- for (i = 0; i < pAppGrp->nclients; i++) {
- if (pAppGrp->clients[i] == NULL) continue;
- CloseDownClient (pAppGrp->clients[i]);
- }
-
- if (pAppGrp == appGrpList)
- appGrpList = appGrpList->next;
- else {
- AppGroupPtr tpAppGrp;
- for (tpAppGrp = appGrpList;
- tpAppGrp->next != NULL;
- tpAppGrp = tpAppGrp->next) {
- if (tpAppGrp->next == pAppGrp) {
- tpAppGrp->next = tpAppGrp->next->next;
- break;
- }
- }
- }
- (void) xfree (pAppGrp->clients);
- (void) xfree (pAppGrp->ConnectionInfo);
- (void) xfree (what);
- return Success;
-}
-
-static void XagClientStateChange(
- CallbackListPtr* pcbl,
- pointer nulldata,
- pointer calldata)
-{
- NewClientInfoRec* pci = (NewClientInfoRec*) calldata;
- ClientPtr pClient = pci->client;
- AppGroupPtr pAppGrp = pClient->appgroup;
- int slot;
-
- if (!pAppGrp)
- return;
-
- switch (pClient->clientState) {
- case ClientStateAuthenticating:
- case ClientStateRunning:
- case ClientStateCheckingSecurity:
- break;
-
- case ClientStateInitial:
- case ClientStateCheckedSecurity:
- slot = -1;
- /* see the comment above about Initial vs. CheckedSecurity */
- if (pAppGrp->nclients != 0) {
- /* if this client already in AppGroup, don't add it again */
- int i;
- for (i = 0; i < pAppGrp->nclients; i++)
- if (pClient == pAppGrp->clients[i]) return;
- if (slot == -1 && pAppGrp->clients[i] == NULL)
- slot = i;
- }
- if (slot == -1) {
- slot = pAppGrp->nclients++;
- pAppGrp->clients = (ClientPtr*) xrealloc (pAppGrp->clients,
- pAppGrp->nclients * sizeof (ClientPtr));
- }
- pAppGrp->clients[slot] = pClient;
- pClient->appgroup = pAppGrp;
- break;
-
- case ClientStateGone:
- case ClientStateRetained: /* client disconnected, dump it */
- {
- int i;
- for (i = 0; i < pAppGrp->nclients; i++)
- if (pAppGrp->clients[i] == pClient) {
- pAppGrp->clients[i] = NULL;
- break;
- }
- }
- pClient->appgroup = NULL; /* redundant, pClient will be freed */
- break;
- }
-}
-
-/*ARGSUSED*/
-static
-void XagResetProc(
- ExtensionEntry* extEntry)
-{
- DeleteCallback (&ClientStateCallback, XagClientStateChange, NULL);
- XagCallbackRefCount = 0;
- while (appGrpList) XagAppGroupFree ((pointer) appGrpList, 0);
-}
-
-static
-int ProcXagQueryVersion(
- ClientPtr client)
-{
- /* REQUEST (xXagQueryVersionReq); */
- xXagQueryVersionReply rep;
- int n;
-
- REQUEST_SIZE_MATCH (xXagQueryVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequence_number = client->sequence;
- rep.server_major_version = XAG_MAJOR_VERSION;
- rep.server_minor_version = XAG_MINOR_VERSION;
- if (client->swapped) {
- swaps (&rep.sequence_number, n);
- swapl (&rep.length, n);
- swaps (&rep.server_major_version, n);
- swaps (&rep.server_minor_version, n);
- }
- WriteToClient (client, sizeof (xXagQueryVersionReply), (char *)&rep);
- return client->noClientException;
-}
-
-static
-void ProcessAttr(
- AppGroupPtr pAppGrp,
- ClientPtr client,
- unsigned int attrib_mask,
- CARD32* attribs)
-{
- int i;
-
- for (i = 0; i <= XagNappGroupLeader; i++) {
- switch (attrib_mask & (1 << i)) {
- case XagSingleScreenMask:
- pAppGrp->single_screen = *attribs;
- break;
- case XagDefaultRootMask:
- pAppGrp->default_root = *attribs;
- break;
- case XagRootVisualMask:
- pAppGrp->root_visual = *attribs;
- break;
- case XagDefaultColormapMask:
- pAppGrp->default_colormap = *attribs;
- break;
- case XagBlackPixelMask:
- pAppGrp->black_pixel = *attribs;
- break;
- case XagWhitePixelMask:
- pAppGrp->white_pixel = *attribs;
- break;
- case XagAppGroupLeaderMask:
- pAppGrp->leader = client;
- break;
- default: continue;
- }
- attribs++;
- }
-}
-
-static
-void CreateConnectionInfo(
- AppGroupPtr pAppGrp)
-{
- xWindowRoot* rootp;
- xWindowRoot* roots[MAXSCREENS];
- unsigned int rootlens[MAXSCREENS];
- xDepth* depth;
- int olen;
- int snum, i;
-
- rootp = (xWindowRoot*) (ConnectionInfo + connBlockScreenStart);
- for (snum = 0; snum < screenInfo.numScreens; snum++) {
-
- rootlens[snum] = sizeof (xWindowRoot);
- roots[snum] = rootp;
-
- depth = (xDepth*) (rootp + 1);
- for (i = 0; i < rootp->nDepths; i++) {
- rootlens[snum] += sizeof (xDepth) +
- depth->nVisuals * sizeof (xVisualType);
- depth = (xDepth *)(((char*)(depth + 1)) +
- depth->nVisuals * sizeof (xVisualType));
- }
- rootp = (xWindowRoot*) depth;
- }
- snum = 0;
- if (pAppGrp->default_root) {
- for (; snum < screenInfo.numVideoScreens; snum++) {
- if (roots[snum]->windowId == pAppGrp->default_root)
- break;
- }
- }
- olen = connBlockScreenStart + rootlens[snum];
- for (i = screenInfo.numVideoScreens; i < screenInfo.numScreens; i++)
- olen += rootlens[i];
- pAppGrp->ConnectionInfo = (char*) xalloc (olen);
- if (!pAppGrp->ConnectionInfo)
- return;
- memmove (pAppGrp->ConnectionInfo, ConnectionInfo, connBlockScreenStart);
- ((xConnSetup*) (pAppGrp->ConnectionInfo))->numRoots =
- 1 + screenInfo.numScreens - screenInfo.numVideoScreens;
- memmove (pAppGrp->ConnectionInfo + connBlockScreenStart,
- (void*) roots[snum], rootlens[snum]);
- rootp = (xWindowRoot*) (pAppGrp->ConnectionInfo + connBlockScreenStart);
- if (pAppGrp->default_colormap) {
- rootp->defaultColormap = pAppGrp->default_colormap;
- rootp->whitePixel = pAppGrp->white_pixel;
- rootp->blackPixel = pAppGrp->black_pixel;
- }
- if (pAppGrp->root_visual)
- rootp->rootVisualID = pAppGrp->root_visual;
- rootp = (xWindowRoot*) (((char*)rootp) + rootlens[snum]);
- for (i = screenInfo.numVideoScreens; i < screenInfo.numScreens; i++) {
- memmove ((void*) rootp, (void*) roots[i], rootlens[i]);
- rootp = (xWindowRoot*) (((char*) rootp) + rootlens[i]);
- }
- pAppGrp->connSetupPrefix = connSetupPrefix;
- pAppGrp->connSetupPrefix.length = olen >> 2;
-}
-
-static
-AppGroupPtr CreateAppGroup(
- ClientPtr client,
- XID appgroupId,
- unsigned int attrib_mask,
- CARD32* attribs)
-{
- AppGroupPtr pAppGrp;
-
- pAppGrp = (AppGroupPtr) xalloc (sizeof(AppGroupRec));
- if (pAppGrp) {
- pAppGrp->next = appGrpList;
- appGrpList = pAppGrp;
- pAppGrp->appgroupId = appgroupId;
- pAppGrp->clients = (ClientPtr*) xalloc (0);
- pAppGrp->nclients = 0;
- pAppGrp->leader = NULL;
- pAppGrp->default_root = 0;
- pAppGrp->root_visual = 0;
- pAppGrp->default_colormap = 0;
- pAppGrp->black_pixel = -1;
- pAppGrp->white_pixel = -1;
- pAppGrp->ConnectionInfo = NULL;
- ProcessAttr (pAppGrp, client, attrib_mask, attribs);
- }
- return pAppGrp;
-}
-
-static
-int AttrValidate(
- ClientPtr client,
- int attrib_mask,
- AppGroupPtr pAppGrp)
-{
- WindowPtr pWin;
- int idepth, ivids, found, rc;
- ScreenPtr pScreen;
- DepthPtr pDepth;
- ColormapPtr pColormap;
-
- rc = dixLookupWindow(&pWin, pAppGrp->default_root, client,
- DixGetAttrAccess);
- if (rc != Success)
- return rc;
- pScreen = pWin->drawable.pScreen;
- if (WindowTable[pScreen->myNum]->drawable.id != pAppGrp->default_root)
- return BadWindow;
- pDepth = pScreen->allowedDepths;
- if (pAppGrp->root_visual) {
- found = FALSE;
- for (idepth = 0; idepth < pScreen->numDepths; idepth++, pDepth++) {
- for (ivids = 0; ivids < pDepth->numVids; ivids++) {
- if (pAppGrp->root_visual == pDepth->vids[ivids]) {
- found = TRUE;
- break;
- }
- }
- }
- if (!found)
- return BadMatch;
- }
- if (pAppGrp->default_colormap) {
-
- rc = dixLookupResource((pointer *)&pColormap, pAppGrp->default_colormap,
- RT_COLORMAP, client, DixUseAccess);
- if (rc != Success)
- return rc;
- if (pColormap->pScreen != pScreen)
- return BadColor;
- if (pColormap->pVisual->vid != (pAppGrp->root_visual ? pAppGrp->root_visual : pScreen->rootVisual))
- return BadMatch;
- }
- return client->noClientException;
-}
-
-static int ProcXagCreate (
- ClientPtr client)
-{
- REQUEST (xXagCreateReq);
- AppGroupPtr pAppGrp;
- int ret;
-
- REQUEST_AT_LEAST_SIZE (xXagCreateReq);
-
- LEGAL_NEW_RESOURCE (stuff->app_group, client);
- pAppGrp = CreateAppGroup (client, stuff->app_group,
- stuff->attrib_mask, (CARD32*) &stuff[1]);
- if (!pAppGrp)
- return BadAlloc;
- ret = AttrValidate (client, stuff->attrib_mask, pAppGrp);
- if (ret != Success) {
- XagAppGroupFree ((pointer)pAppGrp, (XID)0);
- return ret;
- }
- if (pAppGrp->single_screen) {
- CreateConnectionInfo (pAppGrp);
- if (!pAppGrp->ConnectionInfo)
- return BadAlloc;
- }
- if (!AddResource (stuff->app_group, RT_APPGROUP, (pointer)pAppGrp))
- return BadAlloc;
- if (XagCallbackRefCount++ == 0)
- (void) AddCallback (&ClientStateCallback, XagClientStateChange, NULL);
- return client->noClientException;
-}
-
-static int ProcXagDestroy(
- ClientPtr client)
-{
- AppGroupPtr pAppGrp;
- REQUEST (xXagDestroyReq);
-
- REQUEST_SIZE_MATCH (xXagDestroyReq);
- pAppGrp = (AppGroupPtr)SecurityLookupIDByType (client,
- (XID)stuff->app_group, RT_APPGROUP, DixReadAccess);
- if (!pAppGrp) return XagBadAppGroup;
- FreeResource ((XID)stuff->app_group, RT_NONE);
- if (--XagCallbackRefCount == 0)
- (void) DeleteCallback (&ClientStateCallback, XagClientStateChange, NULL);
- return client->noClientException;
-}
-
-static
-int ProcXagGetAttr(
- ClientPtr client)
-{
- AppGroupPtr pAppGrp;
- REQUEST (xXagGetAttrReq);
- xXagGetAttrReply rep;
- int n;
-
- REQUEST_SIZE_MATCH (xXagGetAttrReq);
- pAppGrp = (AppGroupPtr)SecurityLookupIDByType (client,
- (XID)stuff->app_group, RT_APPGROUP, DixReadAccess);
- if (!pAppGrp) return XagBadAppGroup;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequence_number = client->sequence;
- rep.default_root = pAppGrp->default_root;
- rep.root_visual = pAppGrp->root_visual;
- rep.default_colormap = pAppGrp->default_colormap;
- rep.black_pixel = pAppGrp->black_pixel;
- rep.white_pixel = pAppGrp->white_pixel;
- rep.single_screen = pAppGrp->single_screen;
- rep.app_group_leader = (pAppGrp->leader) ? 1 : 0;
- if (client->swapped) {
- swaps (&rep.sequence_number, n);
- swapl (&rep.length, n);
- swapl (&rep.default_root, n);
- swapl (&rep.root_visual, n);
- swapl (&rep.default_colormap, n);
- swapl (&rep.black_pixel, n);
- swapl (&rep.white_pixel, n);
- }
- WriteToClient (client, sizeof (xXagGetAttrReply), (char *)&rep);
- return client->noClientException;
-}
-
-static
-int ProcXagQuery(
- ClientPtr client)
-{
- ClientPtr pClient;
- AppGroupPtr pAppGrp;
- REQUEST (xXagQueryReq);
- int n, rc;
-
- REQUEST_SIZE_MATCH (xXagQueryReq);
- rc = dixLookupClient(&pClient, stuff->resource, client, DixGetAttrAccess);
- if (rc != Success)
- return rc;
-
- for (pAppGrp = appGrpList; pAppGrp != NULL; pAppGrp = pAppGrp->next)
- for (n = 0; n < pAppGrp->nclients; n++)
- if (pAppGrp->clients[n] == pClient) {
- xXagQueryReply rep;
-
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequence_number = client->sequence;
- rep.app_group = pAppGrp->appgroupId;
- if (client->swapped) {
- swaps (&rep.sequence_number, n);
- swapl (&rep.length, n);
- swapl (&rep.app_group, n);
- }
- WriteToClient (client, sizeof (xXagQueryReply), (char *)&rep);
- return client->noClientException;
- }
-
- return BadMatch;
-}
-
-static
-int ProcXagCreateAssoc(
- ClientPtr client)
-{
- REQUEST (xXagCreateAssocReq);
-
- REQUEST_SIZE_MATCH (xXagCreateAssocReq);
-#ifdef WIN32
- if (stuff->window_type != XagWindowTypeWin32)
-#else
- if (stuff->window_type != XagWindowTypeX11)
-#endif
- return BadMatch;
-#if defined(WIN32) || defined(__CYGWIN__) /* and Mac, etc */
- if (!LocalClient (client))
- return BadAccess;
-#endif
-
-/* Macintosh, OS/2, and MS-Windows servers have some work to do here */
-
- return client->noClientException;
-}
-
-static
-int ProcXagDestroyAssoc(
- ClientPtr client)
-{
- /* REQUEST (xXagDestroyAssocReq); */
-
- REQUEST_SIZE_MATCH (xXagDestroyAssocReq);
-/* Macintosh, OS/2, and MS-Windows servers have some work to do here */
- return client->noClientException;
-}
-
-static
-int ProcXagDispatch (
- ClientPtr client)
-{
- REQUEST (xReq);
- switch (stuff->data)
- {
- case X_XagQueryVersion:
- return ProcXagQueryVersion (client);
- case X_XagCreate:
- return ProcXagCreate (client);
- case X_XagDestroy:
- return ProcXagDestroy (client);
- case X_XagGetAttr:
- return ProcXagGetAttr (client);
- case X_XagQuery:
- return ProcXagQuery (client);
- case X_XagCreateAssoc:
- return ProcXagCreateAssoc (client);
- case X_XagDestroyAssoc:
- return ProcXagDestroyAssoc (client);
- default:
- return BadRequest;
- }
-}
-
-static
-int SProcXagQueryVersion(
- ClientPtr client)
-{
- int n;
- REQUEST(xXagQueryVersionReq);
- swaps(&stuff->length, n);
- return ProcXagQueryVersion(client);
-}
-
-static
-int SProcXagCreate(
- ClientPtr client)
-{
- int n;
- REQUEST (xXagCreateReq);
- swaps (&stuff->length, n);
- REQUEST_AT_LEAST_SIZE (xXagCreateReq);
- swapl (&stuff->app_group, n);
- swapl (&stuff->attrib_mask, n);
- SwapRestL (stuff);
- return ProcXagCreate (client);
-}
-
-static
-int SProcXagDestroy(
- ClientPtr client)
-{
- int n;
- REQUEST (xXagDestroyReq);
- swaps (&stuff->length, n);
- REQUEST_SIZE_MATCH (xXagDestroyReq);
- swapl (&stuff->app_group, n);
- return ProcXagDestroy (client);
-}
-
-static
-int SProcXagGetAttr(
- ClientPtr client)
-{
- int n;
- REQUEST (xXagGetAttrReq);
- swaps (&stuff->length, n);
- REQUEST_SIZE_MATCH (xXagGetAttrReq);
- swapl (&stuff->app_group, n);
- return ProcXagGetAttr (client);
-}
-
-static
-int SProcXagQuery(
- ClientPtr client)
-{
- int n;
- REQUEST (xXagQueryReq);
- swaps (&stuff->length, n);
- REQUEST_SIZE_MATCH (xXagQueryReq);
- swapl (&stuff->resource, n);
- return ProcXagQuery (client);
-}
-
-static
-int SProcXagCreateAssoc(
- ClientPtr client)
-{
- int n;
- REQUEST (xXagCreateAssocReq);
- swaps (&stuff->length, n);
- REQUEST_SIZE_MATCH (xXagCreateAssocReq);
- swapl (&stuff->window, n);
- swapl (&stuff->window_type, n);
- swaps (&stuff->system_window_len, n);
- return ProcXagCreateAssoc (client);
-}
-
-static
-int SProcXagDestroyAssoc(
- ClientPtr client)
-{
- int n;
- REQUEST (xXagDestroyAssocReq);
- swaps (&stuff->length, n);
- REQUEST_SIZE_MATCH (xXagDestroyAssocReq);
- swapl (&stuff->window, n);
- return ProcXagDestroyAssoc (client);
-}
-
-static
-int SProcXagDispatch(
- ClientPtr client)
-{
- REQUEST(xReq);
- switch (stuff->data)
- {
- case X_XagQueryVersion:
- return SProcXagQueryVersion (client);
- case X_XagCreate:
- return SProcXagCreate (client);
- case X_XagDestroy:
- return SProcXagDestroy (client);
- case X_XagGetAttr:
- return SProcXagGetAttr (client);
- case X_XagQuery:
- return SProcXagQuery (client);
- case X_XagCreateAssoc:
- return SProcXagCreateAssoc (client);
- case X_XagDestroyAssoc:
- return SProcXagDestroyAssoc (client);
- default:
- return BadRequest;
- }
-}
-
-Colormap XagDefaultColormap(
- ClientPtr client)
-{
- return (client->appgroup ? client->appgroup->default_colormap : None);
-}
-
-VisualID XagRootVisual(
- ClientPtr client)
-{
- return (client->appgroup ? client->appgroup->root_visual : 0);
-}
-
-ClientPtr XagLeader(
- ClientPtr client)
-{
- return (client->appgroup ? client->appgroup->leader : NULL);
-}
-
-/*
- * Return whether the Map request event should be sent to the appgroup leader.
- * We don't want to send it to the leader when the window is on a different
- * screen, e.g. a print screen.
- */
-Bool XagIsControlledRoot(
- ClientPtr client,
- WindowPtr pParent)
-{
- if (client->appgroup) {
- if (client->appgroup->single_screen &&
- pParent->drawable.id == client->appgroup->default_root)
- return TRUE;
- else if (!pParent->parent)
- return TRUE;
- else
- return FALSE;
- }
- return FALSE;
-}
-
-void XagConnectionInfo(
- ClientPtr client,
- xConnSetupPrefix** conn_prefix,
- char** conn_info,
- int* num_screen)
-{
- if (client->appgroup && client->appgroup->ConnectionInfo) {
- *conn_prefix = &client->appgroup->connSetupPrefix;
- *conn_info = client->appgroup->ConnectionInfo;
- *num_screen = ((xConnSetup*)(client->appgroup->ConnectionInfo))->numRoots;
- }
-}
-
-XID XagId(
- ClientPtr client)
-{
- return (client->appgroup ? client->appgroup->appgroupId : 0);
-}
-
-static void XagCallClientStateChange(
- CallbackListPtr *pcbl,
- pointer nulldata,
- pointer calldata)
-{
- XaceAuthAvailRec* rec = (XaceAuthAvailRec*) calldata;
- ClientPtr pClient = rec->client;
-
- if (!pClient->appgroup) {
- SecurityAuthorizationPtr pAuth;
- XID authId = rec->authId;
-
- /* can't use SecurityLookupIDByType here -- client
- * security state hasn't been setup yet.
- */
- pAuth = (SecurityAuthorizationPtr)LookupIDByType(authId,
- SecurityAuthorizationResType);
- if (!pAuth)
- return;
-
- pClient->appgroup = (AppGroupPtr)LookupIDByType(pAuth->group,
- RT_APPGROUP);
- }
-
- if (pClient->appgroup) {
- NewClientInfoRec clientinfo;
-
- clientinfo.client = pClient;
- XagClientStateChange (NULL, NULL, (pointer)&clientinfo);
- }
-}
-
-void
-XagExtensionInit(INITARGS)
-{
- if (AddExtension (XAGNAME,
- 0,
- XagNumberErrors,
- ProcXagDispatch,
- SProcXagDispatch,
- XagResetProc,
- StandardMinorOpcode)) {
- RT_APPGROUP = CreateNewResourceType (XagAppGroupFree);
- XaceRegisterCallback(XACE_AUTH_AVAIL, XagCallClientStateChange, NULL);
- }
-}
diff --git a/Xext/appgroup.h b/Xext/appgroup.h
deleted file mode 100644
index 778da5de6..000000000
--- a/Xext/appgroup.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
-Copyright 1996, 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.
-*/
-
-#ifndef _APPGROUP_SRV_H_
-#define _APPGROUP_SRV_H_
-
-#include <X11/Xfuncproto.h>
-
-_XFUNCPROTOBEGIN
-
-extern void XagConnectionInfo(
- ClientPtr /* client */,
- xConnSetupPrefix** /* conn_prefix */,
- char** /* conn_info */,
- int* /* num_screens */
-);
-
-extern VisualID XagRootVisual(
- ClientPtr /* client */
-);
-
-extern Colormap XagDefaultColormap(
- ClientPtr /* client */
-);
-
-extern ClientPtr XagLeader(
- ClientPtr /* client */
-);
-
-extern Bool XagIsControlledRoot (
- ClientPtr /* client */,
- WindowPtr /* pParent */
-);
-
-extern XID XagId (
- ClientPtr /* client */
-);
-
-_XFUNCPROTOEND
-
-#endif /* _APPGROUP_SRV_H_ */
-
-
-
diff --git a/Xext/cup.c b/Xext/cup.c
deleted file mode 100644
index 7a81f5e3a..000000000
--- a/Xext/cup.c
+++ /dev/null
@@ -1,342 +0,0 @@
-/*
-
-Copyright 1997, 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.
-
-*/
-
-#define NEED_REPLIES
-#define NEED_EVENTS
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "dixstruct.h"
-#include "extnsionst.h"
-#include "colormapst.h"
-#include "scrnintstr.h"
-#include "servermd.h"
-#include "swapreq.h"
-#define _XCUP_SERVER_
-#include <X11/extensions/Xcupstr.h>
-#include <X11/Xfuncproto.h>
-
-#include "../os/osdep.h"
-
-#include "modinit.h"
-
-static int ProcDispatch(ClientPtr client);
-static int SProcDispatch(ClientPtr client);
-static void ResetProc(ExtensionEntry* extEntry);
-
-#if defined(WIN32) || defined(TESTWIN32)
-#define HAVE_SPECIAL_DESKTOP_COLORS
-#endif
-
-static xColorItem citems[] = {
-#ifndef HAVE_SPECIAL_DESKTOP_COLORS
-#define CUP_BLACK_PIXEL 0
-#define CUP_WHITE_PIXEL 1
- /* pix red green blue */
- { 0, 0, 0, 0, 0, 0 },
- { 1, 0xffff, 0xffff, 0xffff, 0, 0 }
-#else
-#ifndef WIN32
- /*
- This approximates the MS-Windows desktop colormap for testing
- purposes but has black and white pixels in the typical Unix
- locations, which should be switched if necessary if your system
- has blackPixel and whitePixel swapped. No entries are provided
- for colormap entries 254 and 255 because AllocColor/FindColor
- will reuse entries zero and one.
- */
- { 0, 0, 0, 0, 0, 0 },
- { 1, 0xffff, 0xffff, 0xffff, 0, 0 },
- { 2, 0x8000, 0, 0, 0, 0 },
- { 3, 0, 0x8000, 0, 0, 0 },
- { 4, 0x8000, 0x8000, 0, 0, 0 },
- { 5, 0, 0, 0x8000, 0, 0 },
- { 6, 0x8000, 0, 0x8000, 0, 0 },
- { 7, 0, 0x8000, 0x8000, 0, 0 },
- { 8, 0xc000, 0xc000, 0xc000, 0, 0 },
- { 9, 0xc000, 0xdc00, 0xc000, 0, 0 },
- { 246, 0xa000, 0xa000, 0xa000, 0, 0 },
- { 247, 0x8000, 0x8000, 0x8000, 0, 0 },
- { 248, 0xffff, 0, 0, 0, 0 },
- { 249, 0, 0xffff, 0, 0, 0 },
- { 250, 0xffff, 0xffff, 0, 0, 0 },
- { 251, 0, 0, 0xffff, 0, 0 },
- { 252, 0xffff, 0, 0xffff, 0, 0 },
- { 253, 0, 0xffff, 0xffff, 0, 0 }
-#else
- /*
- this is the MS-Windows desktop, adjusted for X's 16-bit color
- specifications.
- */
- { 0, 0, 0, 0, 0, 0 },
- { 1, 0x8000, 0, 0, 0, 0 },
- { 2, 0, 0x8000, 0, 0, 0 },
- { 3, 0x8000, 0x8000, 0, 0, 0 },
- { 4, 0, 0, 0x8000, 0, 0 },
- { 5, 0x8000, 0, 0x8000, 0, 0 },
- { 6, 0, 0x8000, 0x8000, 0, 0 },
- { 7, 0xc000, 0xc000, 0xc000, 0, 0 },
- { 8, 0xc000, 0xdc00, 0xc000, 0, 0 },
- { 9, 0xa600, 0xca00, 0xf000, 0, 0 },
- { 246, 0xff00, 0xfb00, 0xf000, 0, 0 },
- { 247, 0xa000, 0xa000, 0xa400, 0, 0 },
- { 248, 0x8000, 0x8000, 0x8000, 0, 0 },
- { 249, 0xff00, 0, 0, 0, 0 },
- { 250, 0, 0xff00, 0, 0, 0 },
- { 251, 0xff00, 0xff00, 0, 0, 0 },
- { 252, 0, 0, 0xff00, 0, 0 },
- { 253, 0xff00, 0, 0xff00, 0, 0 },
- { 254, 0, 0xff00, 0xff00, 0, 0 },
- { 255, 0xff00, 0xff00, 0xff00, 0, 0 }
-#endif
-#endif
-};
-#define NUM_DESKTOP_COLORS (sizeof citems / sizeof citems[0])
-
-void
-XcupExtensionInit (INITARGS)
-{
- (void) AddExtension (XCUPNAME,
- 0,
- XcupNumberErrors,
- ProcDispatch,
- SProcDispatch,
- ResetProc,
- StandardMinorOpcode);
-
- /* PC servers initialize the desktop colors (citems) here! */
-}
-
-/*ARGSUSED*/
-static
-void ResetProc(
- ExtensionEntry* extEntry)
-{
-}
-
-static
-int ProcQueryVersion(
- ClientPtr client)
-{
- /* REQUEST (xXcupQueryVersionReq); */
- xXcupQueryVersionReply rep;
- int n;
-
- REQUEST_SIZE_MATCH (xXcupQueryVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequence_number = client->sequence;
- rep.server_major_version = XCUP_MAJOR_VERSION;
- rep.server_minor_version = XCUP_MINOR_VERSION;
- if (client->swapped) {
- swaps (&rep.sequence_number, n);
- swapl (&rep.length, n);
- swaps (&rep.server_major_version, n);
- swaps (&rep.server_minor_version, n);
- }
- WriteToClient (client, sizeof (xXcupQueryVersionReply), (char *)&rep);
- return client->noClientException;
-}
-
-static
-int ProcGetReservedColormapEntries(
- ClientPtr client)
-{
- REQUEST (xXcupGetReservedColormapEntriesReq);
- xXcupGetReservedColormapEntriesReply rep;
- xColorItem* cptr;
- int n;
-
- REQUEST_SIZE_MATCH (xXcupGetReservedColormapEntriesReq);
-
- if (stuff->screen >= screenInfo.numScreens)
- return BadValue;
-
-#ifndef HAVE_SPECIAL_DESKTOP_COLORS
- citems[CUP_BLACK_PIXEL].pixel =
- screenInfo.screens[stuff->screen]->blackPixel;
- citems[CUP_WHITE_PIXEL].pixel =
- screenInfo.screens[stuff->screen]->whitePixel;
-#endif
-
- rep.type = X_Reply;
- rep.sequence_number = client->sequence;
- rep.length = NUM_DESKTOP_COLORS * 3;
- if (client->swapped) {
- swaps (&rep.sequence_number, n);
- swapl (&rep.length, n);
- }
- WriteToClient (client, sizeof (xXcupGetReservedColormapEntriesReply), (char *)&rep);
- for (n = 0, cptr = citems; n < NUM_DESKTOP_COLORS; n++, cptr++) {
- if (client->swapped) SwapColorItem (cptr);
- WriteToClient (client, SIZEOF(xColorItem), (char *)cptr);
- }
- return client->noClientException;
-}
-
-static
-int ProcStoreColors(
- ClientPtr client)
-{
- REQUEST (xXcupStoreColorsReq);
- ColormapPtr pcmp;
- int rc;
-
- REQUEST_AT_LEAST_SIZE (xXcupStoreColorsReq);
- rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP,
- client, DixAddAccess);
-
- if (rc == Success) {
- int ncolors, n;
- xXcupStoreColorsReply rep;
- xColorItem* cptr;
-
- if (!(pcmp->class & DynamicClass))
- return BadMatch;
-
- ncolors = (client->req_len << 2) - SIZEOF (xXcupStoreColorsReq);
- if (ncolors % SIZEOF(xColorItem))
- return BadLength;
-
- ncolors /= SIZEOF (xColorItem);
-
-
- for (n = 0, cptr = (xColorItem*) &stuff[1]; n < ncolors; n++) {
- Pixel pixel = cptr->pixel;
-
- if (AllocColor (pcmp,
- &cptr->red, &cptr->green, &cptr->blue,
- &pixel, client->index) == Success) {
- cptr->pixel = pixel;
- cptr->flags = 0x08;
- } else
- cptr->flags = 0;
- cptr = (xColorItem*) (((char*)cptr) + SIZEOF(xColorItem));
- }
-
- rep.type = X_Reply;
- rep.sequence_number = client->sequence;
- rep.length = ncolors * 3;
- if (client->swapped) {
- swaps (&rep.sequence_number, n);
- swapl (&rep.length, n);
- }
- WriteToClient (client, sizeof (xXcupGetReservedColormapEntriesReply), (char *)&rep);
- for (n = 0, cptr = (xColorItem*) &stuff[1]; n < ncolors; n++) {
- if (client->swapped) SwapColorItem (cptr);
- WriteToClient (client, SIZEOF(xColorItem), (char *)cptr);
- cptr = (xColorItem*) (((char*)cptr) + SIZEOF(xColorItem));
- }
- return client->noClientException;
- } else {
- client->errorValue = stuff->cmap;
- return (rc == BadValue) ? BadColor : rc;
- }
-}
-
-static
-int ProcDispatch(
- ClientPtr client)
-{
- REQUEST (xReq);
- switch (stuff->data)
- {
- case X_XcupQueryVersion:
- return ProcQueryVersion (client);
- case X_XcupGetReservedColormapEntries:
- return ProcGetReservedColormapEntries (client);
- case X_XcupStoreColors:
- return ProcStoreColors (client);
- default:
- return BadRequest;
- }
-}
-
-static
-int SProcQueryVersion(
- ClientPtr client)
-{
- int n;
-
- REQUEST(xXcupQueryVersionReq);
- swaps(&stuff->length, n);
- return ProcQueryVersion(client);
-}
-
-static
-int SProcGetReservedColormapEntries(
- ClientPtr client)
-{
- int n;
-
- REQUEST (xXcupGetReservedColormapEntriesReq);
- swaps (&stuff->length, n);
- swapl (&stuff->screen, n);
- REQUEST_AT_LEAST_SIZE (xXcupGetReservedColormapEntriesReq);
- return ProcGetReservedColormapEntries (client);
-}
-
-static
-int SProcXcupStoreColors(
- ClientPtr client)
-{
- int n;
- int count;
- xColorItem* pItem;
-
- REQUEST (xXcupStoreColorsReq);
- swaps (&stuff->length, n);
- REQUEST_AT_LEAST_SIZE (xXcupStoreColorsReq);
- swapl(&stuff->cmap, n);
- pItem = (xColorItem*) &stuff[1];
- for(count = LengthRestB(stuff)/sizeof(xColorItem); --count >= 0; )
- SwapColorItem(pItem++);
- return ProcStoreColors (client);
-}
-
-static
-int SProcDispatch(
- ClientPtr client)
-{
- REQUEST(xReq);
- switch (stuff->data)
- {
- case X_XcupQueryVersion:
- return SProcQueryVersion (client);
- case X_XcupGetReservedColormapEntries:
- return SProcGetReservedColormapEntries (client);
- case X_XcupStoreColors:
- return SProcXcupStoreColors (client);
- default:
- return BadRequest;
- }
-}
-
-
diff --git a/Xext/mitmisc.c b/Xext/mitmisc.c
deleted file mode 100644
index 07245c787..000000000
--- a/Xext/mitmisc.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/************************************************************
-
-Copyright 1989, 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.
-
-********************************************************/
-
-/* RANDOM CRUFT! THIS HAS NO OFFICIAL X CONSORTIUM OR X PROJECT TEAM BLESSING */
-
-
-#define NEED_EVENTS
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "os.h"
-#include "dixstruct.h"
-#include "extnsionst.h"
-#define _MITMISC_SERVER_
-#include <X11/extensions/mitmiscstr.h>
-#include "modinit.h"
-
-static void MITResetProc(
- ExtensionEntry * /* extEntry */
-);
-
-static DISPATCH_PROC(ProcMITDispatch);
-static DISPATCH_PROC(ProcMITGetBugMode);
-static DISPATCH_PROC(ProcMITSetBugMode);
-static DISPATCH_PROC(SProcMITDispatch);
-static DISPATCH_PROC(SProcMITGetBugMode);
-static DISPATCH_PROC(SProcMITSetBugMode);
-
-void
-MITMiscExtensionInit(INITARGS)
-{
- AddExtension(MITMISCNAME, 0, 0,
- ProcMITDispatch, SProcMITDispatch,
- MITResetProc, StandardMinorOpcode);
-}
-
-/*ARGSUSED*/
-static void
-MITResetProc (extEntry)
-ExtensionEntry *extEntry;
-{
-}
-
-static int
-ProcMITSetBugMode(client)
- ClientPtr client;
-{
- REQUEST(xMITSetBugModeReq);
-
- REQUEST_SIZE_MATCH(xMITSetBugModeReq);
- if (stuff->onOff != xFalse)
- return BadRequest;
- return(client->noClientException);
-}
-
-static int
-ProcMITGetBugMode(client)
- ClientPtr client;
-{
- xMITGetBugModeReply rep;
- int n;
-
- REQUEST_SIZE_MATCH(xMITGetBugModeReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.onOff = FALSE;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- }
- WriteToClient(client, sizeof(xMITGetBugModeReply), (char *)&rep);
- return(client->noClientException);
-}
-
-static int
-ProcMITDispatch (client)
- ClientPtr client;
-{
- REQUEST(xReq);
- switch (stuff->data)
- {
- case X_MITSetBugMode:
- return ProcMITSetBugMode(client);
- case X_MITGetBugMode:
- return ProcMITGetBugMode(client);
- default:
- return BadRequest;
- }
-}
-
-static int
-SProcMITSetBugMode(client)
- ClientPtr client;
-{
- int n;
- REQUEST(xMITSetBugModeReq);
-
- swaps(&stuff->length, n);
- return ProcMITSetBugMode(client);
-}
-
-static int
-SProcMITGetBugMode(client)
- ClientPtr client;
-{
- int n;
- REQUEST(xMITGetBugModeReq);
-
- swaps(&stuff->length, n);
- return ProcMITGetBugMode(client);
-}
-
-static int
-SProcMITDispatch (client)
- ClientPtr client;
-{
- REQUEST(xReq);
- switch (stuff->data)
- {
- case X_MITSetBugMode:
- return SProcMITSetBugMode(client);
- case X_MITGetBugMode:
- return SProcMITGetBugMode(client);
- default:
- return BadRequest;
- }
-}
diff --git a/Xext/sampleEVI.c b/Xext/sampleEVI.c
deleted file mode 100644
index a389efe04..000000000
--- a/Xext/sampleEVI.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/************************************************************
-Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
-Permission to use, copy, modify, and distribute this
-software and its documentation for any purpose and without
-fee is hereby granted, provided that the above copyright
-notice appear in all copies and that both that copyright
-notice and this permission notice appear in supporting
-documentation, and that the name of Silicon Graphics not be
-used in advertising or publicity pertaining to distribution
-of the software without specific prior written permission.
-Silicon Graphics makes no representation about the suitability
-of this software for any purpose. It is provided "as is"
-without any express or implied warranty.
-SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
-SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
-GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
-DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
-DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
-THE USE OR PERFORMANCE OF THIS SOFTWARE.
-********************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "dixstruct.h"
-#include "extnsionst.h"
-#include "dix.h"
-#define _XEVI_SERVER_
-#include <X11/extensions/XEVIstr.h>
-#include "EVIstruct.h"
-#include "scrnintstr.h"
-
-#if HAVE_STDINT_H
-#include <stdint.h>
-#elif !defined(UINT32_MAX)
-#define UINT32_MAX 0xffffffffU
-#endif
-
-static int sampleGetVisualInfo(
- VisualID32 *visual,
- int n_visual,
- xExtendedVisualInfo **evi_rn,
- int *n_info_rn,
- VisualID32 **conflict_rn,
- int *n_conflict_rn)
-{
- unsigned int max_sz_evi;
- VisualID32 *temp_conflict;
- xExtendedVisualInfo *evi;
- unsigned int max_visuals = 0, max_sz_conflict, sz_conflict = 0;
- register int visualI, scrI, sz_evi = 0, conflictI, n_conflict;
-
- if (n_visual > UINT32_MAX/(sz_xExtendedVisualInfo * screenInfo.numScreens))
- return BadAlloc;
- max_sz_evi = n_visual * sz_xExtendedVisualInfo * screenInfo.numScreens;
-
- for (scrI = 0; scrI < screenInfo.numScreens; scrI++) {
- if (screenInfo.screens[scrI]->numVisuals > max_visuals)
- max_visuals = screenInfo.screens[scrI]->numVisuals;
- }
-
- if (n_visual > UINT32_MAX/(sz_VisualID32 * screenInfo.numScreens
- * max_visuals))
- return BadAlloc;
- max_sz_conflict = n_visual * sz_VisualID32 * screenInfo.numScreens * max_visuals;
-
- *evi_rn = evi = (xExtendedVisualInfo *)xalloc(max_sz_evi);
- if (!*evi_rn)
- return BadAlloc;
-
- temp_conflict = (VisualID32 *)xalloc(max_sz_conflict);
- if (!temp_conflict) {
- xfree(*evi_rn);
- return BadAlloc;
- }
-
- for (scrI = 0; scrI < screenInfo.numScreens; scrI++) {
- for (visualI = 0; visualI < n_visual; visualI++) {
- evi[sz_evi].core_visual_id = visual[visualI];
- evi[sz_evi].screen = scrI;
- evi[sz_evi].level = 0;
- evi[sz_evi].transparency_type = XEVI_TRANSPARENCY_NONE;
- evi[sz_evi].transparency_value = 0;
- evi[sz_evi].min_hw_colormaps = 1;
- evi[sz_evi].max_hw_colormaps = 1;
- evi[sz_evi].num_colormap_conflicts = n_conflict = 0;
- for (conflictI = 0; conflictI < n_conflict; conflictI++)
- temp_conflict[sz_conflict++] = visual[visualI];
- sz_evi++;
- }
- }
- *conflict_rn = temp_conflict;
- *n_conflict_rn = sz_conflict;
- *n_info_rn = sz_evi;
- return Success;
-}
-
-static void sampleFreeVisualInfo(
- xExtendedVisualInfo *evi,
- VisualID32 *conflict)
-{
- if (evi)
- xfree(evi);
- if (conflict)
- xfree(conflict);
-}
-
-EviPrivPtr eviDDXInit(void)
-{
- static EviPrivRec eviPriv;
- eviPriv.getVisualInfo = sampleGetVisualInfo;
- eviPriv.freeVisualInfo = sampleFreeVisualInfo;
- return &eviPriv;
-}
-
-void eviDDXReset(void)
-{
-}
diff --git a/Xext/security.c b/Xext/security.c
index 160d954c9..f28b10dee 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -38,9 +38,6 @@ in this Software without prior written authorization from The Open Group.
#include "xacestr.h"
#include "securitysrv.h"
#include <X11/extensions/securstr.h>
-#ifdef XAPPGROUP
-#include "appgroup.h"
-#endif
#include "modinit.h"
/* Extension stuff */
@@ -833,11 +830,6 @@ SecurityResource(CallbackListPtr *pcbl, pointer unused, pointer calldata)
if (SecurityDoCheck(subj, obj, requested, allowed) == Success)
return;
-#ifdef XAPPGROUP
- if (rec->id == XagDefaultColormap(rec->client))
- return;
-#endif
-
SecurityAudit("Security: denied client %d access %x to resource 0x%x "
"of client %d on request %s\n", rec->client->index,
requested, rec->id, cid,
diff --git a/Xext/xres.c b/Xext/xres.c
index c6fcc3e5e..3c47012fd 100644
--- a/Xext/xres.c
+++ b/Xext/xres.c
@@ -64,7 +64,7 @@ ProcXResQueryClients (ClientPtr client)
REQUEST_SIZE_MATCH(xXResQueryClientsReq);
- current_clients = xalloc((currentMaxClients - 1) * sizeof(int));
+ current_clients = xalloc(currentMaxClients * sizeof(int));
num_clients = 0;
for(i = 0; i < currentMaxClients; i++) {
diff --git a/acinclude.m4 b/acinclude.m4
index f3d8734f3..833b5577e 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1,4 +1,150 @@
-##### http://autoconf-archive.cryp.to/ac_define_dir.html
+dnl dolt, a replacement for libtool
+dnl Copyright © 2007-2008 Josh Triplett <josh@freedesktop.org>
+dnl Copying and distribution of this file, with or without modification,
+dnl are permitted in any medium without royalty provided the copyright
+dnl notice and this notice are preserved.
+dnl
+dnl To use dolt, invoke the DOLT macro immediately after the libtool macros.
+dnl Optionally, copy this file into acinclude.m4, to avoid the need to have it
+dnl installed when running autoconf on your project.
+dnl
+dnl git snapshot: d91f2b4e9041538400e2703a2a6fbeecdb8ee27d
+AC_DEFUN([DOLT], [
+AC_REQUIRE([AC_CANONICAL_HOST])
+# dolt, a replacement for libtool
+# Josh Triplett <josh@freedesktop.org>
+AC_PATH_PROG(DOLT_BASH, bash)
+AC_MSG_CHECKING([if libtool sucks])
+AC_MSG_RESULT([yup, it does])
+AC_MSG_CHECKING([if dolt supports this host])
+dolt_supported=yes
+if test x$DOLT_BASH = x; then
+ dolt_supported=no
+fi
+if test x$GCC != xyes; then
+ dolt_supported=no
+fi
+case $host in
+i?86-*-linux*|x86_64-*-linux*|powerpc-*-linux*) ;;
+amd64-*-freebsd*|i?86-*-freebsd*|ia64-*-freebsd*) ;;
+*) dolt_supported=no ;;
+esac
+if test x$dolt_supported = xno ; then
+ AC_MSG_RESULT([no, falling back to libtool])
+ LTCOMPILE='$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(COMPILE)'
+ LTCXXCOMPILE='$(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXXCOMPILE)'
+else
+ AC_MSG_RESULT([yes, replacing libtool])
+
+dnl Start writing out doltcompile.
+ cat <<__DOLTCOMPILE__EOF__ >doltcompile
+#!$DOLT_BASH
+__DOLTCOMPILE__EOF__
+ cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
+args=("$[]@")
+for ((arg=0; arg<${#args@<:@@@:>@}; arg++)) ; do
+ if test x"${args@<:@$arg@:>@}" = x-o ; then
+ objarg=$((arg+1))
+ break
+ fi
+done
+if test x$objarg = x ; then
+ echo 'Error: no -o on compiler command line' 1>&2
+ exit 1
+fi
+lo="${args@<:@$objarg@:>@}"
+obj="${lo%.lo}"
+if test x"$lo" = x"$obj" ; then
+ echo "Error: libtool object file name \"$lo\" does not end in .lo" 1>&2
+ exit 1
+fi
+objbase="${obj##*/}"
+__DOLTCOMPILE__EOF__
+
+dnl Write out shared compilation code.
+ if test x$enable_shared = xyes; then
+ cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
+libobjdir="${obj%$objbase}.libs"
+if test ! -d "$libobjdir" ; then
+ mkdir_out="$(mkdir "$libobjdir" 2>&1)"
+ mkdir_ret=$?
+ if test "$mkdir_ret" -ne 0 && test ! -d "$libobjdir" ; then
+ echo "$mkdir_out" 1>&2
+ exit $mkdir_ret
+ fi
+fi
+pic_object="$libobjdir/$objbase.o"
+args@<:@$objarg@:>@="$pic_object"
+"${args@<:@@@:>@}" -fPIC -DPIC || exit $?
+__DOLTCOMPILE__EOF__
+ fi
+
+dnl Write out static compilation code.
+dnl Avoid duplicate compiler output if also building shared objects.
+ if test x$enable_static = xyes; then
+ cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
+non_pic_object="$obj.o"
+args@<:@$objarg@:>@="$non_pic_object"
+__DOLTCOMPILE__EOF__
+ if test x$enable_shared = xyes; then
+ cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
+"${args@<:@@@:>@}" >/dev/null 2>&1 || exit $?
+__DOLTCOMPILE__EOF__
+ else
+ cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
+"${args@<:@@@:>@}" || exit $?
+__DOLTCOMPILE__EOF__
+ fi
+ fi
+
+dnl Write out the code to write the .lo file.
+dnl The second line of the .lo file must match "^# Generated by .*libtool"
+ cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
+{
+echo "# $lo - a libtool object file"
+echo "# Generated by doltcompile, not libtool"
+__DOLTCOMPILE__EOF__
+
+ if test x$enable_shared = xyes; then
+ cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
+echo "pic_object='$pic_object'"
+__DOLTCOMPILE__EOF__
+ else
+ cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
+echo pic_object=none
+__DOLTCOMPILE__EOF__
+ fi
+
+ if test x$enable_static = xyes; then
+ cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
+echo "non_pic_object='$non_pic_object'"
+__DOLTCOMPILE__EOF__
+ else
+ cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
+echo non_pic_object=none
+__DOLTCOMPILE__EOF__
+ fi
+
+ cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
+} > "$lo"
+__DOLTCOMPILE__EOF__
+
+dnl Done writing out doltcompile; substitute it for libtool compilation.
+ chmod +x doltcompile
+ LTCOMPILE='$(top_builddir)/doltcompile $(COMPILE)'
+ LTCXXCOMPILE='$(top_builddir)/doltcompile $(CXXCOMPILE)'
+fi
+AC_SUBST(LTCOMPILE)
+AC_SUBST(LTCXXCOMPILE)
+# end dolt
+])
+
+
+
+
+# ===========================================================================
+# http://autoconf-archive.cryp.to/ac_define_dir.html
+# ===========================================================================
#
# SYNOPSIS
#
@@ -6,11 +152,11 @@
#
# DESCRIPTION
#
-# This macro sets VARNAME to the expansion of the DIR variable,
-# taking care of fixing up ${prefix} and such.
+# This macro sets VARNAME to the expansion of the DIR variable, taking
+# care of fixing up ${prefix} and such.
#
-# VARNAME is then offered as both an output variable and a C
-# preprocessor symbol.
+# VARNAME is then offered as both an output variable and a C preprocessor
+# symbol.
#
# Example:
#
@@ -18,18 +164,18 @@
#
# LAST MODIFICATION
#
-# 2006-10-13
+# 2008-04-12
#
# COPYLEFT
#
-# Copyright (c) 2006 Stepan Kasal <kasal@ucw.cz>
-# Copyright (c) 2006 Andreas Schwab <schwab@suse.de>
-# Copyright (c) 2006 Guido U. Draheim <guidod@gmx.de>
-# Copyright (c) 2006 Alexandre Oliva
+# Copyright (c) 2008 Stepan Kasal <kasal@ucw.cz>
+# Copyright (c) 2008 Andreas Schwab <schwab@suse.de>
+# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
+# Copyright (c) 2008 Alexandre Oliva
#
-# Copying and distribution of this file, with or without
-# modification, are permitted in any medium without royalty provided
-# the copyright notice and this notice are preserved.
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved.
AC_DEFUN([AC_DEFINE_DIR], [
prefix_NONE=
diff --git a/cfb/Makefile.am b/cfb/Makefile.am
deleted file mode 100644
index 901fc95ae..000000000
--- a/cfb/Makefile.am
+++ /dev/null
@@ -1,21 +0,0 @@
-noinst_LTLIBRARIES = libcfb.la
-
-include Makefile.am.inc
-
-DISTCLEANFILES += cfbglrop8.c
-
-libcfb_la_SOURCES = cfb8bit.c cfbteblt8.c cfbglrop8.c cfbpush8.c cfbrctstp8.c \
- $(libcfb_gen_sources) $(libcfb_common_sources)
-
-libcfb_la_LIBADD = ../mfb/libmfb.la
-
-AM_CFLAGS = -DPSZ=8 $(DIX_CFLAGS) $(PLATFORMDEFS)
-
-INCLUDES = $(CFB_INCLUDES) -I$(top_srcdir)/hw/xfree86/os-support -I$(top_srcdir)/hw/xfree86/common
-
-EXTRA_DIST = cfbline.c cfbfillarc.c cfbzerarc.c cfbblt.c cfbsolid.c \
- cfbtileodd.c cfbtile32.c cfb8line.c cfbply1rct.c cfbglblt8.c \
- cfb16.h cfb24.h cfb32.h cfb8bit.h cfbrrop.h \
- stip68kgnu.h stipmips.s stipsparc.s stipsprc32.s
-
-sdk_HEADERS = cfb.h cfb32.h cfb16.h cfbmap.h cfbunmap.h cfbmskbits.h
diff --git a/cfb/Makefile.am.inc b/cfb/Makefile.am.inc
deleted file mode 100644
index a2ee143aa..000000000
--- a/cfb/Makefile.am.inc
+++ /dev/null
@@ -1,153 +0,0 @@
-libcfb_gen_sources = cfbseg.c cfbfillarcC.c cfbfillarcG.c cfbzerarcC.c cfbzerarcX.c cfbzerarcG.c \
- cfbbltC.c cfbbltX.c cfbbltO.c cfbbltG.c cfbsolidC.c cfbsolidX.c cfbsolidG.c cfbtileoddC.c \
- cfbtileoddG.c cfbtile32C.c cfbtile32G.c cfb8lineCO.c cfb8lineCP.c cfb8lineX.c cfb8lineG.c \
- cfb8segCS.c cfb8segC.c cfb8segX.c cfb8setG.c cfbply1rctC.c cfbply1rctG.c
-
-DISTCLEANFILES = $(libcfb_gen_sources)
-
-CFB_INCLUDES = -I$(top_srcdir)/mfb -I$(top_srcdir)/cfb
-
-libcfb_common_sources = $(top_srcdir)/cfb/cfbgc.c $(top_srcdir)/cfb/cfbrrop.c \
- $(top_srcdir)/cfb/cfbwindow.c \
- $(top_srcdir)/cfb/cfbmskbits.c $(top_srcdir)/cfb/cfbpixmap.c \
- $(top_srcdir)/cfb/cfbbitblt.c $(top_srcdir)/cfb/cfbfillsp.c \
- $(top_srcdir)/cfb/cfbsetsp.c $(top_srcdir)/cfb/cfbscrinit.c \
- $(top_srcdir)/cfb/cfballpriv.c $(top_srcdir)/cfb/cfbgetsp.c \
- $(top_srcdir)/cfb/cfbfillrct.c $(top_srcdir)/cfb/cfbigblt8.c \
- $(top_srcdir)/cfb/cfbglblt8.c $(top_srcdir)/cfb/cfbtegblt.c \
- $(top_srcdir)/cfb/cfbpolypnt.c \
- $(top_srcdir)/cfb/cfbbres.c $(top_srcdir)/cfb/cfbline.c \
- $(top_srcdir)/cfb/cfbhrzvert.c $(top_srcdir)/cfb/cfbbresd.c \
- $(top_srcdir)/cfb/cfbimage.c $(top_srcdir)/cfb/cfbcppl.c \
- $(top_srcdir)/cfb/cfbcmap.c
-
-cfbseg.c:
- echo "#define POLYSEGMENT" > $@
- echo "#include \"$(top_srcdir)/cfb/cfbline.c\"" >> $@
-
-cfbfillarcC.c:
- echo "#define RROP GXcopy" > $@
- echo "#include \"$(top_srcdir)/cfb/cfbfillarc.c\"" >> $@
-
-cfbfillarcG.c:
- echo "#define RROP GXset" > $@
- echo "#include \"$(top_srcdir)/cfb/cfbfillarc.c\"" >> $@
-
-cfbzerarcC.c:
- echo "#define RROP GXcopy" > $@
- echo "#include \"$(top_srcdir)/cfb/cfbzerarc.c\"" >> $@
-
-cfbzerarcX.c:
- echo "#define RROP GXxor" > $@
- echo "#include \"$(top_srcdir)/cfb/cfbzerarc.c\"" >> $@
-
-cfbzerarcG.c:
- echo "#define RROP GXset" > $@
- echo "#include \"$(top_srcdir)/cfb/cfbzerarc.c\"" >> $@
-
-cfbbltC.c:
- echo "#define MROP Mcopy" > $@
- echo "#include \"$(top_srcdir)/cfb/cfbblt.c\"" >> $@
-
-cfbbltX.c:
- echo "#define MROP Mxor" > $@
- echo "#include \"$(top_srcdir)/cfb/cfbblt.c\"" >> $@
-
-cfbbltO.c:
- echo "#define MROP Mor" > $@
- echo "#include \"$(top_srcdir)/cfb/cfbblt.c\"" >> $@
-
-cfbbltG.c:
- echo "#define MROP 0" > $@
- echo "#include \"$(top_srcdir)/cfb/cfbblt.c\"" >> $@
-
-cfbsolidC.c:
- echo "#define RROP GXcopy" > $@
- echo "#include \"$(top_srcdir)/cfb/cfbsolid.c\"" >> $@
-
-cfbsolidX.c:
- echo "#define RROP GXxor" > $@
- echo "#include \"$(top_srcdir)/cfb/cfbsolid.c\"" >> $@
-
-cfbsolidG.c:
- echo "#define RROP GXset" > $@
- echo "#include \"$(top_srcdir)/cfb/cfbsolid.c\"" >> $@
-
-cfbtileoddC.c:
- echo "#define MROP Mcopy" > $@
- echo "#include \"$(top_srcdir)/cfb/cfbtileodd.c\"" >> $@
-
-cfbtileoddG.c:
- echo "#define MROP 0" > $@
- echo "#include \"$(top_srcdir)/cfb/cfbtileodd.c\"" >> $@
-
-cfbtile32C.c:
- echo "#define MROP Mcopy" > $@
- echo "#include \"$(top_srcdir)/cfb/cfbtile32.c\"" >> $@
-
-cfbtile32G.c:
- echo "#define MROP 0" > $@
- echo "#include \"$(top_srcdir)/cfb/cfbtile32.c\"" >> $@
-
-cfb8lineCO.c:
- echo "#define RROP GXcopy" > $@
- echo "#include \"$(top_srcdir)/cfb/cfb8line.c\"" >> $@
-
-cfb8lineCP.c:
- echo "#define RROP GXcopy" > $@
- echo "#define PREVIOUS" >> $@
- echo "#include \"$(top_srcdir)/cfb/cfb8line.c\"" >> $@
-
-cfb8lineX.c:
- echo "#define RROP GXxor" > $@
- echo "#include \"$(top_srcdir)/cfb/cfb8line.c\"" >> $@
-
-cfb8lineG.c:
- echo "#define RROP GXset" > $@
- echo "#include \"$(top_srcdir)/cfb/cfb8line.c\"" >> $@
-
-cfb8segCS.c:
- echo "#define RROP GXcopy" > $@
- echo "#define POLYSEGMENT" >> $@
- echo "#define WIDTH_SHIFT" >> $@
- echo "#include \"$(top_srcdir)/cfb/cfb8line.c\"" >> $@
-
-cfb8segC.c:
- echo "#define RROP GXcopy" > $@
- echo "#define POLYSEGMENT" >> $@
- echo "#include \"$(top_srcdir)/cfb/cfb8line.c\"" >> $@
-
-cfb8segX.c:
- echo "#define RROP GXxor" > $@
- echo "#define POLYSEGMENT" >> $@
- echo "#include \"$(top_srcdir)/cfb/cfb8line.c\"" >> $@
-
-cfb8setG.c:
- echo "#define RROP GXset" > $@
- echo "#define POLYSEGMENT" >> $@
- echo "#include \"$(top_srcdir)/cfb/cfb8line.c\"" >> $@
-
-cfbply1rctC.c:
- echo "#define RROP GXcopy" > $@
- echo "#include \"$(top_srcdir)/cfb/cfbply1rct.c\"" >> $@
-
-cfbply1rctG.c:
- echo "#define RROP GXset" > $@
- echo "#include \"$(top_srcdir)/cfb/cfbply1rct.c\"" >> $@
-
-cfbglrop8.c:
- echo "#define GLYPHROP" > $@
- echo "#include \"$(top_srcdir)/cfb/cfbglblt8.c\"" >> $@
-
-
-if XPRINT
-
-PLATFORMDEFS = -DXFREE86
-
-cfb8bit.o: compiler.h
-
-compiler.h:
- echo "#include \"$(top_srcdir)/hw/xfree86/common/compiler.h\"" >> $@
-
-endif
-
diff --git a/cfb/cfb.h b/cfb/cfb.h
deleted file mode 100644
index aece13341..000000000
--- a/cfb/cfb.h
+++ /dev/null
@@ -1,1268 +0,0 @@
-/************************************************************
-Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this
-software and its documentation for any purpose and without
-fee is hereby granted, provided that the above copyright no-
-tice appear in all copies and that both that copyright no-
-tice and this permission notice appear in supporting docu-
-mentation, and that the names of Sun or The Open Group
-not be used in advertising or publicity pertaining to
-distribution of the software without specific prior
-written permission. Sun and The Open Group make no
-representations about the suitability of this software for
-any purpose. It is provided "as is" without any express or
-implied warranty.
-
-SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
-NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
-ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
-PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
-OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
-THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-********************************************************/
-
-#if !defined(__CFB_H__) || defined(CFB_PROTOTYPES_ONLY)
-
-#include <X11/X.h>
-#include "globals.h"
-#include "pixmap.h"
-#include "region.h"
-#include "gc.h"
-#include "colormap.h"
-#include "miscstruct.h"
-#include "servermd.h"
-#include "privates.h"
-#include "windowstr.h"
-#include "mfb.h"
-#undef PixelType
-
-#include "cfbmap.h"
-
-#ifndef CfbBits
-#define CfbBits CARD32
-#endif
-
-#ifndef CFB_PROTOTYPES_ONLY
-#define __CFB_H__
-/*
- private filed of pixmap
- pixmap.devPrivate = (unsigned int *)pointer_to_bits
- pixmap.devKind = width_of_pixmap_in_bytes
-*/
-
-extern DevPrivateKey cfbGCPrivateKey;
-
-/* private field of GC */
-typedef struct {
- unsigned char rop; /* special case rop values */
- /* next two values unused in cfb, included for compatibility with mfb */
- unsigned char ropOpStip; /* rop for opaque stipple */
- /* this value is ropFillArea in mfb, usurped for cfb */
- unsigned char oneRect; /* drawable has one clip rect */
- CfbBits xor, and; /* reduced rop values */
- } cfbPrivGC;
-
-typedef cfbPrivGC *cfbPrivGCPtr;
-
-#define cfbGetGCPrivate(pGC) ((cfbPrivGCPtr)\
- dixLookupPrivate(&(pGC)->devPrivates, cfbGCPrivateKey))
-
-#define cfbGetCompositeClip(pGC) ((pGC)->pCompositeClip)
-
-/* way to carry RROP info around */
-typedef struct {
- unsigned char rop;
- CfbBits xor, and;
-} cfbRRopRec, *cfbRRopPtr;
-
-/* cfb8bit.c */
-
-extern int cfbSetStipple(
- int /*alu*/,
- CfbBits /*fg*/,
- CfbBits /*planemask*/
-);
-
-extern int cfbSetOpaqueStipple(
- int /*alu*/,
- CfbBits /*fg*/,
- CfbBits /*bg*/,
- CfbBits /*planemask*/
-);
-
-extern int cfbComputeClipMasks32(
- BoxPtr /*pBox*/,
- int /*numRects*/,
- int /*x*/,
- int /*y*/,
- int /*w*/,
- int /*h*/,
- CARD32 * /*clips*/
-);
-#endif /* !CFB_PROTOTYPES_ONLY */
-/* cfb8cppl.c */
-
-extern void cfbCopyImagePlane(
- DrawablePtr /*pSrcDrawable*/,
- DrawablePtr /*pDstDrawable*/,
- int /*rop*/,
- RegionPtr /*prgnDst*/,
- DDXPointPtr /*pptSrc*/,
- unsigned long /*planemask*/
-);
-
-#ifndef CFB_PROTOTYPES_ONLY
-extern void cfbCopyPlane8to1(
- DrawablePtr /*pSrcDrawable*/,
- DrawablePtr /*pDstDrawable*/,
- int /*rop*/,
- RegionPtr /*prgnDst*/,
- DDXPointPtr /*pptSrc*/,
- unsigned long /*planemask*/,
- unsigned long /*bitPlane*/
-);
-
-extern void cfbCopyPlane16to1(
- DrawablePtr /*pSrcDrawable*/,
- DrawablePtr /*pDstDrawable*/,
- int /*rop*/,
- RegionPtr /*prgnDst*/,
- DDXPointPtr /*pptSrc*/,
- unsigned long /*planemask*/,
- unsigned long /*bitPlane*/
-);
-
-extern void cfbCopyPlane24to1(
- DrawablePtr /*pSrcDrawable*/,
- DrawablePtr /*pDstDrawable*/,
- int /*rop*/,
- RegionPtr /*prgnDst*/,
- DDXPointPtr /*pptSrc*/,
- unsigned long /*planemask*/,
- unsigned long /*bitPlane*/
-);
-
-extern void cfbCopyPlane32to1(
- DrawablePtr /*pSrcDrawable*/,
- DrawablePtr /*pDstDrawable*/,
- int /*rop*/,
- RegionPtr /*prgnDst*/,
- DDXPointPtr /*pptSrc*/,
- unsigned long /*planemask*/,
- unsigned long /*bitPlane*/
-);
-#endif
-
-/* cfb8lineCO.c */
-
-extern int cfb8LineSS1RectCopy(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*mode*/,
- int /*npt*/,
- DDXPointPtr /*pptInit*/,
- DDXPointPtr /*pptInitOrig*/,
- int * /*x1p*/,
- int * /*y1p*/,
- int * /*x2p*/,
- int * /*y2p*/
-);
-
-extern void cfb8LineSS1Rect(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*mode*/,
- int /*npt*/,
- DDXPointPtr /*pptInit*/
-);
-
-extern void cfb8ClippedLineCopy(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*x1*/,
- int /*y1*/,
- int /*x2*/,
- int /*y2*/,
- BoxPtr /*boxp*/,
- Bool /*shorten*/
-);
-/* cfb8lineCP.c */
-
-extern int cfb8LineSS1RectPreviousCopy(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*mode*/,
- int /*npt*/,
- DDXPointPtr /*pptInit*/,
- DDXPointPtr /*pptInitOrig*/,
- int * /*x1p*/,
- int * /*y1p*/,
- int * /*x2p*/,
- int * /*y2p*/
-);
-/* cfb8lineG.c */
-
-extern int cfb8LineSS1RectGeneral(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*mode*/,
- int /*npt*/,
- DDXPointPtr /*pptInit*/,
- DDXPointPtr /*pptInitOrig*/,
- int * /*x1p*/,
- int * /*y1p*/,
- int * /*x2p*/,
- int * /*y2p*/
-);
-
-extern void cfb8ClippedLineGeneral(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*x1*/,
- int /*y1*/,
- int /*x2*/,
- int /*y2*/,
- BoxPtr /*boxp*/,
- Bool /*shorten*/
-);
-/* cfb8lineX.c */
-
-extern int cfb8LineSS1RectXor(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*mode*/,
- int /*npt*/,
- DDXPointPtr /*pptInit*/,
- DDXPointPtr /*pptInitOrig*/,
- int * /*x1p*/,
- int * /*y1p*/,
- int * /*x2p*/,
- int * /*y2p*/
-);
-
-extern void cfb8ClippedLineXor(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*x1*/,
- int /*y1*/,
- int /*x2*/,
- int /*y2*/,
- BoxPtr /*boxp*/,
- Bool /*shorten*/
-);
-/* cfb8segC.c */
-
-extern int cfb8SegmentSS1RectCopy(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nseg*/,
- xSegment * /*pSegInit*/
-);
-/* cfb8segCS.c */
-
-extern int cfb8SegmentSS1RectShiftCopy(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nseg*/,
- xSegment * /*pSegInit*/
-);
-
-extern void cfb8SegmentSS1Rect(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nseg*/,
- xSegment * /*pSegInit*/
-);
-/* cfb8segG.c */
-
-extern int cfb8SegmentSS1RectGeneral(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nseg*/,
- xSegment * /*pSegInit*/
-);
-/* cfbsegX.c */
-
-extern int cfb8SegmentSS1RectXor(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nseg*/,
- xSegment * /*pSegInit*/
-);
-/* cfballpriv.c */
-
-extern Bool cfbAllocatePrivates(
- ScreenPtr /*pScreen*/,
- DevPrivateKey * /*gc_key*/
-);
-/* cfbbitblt.c */
-
-extern RegionPtr cfbBitBlt(
- DrawablePtr /*pSrcDrawable*/,
- DrawablePtr /*pDstDrawable*/,
- GCPtr/*pGC*/,
- int /*srcx*/,
- int /*srcy*/,
- int /*width*/,
- int /*height*/,
- int /*dstx*/,
- int /*dsty*/,
- void (* /*doBitBlt*/)(
- DrawablePtr /*pSrc*/,
- DrawablePtr /*pDst*/,
- int /*alu*/,
- RegionPtr /*prgnDst*/,
- DDXPointPtr /*pptSrc*/,
- unsigned long /*planemask*/
- ),
- unsigned long /*bitPlane*/
-);
-
-#define cfbCopyPlaneExpand cfbBitBlt
-
-extern RegionPtr cfbCopyPlaneReduce(
- DrawablePtr /*pSrcDrawable*/,
- DrawablePtr /*pDstDrawable*/,
- GCPtr /*pGC*/,
- int /*srcx*/,
- int /*srcy*/,
- int /*width*/,
- int /*height*/,
- int /*dstx*/,
- int /*dsty*/,
- void (* /*doCopyPlane*/)(
- DrawablePtr /*pSrc*/,
- DrawablePtr /*pDst*/,
- int /*alu*/,
- RegionPtr /*prgnDst*/,
- DDXPointPtr /*pptSrc*/,
- unsigned long /*planemask*/,
- unsigned long /*bitPlane*/ /* We must know which plane to reduce! */
- ),
- unsigned long /*bitPlane*/
-);
-
-extern void cfbDoBitblt(
- DrawablePtr /*pSrc*/,
- DrawablePtr /*pDst*/,
- int /*alu*/,
- RegionPtr /*prgnDst*/,
- DDXPointPtr /*pptSrc*/,
- unsigned long /*planemask*/
-);
-
-extern RegionPtr cfbCopyArea(
- DrawablePtr /*pSrcDrawable*/,
- DrawablePtr /*pDstDrawable*/,
- GCPtr/*pGC*/,
- int /*srcx*/,
- int /*srcy*/,
- int /*width*/,
- int /*height*/,
- int /*dstx*/,
- int /*dsty*/
-);
-
-#ifndef CFB_PROTOTYPES_ONLY
-extern void cfbCopyPlane1to8(
- DrawablePtr /*pSrcDrawable*/,
- DrawablePtr /*pDstDrawable*/,
- int /*rop*/,
- RegionPtr /*prgnDst*/,
- DDXPointPtr /*pptSrc*/,
- unsigned long /*planemask*/
-);
-#endif
-
-extern RegionPtr cfbCopyPlane(
- DrawablePtr /*pSrcDrawable*/,
- DrawablePtr /*pDstDrawable*/,
- GCPtr /*pGC*/,
- int /*srcx*/,
- int /*srcy*/,
- int /*width*/,
- int /*height*/,
- int /*dstx*/,
- int /*dsty*/,
- unsigned long /*bitPlane*/
-);
-/* cfbbltC.c */
-
-extern void cfbDoBitbltCopy(
- DrawablePtr /*pSrc*/,
- DrawablePtr /*pDst*/,
- int /*alu*/,
- RegionPtr /*prgnDst*/,
- DDXPointPtr /*pptSrc*/,
- unsigned long /*planemask*/
-);
-/* cfbbltG.c */
-
-extern void cfbDoBitbltGeneral(
- DrawablePtr /*pSrc*/,
- DrawablePtr /*pDst*/,
- int /*alu*/,
- RegionPtr /*prgnDst*/,
- DDXPointPtr /*pptSrc*/,
- unsigned long /*planemask*/
-);
-/* cfbbltO.c */
-
-extern void cfbDoBitbltOr(
- DrawablePtr /*pSrc*/,
- DrawablePtr /*pDst*/,
- int /*alu*/,
- RegionPtr /*prgnDst*/,
- DDXPointPtr /*pptSrc*/,
- unsigned long /*planemask*/
-);
-/* cfbbltX.c */
-
-extern void cfbDoBitbltXor(
- DrawablePtr /*pSrc*/,
- DrawablePtr /*pDst*/,
- int /*alu*/,
- RegionPtr /*prgnDst*/,
- DDXPointPtr /*pptSrc*/,
- unsigned long /*planemask*/
-);
-/* cfbbres.c */
-
-extern void cfbBresS(
- int /*rop*/,
- CfbBits /*and*/,
- CfbBits /*xor*/,
- CfbBits * /*addrl*/,
- int /*nlwidth*/,
- int /*signdx*/,
- int /*signdy*/,
- int /*axis*/,
- int /*x1*/,
- int /*y1*/,
- int /*e*/,
- int /*e1*/,
- int /*e2*/,
- int /*len*/
-);
-/* cfbbresd.c */
-
-extern void cfbBresD(
- cfbRRopPtr /*rrops*/,
- int * /*pdashIndex*/,
- unsigned char * /*pDash*/,
- int /*numInDashList*/,
- int * /*pdashOffset*/,
- int /*isDoubleDash*/,
- CfbBits * /*addrl*/,
- int /*nlwidth*/,
- int /*signdx*/,
- int /*signdy*/,
- int /*axis*/,
- int /*x1*/,
- int /*y1*/,
- int /*e*/,
- int /*e1*/,
- int /*e2*/,
- int /*len*/
-);
-
-/* cfbcmap.c */
-
-#ifndef CFB_PROTOTYPES_ONLY
-extern int cfbListInstalledColormaps(
- ScreenPtr /*pScreen*/,
- Colormap * /*pmaps*/
-);
-
-extern void cfbInstallColormap(
- ColormapPtr /*pmap*/
-);
-
-extern void cfbUninstallColormap(
- ColormapPtr /*pmap*/
-);
-
-extern void cfbResolveColor(
- unsigned short * /*pred*/,
- unsigned short * /*pgreen*/,
- unsigned short * /*pblue*/,
- VisualPtr /*pVisual*/
-);
-
-extern Bool cfbInitializeColormap(
- ColormapPtr /*pmap*/
-);
-
-extern int cfbExpandDirectColors(
- ColormapPtr /*pmap*/,
- int /*ndef*/,
- xColorItem * /*indefs*/,
- xColorItem * /*outdefs*/
-);
-
-extern Bool cfbCreateDefColormap(
- ScreenPtr /*pScreen*/
-);
-
-extern Bool cfbSetVisualTypes(
- int /*depth*/,
- int /*visuals*/,
- int /*bitsPerRGB*/
-);
-
-extern void cfbClearVisualTypes(void);
-
-extern Bool cfbInitVisuals(
- VisualPtr * /*visualp*/,
- DepthPtr * /*depthp*/,
- int * /*nvisualp*/,
- int * /*ndepthp*/,
- int * /*rootDepthp*/,
- VisualID * /*defaultVisp*/,
- unsigned long /*sizes*/,
- int /*bitsPerRGB*/
-);
-#endif
-/* cfbfillarcC.c */
-
-extern void cfbPolyFillArcSolidCopy(
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- int /*narcs*/,
- xArc * /*parcs*/
-);
-/* cfbfillarcG.c */
-
-extern void cfbPolyFillArcSolidGeneral(
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- int /*narcs*/,
- xArc * /*parcs*/
-);
-/* cfbfillrct.c */
-
-extern void cfbFillBoxTileOdd(
- DrawablePtr /*pDrawable*/,
- int /*n*/,
- BoxPtr /*rects*/,
- PixmapPtr /*tile*/,
- int /*xrot*/,
- int /*yrot*/
-);
-
-extern void cfbFillRectTileOdd(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nBox*/,
- BoxPtr /*pBox*/
-);
-
-extern void cfbPolyFillRect(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nrectFill*/,
- xRectangle * /*prectInit*/
-);
-/* cfbfillsp.c */
-
-extern void cfbUnnaturalTileFS(
- DrawablePtr /*pDrawable*/,
- GCPtr/*pGC*/,
- int /*nInit*/,
- DDXPointPtr /*pptInit*/,
- int * /*pwidthInit*/,
- int /*fSorted*/
-);
-
-extern void cfbUnnaturalStippleFS(
- DrawablePtr /*pDrawable*/,
- GCPtr/*pGC*/,
- int /*nInit*/,
- DDXPointPtr /*pptInit*/,
- int * /*pwidthInit*/,
- int /*fSorted*/
-);
-
-#ifndef CFB_PROTOTYPES_ONLY
-extern void cfb8Stipple32FS(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nInit*/,
- DDXPointPtr /*pptInit*/,
- int * /*pwidthInit*/,
- int /*fSorted*/
-);
-
-extern void cfb8OpaqueStipple32FS(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nInit*/,
- DDXPointPtr /*pptInit*/,
- int * /*pwidthInit*/,
- int /*fSorted*/
-);
-#endif
-/* cfbgc.c */
-
-extern GCOpsPtr cfbMatchCommon(
- GCPtr /*pGC*/,
- cfbPrivGCPtr /*devPriv*/
-);
-
-extern Bool cfbCreateGC(
- GCPtr /*pGC*/
-);
-
-extern void cfbValidateGC(
- GCPtr /*pGC*/,
- unsigned long /*changes*/,
- DrawablePtr /*pDrawable*/
-);
-
-/* cfbgetsp.c */
-
-extern void cfbGetSpans(
- DrawablePtr /*pDrawable*/,
- int /*wMax*/,
- DDXPointPtr /*ppt*/,
- int * /*pwidth*/,
- int /*nspans*/,
- char * /*pdstStart*/
-);
-/* cfbglblt8.c */
-
-extern void cfbPolyGlyphBlt8(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*x*/,
- int /*y*/,
- unsigned int /*nglyph*/,
- CharInfoPtr * /*ppci*/,
- pointer /*pglyphBase*/
-);
-/* cfbglrop8.c */
-
-extern void cfbPolyGlyphRop8(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*x*/,
- int /*y*/,
- unsigned int /*nglyph*/,
- CharInfoPtr * /*ppci*/,
- pointer /*pglyphBase*/
-);
-/* cfbhrzvert.c */
-
-extern void cfbHorzS(
- int /*rop*/,
- CfbBits /*and*/,
- CfbBits /*xor*/,
- CfbBits * /*addrl*/,
- int /*nlwidth*/,
- int /*x1*/,
- int /*y1*/,
- int /*len*/
-);
-
-extern void cfbVertS(
- int /*rop*/,
- CfbBits /*and*/,
- CfbBits /*xor*/,
- CfbBits * /*addrl*/,
- int /*nlwidth*/,
- int /*x1*/,
- int /*y1*/,
- int /*len*/
-);
-/* cfbigblt8.c */
-
-extern void cfbImageGlyphBlt8(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*x*/,
- int /*y*/,
- unsigned int /*nglyph*/,
- CharInfoPtr * /*ppci*/,
- pointer /*pglyphBase*/
-);
-/* cfbimage.c */
-
-extern void cfbPutImage(
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- int /*depth*/,
- int /*x*/,
- int /*y*/,
- int /*w*/,
- int /*h*/,
- int /*leftPad*/,
- int /*format*/,
- char * /*pImage*/
-);
-
-extern void cfbGetImage(
- DrawablePtr /*pDrawable*/,
- int /*sx*/,
- int /*sy*/,
- int /*w*/,
- int /*h*/,
- unsigned int /*format*/,
- unsigned long /*planeMask*/,
- char * /*pdstLine*/
-);
-/* cfbline.c */
-
-extern void cfbLineSS(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*mode*/,
- int /*npt*/,
- DDXPointPtr /*pptInit*/
-);
-
-extern void cfbLineSD(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*mode*/,
- int /*npt*/,
- DDXPointPtr /*pptInit*/
-);
-/* cfbmskbits.c */
-/* cfbpixmap.c */
-
-extern PixmapPtr cfbCreatePixmap(
- ScreenPtr /*pScreen*/,
- int /*width*/,
- int /*height*/,
- int /*depth*/,
- unsigned /*usage_hint*/
-);
-
-extern Bool cfbDestroyPixmap(
- PixmapPtr /*pPixmap*/
-);
-
-extern PixmapPtr cfbCopyPixmap(
- PixmapPtr /*pSrc*/
-);
-
-extern void cfbPadPixmap(
- PixmapPtr /*pPixmap*/
-);
-
-extern void cfbXRotatePixmap(
- PixmapPtr /*pPix*/,
- int /*rw*/
-);
-
-extern void cfbYRotatePixmap(
- PixmapPtr /*pPix*/,
- int /*rh*/
-);
-
-extern void cfbCopyRotatePixmap(
- PixmapPtr /*psrcPix*/,
- PixmapPtr * /*ppdstPix*/,
- int /*xrot*/,
- int /*yrot*/
-);
-/* cfbply1rctC.c */
-
-extern void cfbFillPoly1RectCopy(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*shape*/,
- int /*mode*/,
- int /*count*/,
- DDXPointPtr /*ptsIn*/
-);
-/* cfbply1rctG.c */
-
-extern void cfbFillPoly1RectGeneral(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*shape*/,
- int /*mode*/,
- int /*count*/,
- DDXPointPtr /*ptsIn*/
-);
-/* cfbpolypnt.c */
-
-extern void cfbPolyPoint(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*mode*/,
- int /*npt*/,
- xPoint * /*pptInit*/
-);
-/* cfbpush8.c */
-
-#ifndef CFB_PROTOTYPES_ONLY
-extern void cfbPushPixels8(
- GCPtr /*pGC*/,
- PixmapPtr /*pBitmap*/,
- DrawablePtr /*pDrawable*/,
- int /*dx*/,
- int /*dy*/,
- int /*xOrg*/,
- int /*yOrg*/
-);
-/* cfbrctstp8.c */
-
-extern void cfb8FillRectOpaqueStippled32(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nBox*/,
- BoxPtr /*pBox*/
-);
-
-extern void cfb8FillRectTransparentStippled32(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nBox*/,
- BoxPtr /*pBox*/
-);
-
-extern void cfb8FillRectStippledUnnatural(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nBox*/,
- BoxPtr /*pBox*/
-);
-#endif
-/* cfbrrop.c */
-
-extern int cfbReduceRasterOp(
- int /*rop*/,
- CfbBits /*fg*/,
- CfbBits /*pm*/,
- CfbBits * /*andp*/,
- CfbBits * /*xorp*/
-);
-/* cfbscrinit.c */
-
-extern Bool cfbCloseScreen(
- int /*index*/,
- ScreenPtr /*pScreen*/
-);
-
-extern Bool cfbSetupScreen(
- ScreenPtr /*pScreen*/,
- pointer /*pbits*/,
- int /*xsize*/,
- int /*ysize*/,
- int /*dpix*/,
- int /*dpiy*/,
- int /*width*/
-);
-
-extern Bool cfbFinishScreenInit(
- ScreenPtr /*pScreen*/,
- pointer /*pbits*/,
- int /*xsize*/,
- int /*ysize*/,
- int /*dpix*/,
- int /*dpiy*/,
- int /*width*/
-);
-
-extern Bool cfbScreenInit(
- ScreenPtr /*pScreen*/,
- pointer /*pbits*/,
- int /*xsize*/,
- int /*ysize*/,
- int /*dpix*/,
- int /*dpiy*/,
- int /*width*/
-);
-
-extern PixmapPtr cfbGetScreenPixmap(
- ScreenPtr /*pScreen*/
-);
-
-extern void cfbSetScreenPixmap(
- PixmapPtr /*pPix*/
-);
-
-/* cfbseg.c */
-
-extern void cfbSegmentSS(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nseg*/,
- xSegment * /*pSeg*/
-);
-
-extern void cfbSegmentSD(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nseg*/,
- xSegment * /*pSeg*/
-);
-/* cfbsetsp.c */
-
-extern void cfbSetScanline(
- int /*y*/,
- int /*xOrigin*/,
- int /*xStart*/,
- int /*xEnd*/,
- unsigned int * /*psrc*/,
- int /*alu*/,
- int * /*pdstBase*/,
- int /*widthDst*/,
- unsigned long /*planemask*/
-);
-
-extern void cfbSetSpans(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- char * /*psrc*/,
- DDXPointPtr /*ppt*/,
- int * /*pwidth*/,
- int /*nspans*/,
- int /*fSorted*/
-);
-/* cfbsolidC.c */
-
-extern void cfbFillRectSolidCopy(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nBox*/,
- BoxPtr /*pBox*/
-);
-
-extern void cfbSolidSpansCopy(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nInit*/,
- DDXPointPtr /*pptInit*/,
- int * /*pwidthInit*/,
- int /*fSorted*/
-);
-/* cfbsolidG.c */
-
-extern void cfbFillRectSolidGeneral(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nBox*/,
- BoxPtr /*pBox*/
-);
-
-extern void cfbSolidSpansGeneral(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nInit*/,
- DDXPointPtr /*pptInit*/,
- int * /*pwidthInit*/,
- int /*fSorted*/
-);
-/* cfbsolidX.c */
-
-extern void cfbFillRectSolidXor(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nBox*/,
- BoxPtr /*pBox*/
-);
-
-extern void cfbSolidSpansXor(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nInit*/,
- DDXPointPtr /*pptInit*/,
- int * /*pwidthInit*/,
- int /*fSorted*/
-);
-/* cfbteblt8.c */
-
-#ifndef CFB_PROTOTYPES_ONLY
-extern void cfbTEGlyphBlt8(
- DrawablePtr /*pDrawable*/,
- GCPtr/*pGC*/,
- int /*xInit*/,
- int /*yInit*/,
- unsigned int /*nglyph*/,
- CharInfoPtr * /*ppci*/,
- pointer /*pglyphBase*/
-);
-#endif
-/* cfbtegblt.c */
-
-extern void cfbTEGlyphBlt(
- DrawablePtr /*pDrawable*/,
- GCPtr/*pGC*/,
- int /*x*/,
- int /*y*/,
- unsigned int /*nglyph*/,
- CharInfoPtr * /*ppci*/,
- pointer /*pglyphBase*/
-);
-/* cfbtile32C.c */
-
-extern void cfbFillRectTile32Copy(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nBox*/,
- BoxPtr /*pBox*/
-);
-
-extern void cfbTile32FSCopy(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nInit*/,
- DDXPointPtr /*pptInit*/,
- int * /*pwidthInit*/,
- int /*fSorted*/
-);
-/* cfbtile32G.c */
-
-extern void cfbFillRectTile32General(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nBox*/,
- BoxPtr /*pBox*/
-);
-
-extern void cfbTile32FSGeneral(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- int /*nInit*/,
- DDXPointPtr /*pptInit*/,
- int * /*pwidthInit*/,
- int /*fSorted*/
-);
-/* cfbtileoddC.c */
-
-extern void cfbFillBoxTileOddCopy(
- DrawablePtr /*pDrawable*/,
- int /*nBox*/,
- BoxPtr /*pBox*/,
- PixmapPtr /*tile*/,
- int /*xrot*/,
- int /*yrot*/,
- int /*alu*/,
- unsigned long /*planemask*/
-);
-
-extern void cfbFillSpanTileOddCopy(
- DrawablePtr /*pDrawable*/,
- int /*n*/,
- DDXPointPtr /*ppt*/,
- int * /*pwidth*/,
- PixmapPtr /*tile*/,
- int /*xrot*/,
- int /*yrot*/,
- int /*alu*/,
- unsigned long /*planemask*/
-);
-
-extern void cfbFillBoxTile32sCopy(
- DrawablePtr /*pDrawable*/,
- int /*nBox*/,
- BoxPtr /*pBox*/,
- PixmapPtr /*tile*/,
- int /*xrot*/,
- int /*yrot*/,
- int /*alu*/,
- unsigned long /*planemask*/
-);
-
-extern void cfbFillSpanTile32sCopy(
- DrawablePtr /*pDrawable*/,
- int /*n*/,
- DDXPointPtr /*ppt*/,
- int * /*pwidth*/,
- PixmapPtr /*tile*/,
- int /*xrot*/,
- int /*yrot*/,
- int /*alu*/,
- unsigned long /*planemask*/
-);
-/* cfbtileoddG.c */
-
-extern void cfbFillBoxTileOddGeneral(
- DrawablePtr /*pDrawable*/,
- int /*nBox*/,
- BoxPtr /*pBox*/,
- PixmapPtr /*tile*/,
- int /*xrot*/,
- int /*yrot*/,
- int /*alu*/,
- unsigned long /*planemask*/
-);
-
-extern void cfbFillSpanTileOddGeneral(
- DrawablePtr /*pDrawable*/,
- int /*n*/,
- DDXPointPtr /*ppt*/,
- int * /*pwidth*/,
- PixmapPtr /*tile*/,
- int /*xrot*/,
- int /*yrot*/,
- int /*alu*/,
- unsigned long /*planemask*/
-);
-
-extern void cfbFillBoxTile32sGeneral(
- DrawablePtr /*pDrawable*/,
- int /*nBox*/,
- BoxPtr /*pBox*/,
- PixmapPtr /*tile*/,
- int /*xrot*/,
- int /*yrot*/,
- int /*alu*/,
- unsigned long /*planemask*/
-);
-
-extern void cfbFillSpanTile32sGeneral(
- DrawablePtr /*pDrawable*/,
- int /*n*/,
- DDXPointPtr /*ppt*/,
- int * /*pwidth*/,
- PixmapPtr /*tile*/,
- int /*xrot*/,
- int /*yrot*/,
- int /*alu*/,
- unsigned long /*planemask*/
-);
-/* cfbwindow.c */
-
-extern Bool cfbCreateWindow(
- WindowPtr /*pWin*/
-);
-
-extern Bool cfbDestroyWindow(
- WindowPtr /*pWin*/
-);
-
-extern Bool cfbMapWindow(
- WindowPtr /*pWindow*/
-);
-
-extern Bool cfbPositionWindow(
- WindowPtr /*pWin*/,
- int /*x*/,
- int /*y*/
-);
-
-extern Bool cfbUnmapWindow(
- WindowPtr /*pWindow*/
-);
-
-extern void cfbCopyWindow(
- WindowPtr /*pWin*/,
- DDXPointRec /*ptOldOrg*/,
- RegionPtr /*prgnSrc*/
-);
-
-extern Bool cfbChangeWindowAttributes(
- WindowPtr /*pWin*/,
- unsigned long /*mask*/
-);
-/* cfbzerarcC.c */
-
-extern void cfbZeroPolyArcSS8Copy(
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- int /*narcs*/,
- xArc * /*parcs*/
-);
-/* cfbzerarcG.c */
-
-extern void cfbZeroPolyArcSS8General(
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- int /*narcs*/,
- xArc * /*parcs*/
-);
-/* cfbzerarcX.c */
-
-extern void cfbZeroPolyArcSS8Xor(
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- int /*narcs*/,
- xArc * /*parcs*/
-);
-
-#if (!defined(SINGLEDEPTH) && PSZ != 8) || defined(FORCE_SEPARATE_PRIVATE)
-
-#define CFB_NEED_SCREEN_PRIVATE
-
-extern DevPrivateKey cfbScreenPrivateKey;
-#endif
-
-#ifndef CFB_PROTOTYPES_ONLY
-
-/* Common macros for extracting drawing information */
-
-#define cfbGetWindowPixmap(d) \
- ((* ((DrawablePtr)(d))->pScreen->GetWindowPixmap)((WindowPtr)(d)))
-
-#define cfbGetTypedWidth(pDrawable,wtype) (\
- (((pDrawable)->type != DRAWABLE_PIXMAP) ? \
- (int) (cfbGetWindowPixmap(pDrawable)->devKind) : \
- (int)(((PixmapPtr)pDrawable)->devKind)) / sizeof (wtype))
-
-#define cfbGetByteWidth(pDrawable) cfbGetTypedWidth(pDrawable, unsigned char)
-
-#define cfbGetPixelWidth(pDrawable) cfbGetTypedWidth(pDrawable, PixelType)
-
-#define cfbGetLongWidth(pDrawable) cfbGetTypedWidth(pDrawable, CfbBits)
-
-#define cfbGetTypedWidthAndPointer(pDrawable, width, pointer, wtype, ptype) {\
- PixmapPtr _pPix; \
- if ((pDrawable)->type != DRAWABLE_PIXMAP) \
- _pPix = cfbGetWindowPixmap(pDrawable); \
- else \
- _pPix = (PixmapPtr) (pDrawable); \
- (pointer) = (ptype *) _pPix->devPrivate.ptr; \
- (width) = ((int) _pPix->devKind) / sizeof (wtype); \
-}
-
-#define cfbGetByteWidthAndPointer(pDrawable, width, pointer) \
- cfbGetTypedWidthAndPointer(pDrawable, width, pointer, unsigned char, unsigned char)
-
-#define cfbGetLongWidthAndPointer(pDrawable, width, pointer) \
- cfbGetTypedWidthAndPointer(pDrawable, width, pointer, CfbBits, CfbBits)
-
-#define cfbGetPixelWidthAndPointer(pDrawable, width, pointer) \
- cfbGetTypedWidthAndPointer(pDrawable, width, pointer, PixelType, PixelType)
-
-#define cfbGetWindowTypedWidthAndPointer(pWin, width, pointer, wtype, ptype) {\
- PixmapPtr _pPix = cfbGetWindowPixmap((DrawablePtr) (pWin)); \
- (pointer) = (ptype *) _pPix->devPrivate.ptr; \
- (width) = ((int) _pPix->devKind) / sizeof (wtype); \
-}
-
-#define cfbGetWindowLongWidthAndPointer(pWin, width, pointer) \
- cfbGetWindowTypedWidthAndPointer(pWin, width, pointer, CfbBits, CfbBits)
-
-#define cfbGetWindowByteWidthAndPointer(pWin, width, pointer) \
- cfbGetWindowTypedWidthAndPointer(pWin, width, pointer, unsigned char, unsigned char)
-
-#define cfbGetWindowPixelWidthAndPointer(pDrawable, width, pointer) \
- cfbGetWindowTypedWidthAndPointer(pDrawable, width, pointer, PixelType, PixelType)
-
-/*
- * XFree86 empties the root BorderClip when the VT is inactive,
- * here's a macro which uses that to disable GetImage and GetSpans
- */
-#define cfbWindowEnabled(pWin) \
- REGION_NOTEMPTY((pWin)->drawable.pScreen, \
- &WindowTable[(pWin)->drawable.pScreen->myNum]->borderClip)
-
-#define cfbDrawableEnabled(pDrawable) \
- ((pDrawable)->type == DRAWABLE_PIXMAP ? \
- TRUE : cfbWindowEnabled((WindowPtr) pDrawable))
-
-#include "micoord.h"
-
-#endif /* !CFB_PROTOTYPES_ONLY */
-
-#endif
diff --git a/cfb/cfb16.h b/cfb/cfb16.h
deleted file mode 100644
index 6b5c30209..000000000
--- a/cfb/cfb16.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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
deleted file mode 100644
index ea5fc848e..000000000
--- a/cfb/cfb24.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * 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.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#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
deleted file mode 100644
index 18a5dc1c3..000000000
--- a/cfb/cfb32.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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/cfb8bit.c b/cfb/cfb8bit.c
deleted file mode 100644
index 54a08c53d..000000000
--- a/cfb/cfb8bit.c
+++ /dev/null
@@ -1,469 +0,0 @@
-/*
-
-Copyright 1989, 1994, 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.
-
-*/
-
-/*
- * cfb8bit.c
- *
- * 8 bit color frame buffer utility routines
- */
-
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#if PSZ == 8
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <X11/Xproto.h>
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "regionstr.h"
-#include "cfb.h"
-#include "cfbmskbits.h"
-#include "cfb8bit.h"
-
-PixelGroup cfb8StippleMasks[NUM_MASKS] = {
-#if NUM_MASKS == 16
- 0x00000000, 0x000000ff, 0x0000ff00, 0x0000ffff,
- 0x00ff0000, 0x00ff00ff, 0x00ffff00, 0x00ffffff,
- 0xff000000, 0xff0000ff, 0xff00ff00, 0xff00ffff,
- 0xffff0000, 0xffff00ff, 0xffffff00, 0xffffffff
-#else /* NUM_MASKS == 256 */
- 0x0000000000000000, 0x00000000000000ff,
- 0x000000000000ff00, 0x000000000000ffff,
- 0x0000000000ff0000, 0x0000000000ff00ff,
- 0x0000000000ffff00, 0x0000000000ffffff,
- 0x00000000ff000000, 0x00000000ff0000ff,
- 0x00000000ff00ff00, 0x00000000ff00ffff,
- 0x00000000ffff0000, 0x00000000ffff00ff,
- 0x00000000ffffff00, 0x00000000ffffffff,
- 0x000000ff00000000, 0x000000ff000000ff,
- 0x000000ff0000ff00, 0x000000ff0000ffff,
- 0x000000ff00ff0000, 0x000000ff00ff00ff,
- 0x000000ff00ffff00, 0x000000ff00ffffff,
- 0x000000ffff000000, 0x000000ffff0000ff,
- 0x000000ffff00ff00, 0x000000ffff00ffff,
- 0x000000ffffff0000, 0x000000ffffff00ff,
- 0x000000ffffffff00, 0x000000ffffffffff,
- 0x0000ff0000000000, 0x0000ff00000000ff,
- 0x0000ff000000ff00, 0x0000ff000000ffff,
- 0x0000ff0000ff0000, 0x0000ff0000ff00ff,
- 0x0000ff0000ffff00, 0x0000ff0000ffffff,
- 0x0000ff00ff000000, 0x0000ff00ff0000ff,
- 0x0000ff00ff00ff00, 0x0000ff00ff00ffff,
- 0x0000ff00ffff0000, 0x0000ff00ffff00ff,
- 0x0000ff00ffffff00, 0x0000ff00ffffffff,
- 0x0000ffff00000000, 0x0000ffff000000ff,
- 0x0000ffff0000ff00, 0x0000ffff0000ffff,
- 0x0000ffff00ff0000, 0x0000ffff00ff00ff,
- 0x0000ffff00ffff00, 0x0000ffff00ffffff,
- 0x0000ffffff000000, 0x0000ffffff0000ff,
- 0x0000ffffff00ff00, 0x0000ffffff00ffff,
- 0x0000ffffffff0000, 0x0000ffffffff00ff,
- 0x0000ffffffffff00, 0x0000ffffffffffff,
- 0x00ff000000000000, 0x00ff0000000000ff,
- 0x00ff00000000ff00, 0x00ff00000000ffff,
- 0x00ff000000ff0000, 0x00ff000000ff00ff,
- 0x00ff000000ffff00, 0x00ff000000ffffff,
- 0x00ff0000ff000000, 0x00ff0000ff0000ff,
- 0x00ff0000ff00ff00, 0x00ff0000ff00ffff,
- 0x00ff0000ffff0000, 0x00ff0000ffff00ff,
- 0x00ff0000ffffff00, 0x00ff0000ffffffff,
- 0x00ff00ff00000000, 0x00ff00ff000000ff,
- 0x00ff00ff0000ff00, 0x00ff00ff0000ffff,
- 0x00ff00ff00ff0000, 0x00ff00ff00ff00ff,
- 0x00ff00ff00ffff00, 0x00ff00ff00ffffff,
- 0x00ff00ffff000000, 0x00ff00ffff0000ff,
- 0x00ff00ffff00ff00, 0x00ff00ffff00ffff,
- 0x00ff00ffffff0000, 0x00ff00ffffff00ff,
- 0x00ff00ffffffff00, 0x00ff00ffffffffff,
- 0x00ffff0000000000, 0x00ffff00000000ff,
- 0x00ffff000000ff00, 0x00ffff000000ffff,
- 0x00ffff0000ff0000, 0x00ffff0000ff00ff,
- 0x00ffff0000ffff00, 0x00ffff0000ffffff,
- 0x00ffff00ff000000, 0x00ffff00ff0000ff,
- 0x00ffff00ff00ff00, 0x00ffff00ff00ffff,
- 0x00ffff00ffff0000, 0x00ffff00ffff00ff,
- 0x00ffff00ffffff00, 0x00ffff00ffffffff,
- 0x00ffffff00000000, 0x00ffffff000000ff,
- 0x00ffffff0000ff00, 0x00ffffff0000ffff,
- 0x00ffffff00ff0000, 0x00ffffff00ff00ff,
- 0x00ffffff00ffff00, 0x00ffffff00ffffff,
- 0x00ffffffff000000, 0x00ffffffff0000ff,
- 0x00ffffffff00ff00, 0x00ffffffff00ffff,
- 0x00ffffffffff0000, 0x00ffffffffff00ff,
- 0x00ffffffffffff00, 0x00ffffffffffffff,
- 0xff00000000000000, 0xff000000000000ff,
- 0xff0000000000ff00, 0xff0000000000ffff,
- 0xff00000000ff0000, 0xff00000000ff00ff,
- 0xff00000000ffff00, 0xff00000000ffffff,
- 0xff000000ff000000, 0xff000000ff0000ff,
- 0xff000000ff00ff00, 0xff000000ff00ffff,
- 0xff000000ffff0000, 0xff000000ffff00ff,
- 0xff000000ffffff00, 0xff000000ffffffff,
- 0xff0000ff00000000, 0xff0000ff000000ff,
- 0xff0000ff0000ff00, 0xff0000ff0000ffff,
- 0xff0000ff00ff0000, 0xff0000ff00ff00ff,
- 0xff0000ff00ffff00, 0xff0000ff00ffffff,
- 0xff0000ffff000000, 0xff0000ffff0000ff,
- 0xff0000ffff00ff00, 0xff0000ffff00ffff,
- 0xff0000ffffff0000, 0xff0000ffffff00ff,
- 0xff0000ffffffff00, 0xff0000ffffffffff,
- 0xff00ff0000000000, 0xff00ff00000000ff,
- 0xff00ff000000ff00, 0xff00ff000000ffff,
- 0xff00ff0000ff0000, 0xff00ff0000ff00ff,
- 0xff00ff0000ffff00, 0xff00ff0000ffffff,
- 0xff00ff00ff000000, 0xff00ff00ff0000ff,
- 0xff00ff00ff00ff00, 0xff00ff00ff00ffff,
- 0xff00ff00ffff0000, 0xff00ff00ffff00ff,
- 0xff00ff00ffffff00, 0xff00ff00ffffffff,
- 0xff00ffff00000000, 0xff00ffff000000ff,
- 0xff00ffff0000ff00, 0xff00ffff0000ffff,
- 0xff00ffff00ff0000, 0xff00ffff00ff00ff,
- 0xff00ffff00ffff00, 0xff00ffff00ffffff,
- 0xff00ffffff000000, 0xff00ffffff0000ff,
- 0xff00ffffff00ff00, 0xff00ffffff00ffff,
- 0xff00ffffffff0000, 0xff00ffffffff00ff,
- 0xff00ffffffffff00, 0xff00ffffffffffff,
- 0xffff000000000000, 0xffff0000000000ff,
- 0xffff00000000ff00, 0xffff00000000ffff,
- 0xffff000000ff0000, 0xffff000000ff00ff,
- 0xffff000000ffff00, 0xffff000000ffffff,
- 0xffff0000ff000000, 0xffff0000ff0000ff,
- 0xffff0000ff00ff00, 0xffff0000ff00ffff,
- 0xffff0000ffff0000, 0xffff0000ffff00ff,
- 0xffff0000ffffff00, 0xffff0000ffffffff,
- 0xffff00ff00000000, 0xffff00ff000000ff,
- 0xffff00ff0000ff00, 0xffff00ff0000ffff,
- 0xffff00ff00ff0000, 0xffff00ff00ff00ff,
- 0xffff00ff00ffff00, 0xffff00ff00ffffff,
- 0xffff00ffff000000, 0xffff00ffff0000ff,
- 0xffff00ffff00ff00, 0xffff00ffff00ffff,
- 0xffff00ffffff0000, 0xffff00ffffff00ff,
- 0xffff00ffffffff00, 0xffff00ffffffffff,
- 0xffffff0000000000, 0xffffff00000000ff,
- 0xffffff000000ff00, 0xffffff000000ffff,
- 0xffffff0000ff0000, 0xffffff0000ff00ff,
- 0xffffff0000ffff00, 0xffffff0000ffffff,
- 0xffffff00ff000000, 0xffffff00ff0000ff,
- 0xffffff00ff00ff00, 0xffffff00ff00ffff,
- 0xffffff00ffff0000, 0xffffff00ffff00ff,
- 0xffffff00ffffff00, 0xffffff00ffffffff,
- 0xffffffff00000000, 0xffffffff000000ff,
- 0xffffffff0000ff00, 0xffffffff0000ffff,
- 0xffffffff00ff0000, 0xffffffff00ff00ff,
- 0xffffffff00ffff00, 0xffffffff00ffffff,
- 0xffffffffff000000, 0xffffffffff0000ff,
- 0xffffffffff00ff00, 0xffffffffff00ffff,
- 0xffffffffffff0000, 0xffffffffffff00ff,
- 0xffffffffffffff00, 0xffffffffffffffff
-#endif
-};
-
-int cfb8StippleMode, cfb8StippleAlu, cfb8StippleRRop;
-PixelGroup cfb8StippleFg, cfb8StippleBg, cfb8StipplePm;
-PixelGroup cfb8StippleAnd[NUM_MASKS], cfb8StippleXor[NUM_MASKS];
-
-int
-cfb8SetStipple (alu, fg, planemask)
-int alu;
-CfbBits fg, planemask;
-{
- CfbBits and, xor, rrop;
- int s;
- CfbBits c;
-
- cfb8StippleMode = FillStippled;
- cfb8StippleAlu = alu;
- cfb8StippleFg = fg & PMSK;
- cfb8StipplePm = planemask & PMSK;
- rrop = cfbReduceRasterOp (alu, fg, planemask, &and, &xor);
- cfb8StippleRRop = rrop;
- /*
- * create the appropriate pixel-fill bits for current
- * foreground
- */
- for (s = 0; s < NUM_MASKS; s++)
- {
- c = cfb8StippleMasks[s];
- cfb8StippleAnd[s] = and | ~c;
- cfb8StippleXor[s] = xor & c;
- }
- return TRUE;
-}
-
-
-int
-cfb8SetOpaqueStipple (alu, fg, bg, planemask)
-int alu;
-CfbBits fg, bg, planemask;
-{
- CfbBits andfg, xorfg, andbg, xorbg, rropfg, rropbg;
- int s;
- CfbBits c;
-
- cfb8StippleMode = FillOpaqueStippled;
- cfb8StippleAlu = alu;
- cfb8StippleFg = fg & PMSK;
- cfb8StippleBg = bg & PMSK;
- cfb8StipplePm = planemask & PMSK;
- rropfg = cfbReduceRasterOp (alu, cfb8StippleFg, cfb8StipplePm, &andfg, &xorfg);
- rropbg = cfbReduceRasterOp (alu, cfb8StippleBg, cfb8StipplePm, &andbg, &xorbg);
- if (rropfg == rropbg)
- cfb8StippleRRop = rropfg;
- else
- cfb8StippleRRop = GXset;
- /*
- * create the appropriate pixel-fill bits for current
- * foreground
- */
- for (s = 0; s < NUM_MASKS; s++)
- {
- c = cfb8StippleMasks[s];
- cfb8StippleAnd[s] = (andfg | ~c) & (andbg | c);
- cfb8StippleXor[s] = (xorfg & c) | (xorbg & ~c);
- }
- return TRUE;
-}
-
-/*
- * a grungy little routine. This computes clip masks
- * for partial character blts. Returns rgnOUT if the
- * entire character is clipped; returns rgnIN if the entire
- * character is unclipped; returns rgnPART if a portion of
- * the character is visible. Computes clip masks for each
- * longword of the character -- and those with the
- * contents of the glyph to compute the visible bits.
- */
-
-#if PGSZ == 32
-#if (BITMAP_BIT_ORDER == MSBFirst)
-PixelGroup cfb8BitLenMasks[PGSZ] = {
- 0xffffffff, 0x7fffffff, 0x3fffffff, 0x1fffffff,
- 0x0fffffff, 0x07ffffff, 0x03ffffff, 0x01ffffff,
- 0x00ffffff, 0x007fffff, 0x003fffff, 0x001fffff,
- 0x000fffff, 0x0007ffff, 0x0003ffff, 0x0001ffff,
- 0x0000ffff, 0x00007fff, 0x00003fff, 0x00001fff,
- 0x00000fff, 0x000007ff, 0x000003ff, 0x000001ff,
- 0x000000ff, 0x0000007f, 0x0000003f, 0x0000001f,
- 0x0000000f, 0x00000007, 0x00000003, 0x00000001,
-};
-#else
-PixelGroup cfb8BitLenMasks[PGSZ] = {
- 0xffffffff, 0xfffffffe, 0xfffffffc, 0xfffffff8,
- 0xfffffff0, 0xffffffe0, 0xffffffc0, 0xffffff80,
- 0xffffff00, 0xfffffe00, 0xfffffc00, 0xfffff800,
- 0xfffff000, 0xffffe000, 0xffffc000, 0xffff8000,
- 0xffff0000, 0xfffe0000, 0xfffc0000, 0xfff80000,
- 0xfff00000, 0xffe00000, 0xffc00000, 0xff800000,
- 0xff000000, 0xfe000000, 0xfc000000, 0xf8000000,
- 0xf0000000, 0xe0000000, 0xc0000000, 0x80000000,
-};
-#endif /* BITMAP_BIT_ORDER */
-#else /* PGSZ == 64 */
-#if (BITMAP_BIT_ORDER == MSBFirst)
-PixelGroup cfb8BitLenMasks[PGSZ] = {
- 0xffffffffffffffff, 0x7fffffffffffffff,
- 0x3fffffffffffffff, 0x1fffffffffffffff,
- 0x0fffffffffffffff, 0x07ffffffffffffff,
- 0x03ffffffffffffff, 0x01ffffffffffffff,
- 0x00ffffffffffffff, 0x007fffffffffffff,
- 0x003fffffffffffff, 0x001fffffffffffff,
- 0x000fffffffffffff, 0x0007ffffffffffff,
- 0x0003ffffffffffff, 0x0001ffffffffffff,
- 0x0000ffffffffffff, 0x00007fffffffffff,
- 0x00003fffffffffff, 0x00001fffffffffff,
- 0x00000fffffffffff, 0x000007ffffffffff,
- 0x000003ffffffffff, 0x000001ffffffffff,
- 0x000000ffffffffff, 0x0000007fffffffff,
- 0x0000003fffffffff, 0x0000001fffffffff,
- 0x0000000fffffffff, 0x00000007ffffffff,
- 0x00000003ffffffff, 0x00000001ffffffff,
- 0x00000000ffffffff, 0x000000007fffffff,
- 0x000000003fffffff, 0x000000001fffffff,
- 0x000000000fffffff, 0x0000000007ffffff,
- 0x0000000003ffffff, 0x0000000001ffffff,
- 0x0000000000ffffff, 0x00000000007fffff,
- 0x00000000003fffff, 0x00000000001fffff,
- 0x00000000000fffff, 0x000000000007ffff,
- 0x000000000003ffff, 0x000000000001ffff,
- 0x000000000000ffff, 0x0000000000007fff,
- 0x0000000000003fff, 0x0000000000001fff,
- 0x0000000000000fff, 0x00000000000007ff,
- 0x00000000000003ff, 0x00000000000001ff,
- 0x00000000000000ff, 0x000000000000007f,
- 0x000000000000003f, 0x000000000000001f,
- 0x000000000000000f, 0x0000000000000007,
- 0x0000000000000003, 0x0000000000000001
-};
-#else
-PixelGroup cfb8BitLenMasks[PGSZ] = {
- 0xffffffffffffffff, 0xfffffffffffffffe,
- 0xfffffffffffffffc, 0xfffffffffffffff8,
- 0xfffffffffffffff0, 0xffffffffffffffe0,
- 0xffffffffffffffc0, 0xffffffffffffff80,
- 0xffffffffffffff00, 0xfffffffffffffe00,
- 0xfffffffffffffc00, 0xfffffffffffff800,
- 0xfffffffffffff000, 0xffffffffffffe000,
- 0xffffffffffffc000, 0xffffffffffff8000,
- 0xffffffffffff0000, 0xfffffffffffe0000,
- 0xfffffffffffc0000, 0xfffffffffff80000,
- 0xfffffffffff00000, 0xffffffffffe00000,
- 0xffffffffffc00000, 0xffffffffff800000,
- 0xffffffffff000000, 0xfffffffffe000000,
- 0xfffffffffc000000, 0xfffffffff8000000,
- 0xfffffffff0000000, 0xffffffffe0000000,
- 0xffffffffc0000000, 0xffffffff80000000,
- 0xffffffff00000000, 0xfffffffe00000000,
- 0xfffffffc00000000, 0xfffffff800000000,
- 0xfffffff000000000, 0xffffffe000000000,
- 0xffffffc000000000, 0xffffff8000000000,
- 0xffffff0000000000, 0xfffffe0000000000,
- 0xfffffc0000000000, 0xfffff80000000000,
- 0xfffff00000000000, 0xffffe00000000000,
- 0xffffc00000000000, 0xffff800000000000,
- 0xffff000000000000, 0xfffe000000000000,
- 0xfffc000000000000, 0xfff8000000000000,
- 0xfff0000000000000, 0xffe0000000000000,
- 0xffc0000000000000, 0xff80000000000000,
- 0xff00000000000000, 0xfe00000000000000,
- 0xfc00000000000000, 0xf800000000000000,
- 0xf000000000000000, 0xe000000000000000,
- 0xc000000000000000, 0x8000000000000000
-};
-#endif /* BITMAP_BIT_ORDER */
-#endif /* PGSZ */
-
-
-
-int
-cfb8ComputeClipMasks32 (pBox, numRects, x, y, w, h, clips)
- BoxPtr pBox;
- int numRects;
- int x, y, w, h;
- CARD32 *clips;
-{
- int yBand, yBandBot;
- int ch;
- CfbBits clip;
- int partIN = FALSE, partOUT = FALSE;
- int result;
-
- if (numRects == 0)
- return rgnOUT;
- while (numRects && pBox->y2 <= y)
- {
- --numRects;
- ++pBox;
- }
- if (!numRects || pBox->y1 >= y + h)
- return rgnOUT;
- yBand = pBox->y1;
- while (numRects && pBox->y1 == yBand && pBox->x2 <= x)
- {
- --numRects;
- ++pBox;
- }
- if (!numRects || pBox->y1 >= y + h)
- return rgnOUT;
- if (numRects &&
- x >= pBox->x1 &&
- x + w <= pBox->x2 &&
- y >= pBox->y1 &&
- y + h <= pBox->y2)
- {
- return rgnIN;
- }
- ch = 0;
- while (numRects && pBox->y1 < y + h)
- {
- yBand = pBox->y1;
- yBandBot = pBox->y2;
- while (ch < h && y + ch < yBand)
- {
- partOUT = TRUE;
- clips[ch++] = 0;
- }
- if (ch >= h)
- break;
- while (numRects && pBox->y1 == yBand && pBox->x2 <= x)
- {
- --numRects;
- ++pBox;
- }
- if (!numRects)
- break;
- clip = 0;
- while (numRects && pBox->y1 == yBand && pBox->x1 < x + w)
- {
- if (x < pBox->x1)
- if (pBox->x2 < x + w)
- clip |= cfb8BitLenMasks[pBox->x1 - x] & ~cfb8BitLenMasks[pBox->x2 - x];
- else
- clip |= cfb8BitLenMasks[pBox->x1 - x];
- else
- if (pBox->x2 < x + w)
- clip |= ~cfb8BitLenMasks[pBox->x2 - x];
- else
- clip = ~0;
- --numRects;
- ++pBox;
- }
- if (clip != 0)
- partIN = TRUE;
- if (clip != ~0)
- partOUT = TRUE;
- while (ch < h && y + ch < yBandBot)
- clips[ch++] = clip;
- while (numRects && pBox->y1 == yBand)
- {
- --numRects;
- ++pBox;
- }
- }
- while (ch < h)
- {
- partOUT = TRUE;
- clips[ch++] = 0;
- }
- result = rgnOUT;
- if (partIN)
- {
- if (partOUT)
- result = rgnPART;
- else
- result = rgnIN;
- }
- return result;
-}
-
-#endif /* PSZ == 8 */
diff --git a/cfb/cfb8bit.h b/cfb/cfb8bit.h
deleted file mode 100644
index 5a17adf4f..000000000
--- a/cfb/cfb8bit.h
+++ /dev/null
@@ -1,1570 +0,0 @@
-/*
- * cfb8bit.h
- *
- * Defines which are only useful to 8 bit color frame buffers
- *
- * That doesn't seem to be true any more. Some of the macros in here
- * are used for depths other than 8. Perhaps the file should be
- * renamed. dpw
- */
-
-/*
-
-Copyright 1989, 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.
-*/
-
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "servermd.h"
-
-#if (BITMAP_BIT_ORDER == MSBFirst)
-#define GetBitGroup(x) (((PixelGroup) (x)) >> (PGSZ - PGSZB))
-#define NextBitGroup(x) ((x) <<= PGSZB)
-#define NextSomeBits(x,n) ((x) <<= (n))
-#else
-#define GetBitGroup(x) ((x) & PGSZBMSK)
-#define NextBitGroup(x) ((x) >>= PGSZB)
-#define NextSomeBits(x,n) ((x) >>= (n))
-#endif
-
-#define RotBitsLeft(x,k) ((x) = BitLeft (x,k) | \
- BitRight (x, PGSZ-(k)))
-
-#if defined(__GNUC__) && defined(mc68020)
-#undef RotBitsLeft
-#define RotBitsLeft(x,k) asm("rol%.l %2,%0" \
- : "=d" (x) \
- : "0" (x), "dI" (k))
-#endif
-
-#if PSZ == 8
-
-#define GetPixelGroup(x) (cfb8StippleXor[GetBitGroup(x)])
-#define RRopPixels(dst,x) (DoRRop(dst,cfb8StippleAnd[x], cfb8StippleXor[x]))
-#define RRopPixelGroup(dst,x) (RRopPixels(dst,GetBitGroup(x)))
-#define MaskRRopPixels(dst,x,mask) (DoMaskRRop(dst,cfb8StippleAnd[x], cfb8StippleXor[x], mask))
-
-#define NUM_MASKS (1<<PPW) /* XXX goes in cfbmskbits.h? */
-extern int cfb8StippleMode, cfb8StippleAlu;
-extern PixelGroup cfb8StippleFg, cfb8StippleBg, cfb8StipplePm;
-extern PixelGroup cfb8StippleMasks[NUM_MASKS];
-extern PixelGroup cfb8StippleAnd[NUM_MASKS], cfb8StippleXor[NUM_MASKS];
-extern int cfb8StippleRRop;
-
-#define cfb8PixelMasks cfb8StippleMasks
-#define cfb8Pixels cfb8StippleXor
-
-#define cfb8CheckPixels(fg, bg) \
- (FillOpaqueStippled == cfb8StippleMode && \
- GXcopy == cfb8StippleAlu && \
- ((fg) & PMSK) == cfb8StippleFg && \
- ((bg) & PMSK) == cfb8StippleBg && \
- PMSK == cfb8StipplePm)
-
-#define cfb8CheckOpaqueStipple(alu,fg,bg,pm) \
- ((FillOpaqueStippled == cfb8StippleMode && \
- (alu) == cfb8StippleAlu && \
- ((fg) & PMSK) == cfb8StippleFg && \
- ((bg) & PMSK) == cfb8StippleBg && \
- ((pm) & PMSK) == cfb8StipplePm) ? 0 : cfb8SetOpaqueStipple(alu,fg,bg,pm))
-
-#define cfb8CheckStipple(alu,fg,pm) \
- ((FillStippled == cfb8StippleMode && \
- (alu) == cfb8StippleAlu && \
- ((fg) & PMSK) == cfb8StippleFg && \
- ((pm) & PMSK) == cfb8StipplePm) ? 0 : cfb8SetStipple(alu,fg,pm))
-
-#define cfb8SetPixels(fg,bg) cfb8SetOpaqueStipple(GXcopy,fg,bg,PMSK)
-
-/*
- * These macros are shared between the unnatural spans code
- * and the unnatural rectangle code. No reasonable person
- * would attempt to use them anyplace else.
- */
-
-#define NextUnnaturalStippleWord \
- if (bitsLeft >= MFB_PPW) \
- { \
- inputBits = *srcTemp++; \
- bitsLeft -= MFB_PPW; \
- partBitsLeft = MFB_PPW; \
- } \
- else \
- { \
- inputBits = 0; \
- if (bitsLeft) \
- inputBits = *srcTemp & ~cfb8BitLenMasks[bitsLeft]; \
- srcTemp = srcStart; \
- partBitsLeft = bitsLeft; \
- bitsLeft = bitsWhole; \
- }
-
-#define NextUnnaturalStippleBits \
- if (partBitsLeft >= PPW) { \
- bits = GetBitGroup (inputBits); \
- NextBitGroup (inputBits); \
- partBitsLeft -= PPW; \
- } else { \
- bits = GetBitGroup (inputBits); \
- nextPartBits = PPW - partBitsLeft; \
- NextUnnaturalStippleWord \
- if (partBitsLeft < nextPartBits) { \
- if (partBitsLeft) {\
- bits |= BitRight (GetBitGroup (inputBits), \
- PPW - nextPartBits) & PPWMSK;\
- nextPartBits -= partBitsLeft; \
- } \
- NextUnnaturalStippleWord \
- } \
- bits |= BitRight (GetBitGroup (inputBits), \
- PPW - nextPartBits) & PPWMSK; \
- NextSomeBits (inputBits, nextPartBits); \
- partBitsLeft -= nextPartBits; \
- }
-
-#define NextUnnaturalStippleBitsFast \
- if (partBitsLeft >= PPW) { \
- bits = GetBitGroup(inputBits); \
- NextBitGroup(inputBits); \
- partBitsLeft -= PPW; \
- } else { \
- bits = GetBitGroup (inputBits); \
- nextPartBits = PPW - partBitsLeft; \
- inputBits = *srcTemp++; \
- bits |= BitRight (GetBitGroup (inputBits), \
- partBitsLeft) & PPWMSK; \
- NextSomeBits (inputBits, nextPartBits); \
- partBitsLeft = MFB_PPW - nextPartBits; \
- }
-
-/*
- * WriteBitGroup takes the destination address, a pixel
- * value (which must be 8 bits duplicated 4 time with PFILL)
- * and the PPW bits to write, which must be in the low order
- * bits of the register (probably from GetBitGroup) and writes
- * the appropriate locations in memory with the pixel value. This
- * is a copy-mode only operation.
- */
-
-#define RRopBitGroup(dst,bits) \
- { \
- *(dst) = RRopPixels(*(dst),bits); \
- }
-
-#define MaskRRopBitGroup(dst,bits,mask) \
- { \
- *(dst) = MaskRRopPixels(*(dst),bits,mask); \
- }
-#endif /* PSZ == 8 */
-
-#if !defined(AVOID_MEMORY_READ) && PSZ == 8
-
-#define WriteBitGroup(dst,pixel,bits) \
- { \
- register PixelGroup _maskTmp = cfb8PixelMasks[(bits)]; \
- *(dst) = (*(dst) & ~_maskTmp) | ((pixel) & _maskTmp); \
- }
-
-#define SwitchBitGroup(dst,pixel,bits) \
- { \
- register PixelGroup _maskTmp = cfb8PixelMasks[(bits)]; \
- register PixelGroup _pixTmp = ((pixel) & _maskTmp); \
- _maskTmp = ~_maskTmp; \
- SwitchBitsLoop (*(dst) = (*(dst) & _maskTmp) | _pixTmp;) \
- }
-
-#else /* AVOID_MEMORY_READ */
-
-#if PGSZ == 32
-#if (BITMAP_BIT_ORDER == MSBFirst)
-#define SinglePixel0 3
-#define SinglePixel1 2
-#define SinglePixel2 1
-#define SinglePixel3 0
-#define SinglePixel4 7
-#define SinglePixel5 6
-#define SinglePixel6 5
-#define SinglePixel7 4
-#define SinglePixel8 0xB
-#define SinglePixel9 0xA
-#define DoublePixel0 1
-#define DoublePixel1 0
-#define DoublePixel2 3
-#define DoublePixel3 2
-#define DoublePixel4 5
-#define DoublePixel5 4
-#else
-#define SinglePixel0 0
-#define SinglePixel1 1
-#define SinglePixel2 2
-#define SinglePixel3 3
-#define SinglePixel4 4
-#define SinglePixel5 5
-#define SinglePixel6 6
-#define SinglePixel7 7
-#define SinglePixel8 8
-#define SinglePixel9 9
-#define DoublePixel0 0
-#define DoublePixel1 1
-#define DoublePixel2 2
-#define DoublePixel3 3
-#define DoublePixel4 4
-#define DoublePixel5 5
-#endif
-#define QuadPixel0 0
-#define QuadPixel1 1
-#define QuadPixel2 2
-#else /* PGSZ == 64 */
-#if (BITMAP_BIT_ORDER == MSBFirst)
-#define SinglePixel0 7
-#define SinglePixel1 6
-#define SinglePixel2 5
-#define SinglePixel3 4
-#define SinglePixel4 3
-#define SinglePixel5 2
-#define SinglePixel6 1
-#define SinglePixel7 0
-#define DoublePixel0 3
-#define DoublePixel1 2
-#define DoublePixel2 1
-#define DoublePixel3 0
-#define QuadPixel0 1
-#define QuadPixel1 0
-#else
-#define SinglePixel0 0
-#define SinglePixel1 1
-#define SinglePixel2 2
-#define SinglePixel3 3
-#define SinglePixel4 4
-#define SinglePixel5 5
-#define SinglePixel6 6
-#define SinglePixel7 7
-#define DoublePixel0 0
-#define DoublePixel1 1
-#define DoublePixel2 2
-#define DoublePixel3 3
-#define QuadPixel0 0
-#define QuadPixel1 1
-#endif
-#define OctaPixel0 0
-#endif /* PGSZ == 64 */
-
-#if PSZ == 8
-
-#if PGSZ == 32
-#define WriteBitGroup(dst,pixel,bits) \
- switch (bits) { \
- case 0: \
- break; \
- case 1: \
- ((CARD8 *) (dst))[SinglePixel0] = (pixel); \
- break; \
- case 2: \
- ((CARD8 *) (dst))[SinglePixel1] = (pixel); \
- break; \
- case 3: \
- ((CARD16 *) (dst))[DoublePixel0] = (pixel); \
- break; \
- case 4: \
- ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
- break; \
- case 5: \
- ((CARD8 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
- break; \
- case 6: \
- ((CARD8 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
- break; \
- case 7: \
- ((CARD16 *) (dst))[DoublePixel0] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
- break; \
- case 8: \
- ((CARD8 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 9: \
- ((CARD8 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 10: \
- ((CARD8 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 11: \
- ((CARD16 *) (dst))[DoublePixel0] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 12: \
- ((CARD16 *) (dst))[DoublePixel1] = (pixel); \
- break; \
- case 13: \
- ((CARD8 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD16 *) (dst))[DoublePixel1] = (pixel); \
- break; \
- case 14: \
- ((CARD8 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD16 *) (dst))[DoublePixel1] = (pixel); \
- break; \
- case 15: \
- ((CARD32 *) (dst))[0] = (pixel); \
- break; \
- }
-#else /* PGSZ == 64 */
-#define WriteBitGroup(dst,pixel,bits) \
- if ( bits == 0xff ) \
- ((PixelGroup *) (dst))[OctaPixel0] = (pixel); \
- else { \
- switch (bits & 0x0f) { \
- case 0: \
- break; \
- case 1: \
- ((CARD8 *) (dst))[SinglePixel0] = (pixel); \
- break; \
- case 2: \
- ((CARD8 *) (dst))[SinglePixel1] = (pixel); \
- break; \
- case 3: \
- ((CARD16 *) (dst))[DoublePixel0] = (pixel); \
- break; \
- case 4: \
- ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
- break; \
- case 5: \
- ((CARD8 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
- break; \
- case 6: \
- ((CARD8 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
- break; \
- case 7: \
- ((CARD16 *) (dst))[DoublePixel0] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
- break; \
- case 8: \
- ((CARD8 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 9: \
- ((CARD8 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 10: \
- ((CARD8 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 11: \
- ((CARD16 *) (dst))[DoublePixel0] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 12: \
- ((CARD16 *) (dst))[DoublePixel1] = (pixel); \
- break; \
- case 13: \
- ((CARD8 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD16 *) (dst))[DoublePixel1] = (pixel); \
- break; \
- case 14: \
- ((CARD8 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD16 *) (dst))[DoublePixel1] = (pixel); \
- break; \
- case 15: \
- ((CARD32 *) (dst))[QuadPixel0] = (pixel); \
- break; \
- } \
- switch ((bits & 0xf0) >> 4) { \
- case 0: \
- break; \
- case 1: \
- ((CARD8 *) (dst))[SinglePixel4] = (pixel); \
- break; \
- case 2: \
- ((CARD8 *) (dst))[SinglePixel5] = (pixel); \
- break; \
- case 3: \
- ((CARD16 *) (dst))[DoublePixel2] = (pixel); \
- break; \
- case 4: \
- ((CARD8 *) (dst))[SinglePixel6] = (pixel); \
- break; \
- case 5: \
- ((CARD8 *) (dst))[SinglePixel4] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel6] = (pixel); \
- break; \
- case 6: \
- ((CARD8 *) (dst))[SinglePixel5] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel6] = (pixel); \
- break; \
- case 7: \
- ((CARD16 *) (dst))[DoublePixel2] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel6] = (pixel); \
- break; \
- case 8: \
- ((CARD8 *) (dst))[SinglePixel7] = (pixel); \
- break; \
- case 9: \
- ((CARD8 *) (dst))[SinglePixel4] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel7] = (pixel); \
- break; \
- case 10: \
- ((CARD8 *) (dst))[SinglePixel5] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel7] = (pixel); \
- break; \
- case 11: \
- ((CARD16 *) (dst))[DoublePixel2] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel7] = (pixel); \
- break; \
- case 12: \
- ((CARD16 *) (dst))[DoublePixel3] = (pixel); \
- break; \
- case 13: \
- ((CARD8 *) (dst))[SinglePixel4] = (pixel); \
- ((CARD16 *) (dst))[DoublePixel3] = (pixel); \
- break; \
- case 14: \
- ((CARD8 *) (dst))[SinglePixel5] = (pixel); \
- ((CARD16 *) (dst))[DoublePixel3] = (pixel); \
- break; \
- case 15: \
- ((CARD32 *) (dst))[QuadPixel1] = (pixel); \
- break; \
- } \
- }
-#endif /* PGSZ == 64 */
-
-#if PGSZ == 32
-#define SwitchBitGroup(dst,pixel,bits) { \
- switch (bits) { \
- case 0: \
- break; \
- case 1: \
- SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel);) \
- break; \
- case 2: \
- SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel);) \
- break; \
- case 3: \
- SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel);) \
- break; \
- case 4: \
- SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel2] = (pixel);) \
- break; \
- case 5: \
- SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \
- break; \
- case 6: \
- SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \
- break; \
- case 7: \
- SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \
- break; \
- case 8: \
- SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel);) \
- break; \
- case 9: \
- SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel3] = (pixel);) \
- break; \
- case 10: \
- SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel3] = (pixel);) \
- break; \
- case 11: \
- SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel3] = (pixel);) \
- break; \
- case 12: \
- SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel1] = (pixel);) \
- break; \
- case 13: \
- SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD16 *) (dst))[DoublePixel1] = (pixel);) \
- break; \
- case 14: \
- SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD16 *) (dst))[DoublePixel1] = (pixel);) \
- break; \
- case 15: \
- SwitchBitsLoop (((CARD32 *) (dst))[0] = (pixel);) \
- break; \
- } \
-}
-#else /* PGSZ == 64 */
-#define SwitchBitGroup(dst,pixel,bits) { \
- if ( bits == 0xff ) \
- SwitchBitsLoop (((PixelGroup *) (dst))[OctaPixel0] = (pixel);) \
- else { \
- switch (bits & 0x0f) { \
- case 0: \
- break; \
- case 1: \
- SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel);) \
- break; \
- case 2: \
- SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel);) \
- break; \
- case 3: \
- SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel);)\
- break; \
- case 4: \
- SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel2] = (pixel);) \
- break; \
- case 5: \
- SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \
- break; \
- case 6: \
- SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \
- break; \
- case 7: \
- SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \
- break; \
- case 8: \
- SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel);) \
- break; \
- case 9: \
- SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel3] = (pixel);) \
- break; \
- case 10: \
- SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel3] = (pixel);) \
- break; \
- case 11: \
- SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel3] = (pixel);) \
- break; \
- case 12: \
- SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel1] = (pixel);)\
- break; \
- case 13: \
- SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD16 *) (dst))[DoublePixel1] = (pixel);)\
- break; \
- case 14: \
- SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD16 *) (dst))[DoublePixel1] = (pixel);)\
- break; \
- case 15: \
- SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel0] = (pixel);) \
- break; \
- } \
- switch ((bits & 0xf0) >> 4) { \
- case 0: \
- break; \
- case 1: \
- SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel4] = (pixel);) \
- break; \
- case 2: \
- SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel5] = (pixel);) \
- break; \
- case 3: \
- SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel2] = (pixel);)\
- break; \
- case 4: \
- SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel6] = (pixel);) \
- break; \
- case 5: \
- SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel4] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel6] = (pixel);) \
- break; \
- case 6: \
- SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel5] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel6] = (pixel);) \
- break; \
- case 7: \
- SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel2] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel6] = (pixel);) \
- break; \
- case 8: \
- SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel7] = (pixel);) \
- break; \
- case 9: \
- SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel4] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel7] = (pixel);) \
- break; \
- case 10: \
- SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel5] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel7] = (pixel);) \
- break; \
- case 11: \
- SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel2] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel7] = (pixel);) \
- break; \
- case 12: \
- SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel3] = (pixel);)\
- break; \
- case 13: \
- SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel4] = (pixel); \
- ((CARD16 *) (dst))[DoublePixel3] = (pixel);)\
- break; \
- case 14: \
- SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel5] = (pixel); \
- ((CARD16 *) (dst))[DoublePixel3] = (pixel);)\
- break; \
- case 15: \
- SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel1] = (pixel);) \
- break; \
- } \
- } \
-}
-#endif /* PGSZ == 64 */
-#endif /* PSZ == 8 */
-
-#if PSZ == 16
-
-#if PGSZ == 32
-#define WriteBitGroup(dst,pixel,bits) \
- switch (bits) { \
- case 0: \
- break; \
- case 1: \
- ((CARD16 *) (dst))[SinglePixel0] = (pixel); \
- break; \
- case 2: \
- ((CARD16 *) (dst))[SinglePixel1] = (pixel); \
- break; \
- case 3: \
- ((CARD32 *) (dst))[DoublePixel0] = (pixel); \
- break; \
- case 4: \
- ((CARD16 *) (dst))[SinglePixel2] = (pixel); \
- break; \
- case 5: \
- ((CARD16 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD16 *) (dst))[SinglePixel2] = (pixel); \
- break; \
- case 6: \
- ((CARD16 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD16 *) (dst))[SinglePixel2] = (pixel); \
- break; \
- case 7: \
- ((CARD32 *) (dst))[DoublePixel0] = (pixel); \
- ((CARD16 *) (dst))[SinglePixel2] = (pixel); \
- break; \
- case 8: \
- ((CARD16 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 9: \
- ((CARD16 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD16 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 10: \
- ((CARD16 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD16 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 11: \
- ((CARD32 *) (dst))[DoublePixel0] = (pixel); \
- ((CARD16 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 12: \
- ((CARD32 *) (dst))[DoublePixel1] = (pixel); \
- break; \
- case 13: \
- ((CARD16 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD32 *) (dst))[DoublePixel1] = (pixel); \
- break; \
- case 14: \
- ((CARD16 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD32 *) (dst))[DoublePixel1] = (pixel); \
- break; \
- case 15: \
- ((CARD32 *) (dst))[DoublePixel0] = (pixel); \
- ((CARD32 *) (dst))[DoublePixel1] = (pixel); \
- break; \
- }
-#else /* PGSZ == 64 */
-#define WriteBitGroup(dst,pixel,bits) \
- if ( bits == 0xff ) { \
- ((PixelGroup *) (dst))[QuadPixel0] = (pixel); \
- ((PixelGroup *) (dst))[QuadPixel1] = (pixel); \
- } \
- else { \
- switch (bits & 0x0f) { \
- case 0: \
- break; \
- case 1: \
- ((CARD16 *) (dst))[SinglePixel0] = (pixel); \
- break; \
- case 2: \
- ((CARD16 *) (dst))[SinglePixel1] = (pixel); \
- break; \
- case 3: \
- ((CARD32 *) (dst))[DoublePixel0] = (pixel); \
- break; \
- case 4: \
- ((CARD16 *) (dst))[SinglePixel2] = (pixel); \
- break; \
- case 5: \
- ((CARD16 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD16 *) (dst))[SinglePixel2] = (pixel); \
- break; \
- case 6: \
- ((CARD16 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD16 *) (dst))[SinglePixel2] = (pixel); \
- break; \
- case 7: \
- ((CARD32 *) (dst))[DoublePixel0] = (pixel); \
- ((CARD16 *) (dst))[SinglePixel2] = (pixel); \
- break; \
- case 8: \
- ((CARD16 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 9: \
- ((CARD16 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD16 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 10: \
- ((CARD16 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD16 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 11: \
- ((CARD32 *) (dst))[DoublePixel0] = (pixel); \
- ((CARD16 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 12: \
- ((CARD32 *) (dst))[DoublePixel1] = (pixel); \
- break; \
- case 13: \
- ((CARD16 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD32 *) (dst))[DoublePixel1] = (pixel); \
- break; \
- case 14: \
- ((CARD16 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD32 *) (dst))[DoublePixel1] = (pixel); \
- break; \
- case 15: \
- ((CARD32 *) (dst))[DoublePixel0] = (pixel); \
- ((CARD32 *) (dst))[DoublePixel1] = (pixel); \
- break; \
- } \
- switch ((bits & 0xf0) >> 4) { \
- case 0: \
- break; \
- case 1: \
- ((CARD16 *) (dst))[SinglePixel4] = (pixel); \
- break; \
- case 2: \
- ((CARD16 *) (dst))[SinglePixel5] = (pixel); \
- break; \
- case 3: \
- ((CARD32 *) (dst))[DoublePixel2] = (pixel); \
- break; \
- case 4: \
- ((CARD16 *) (dst))[SinglePixel6] = (pixel); \
- break; \
- case 5: \
- ((CARD16 *) (dst))[SinglePixel4] = (pixel); \
- ((CARD16 *) (dst))[SinglePixel6] = (pixel); \
- break; \
- case 6: \
- ((CARD16 *) (dst))[SinglePixel5] = (pixel); \
- ((CARD16 *) (dst))[SinglePixel6] = (pixel); \
- break; \
- case 7: \
- ((CARD32 *) (dst))[DoublePixel2] = (pixel); \
- ((CARD16 *) (dst))[SinglePixel6] = (pixel); \
- break; \
- case 8: \
- ((CARD16 *) (dst))[SinglePixel7] = (pixel); \
- break; \
- case 9: \
- ((CARD16 *) (dst))[SinglePixel4] = (pixel); \
- ((CARD16 *) (dst))[SinglePixel7] = (pixel); \
- break; \
- case 10: \
- ((CARD16 *) (dst))[SinglePixel5] = (pixel); \
- ((CARD16 *) (dst))[SinglePixel7] = (pixel); \
- break; \
- case 11: \
- ((CARD32 *) (dst))[DoublePixel2] = (pixel); \
- ((CARD16 *) (dst))[SinglePixel7] = (pixel); \
- break; \
- case 12: \
- ((CARD32 *) (dst))[DoublePixel3] = (pixel); \
- break; \
- case 13: \
- ((CARD16 *) (dst))[SinglePixel4] = (pixel); \
- ((CARD32 *) (dst))[DoublePixel3] = (pixel); \
- break; \
- case 14: \
- ((CARD16 *) (dst))[SinglePixel5] = (pixel); \
- ((CARD32 *) (dst))[DoublePixel3] = (pixel); \
- break; \
- case 15: \
- ((CARD32 *) (dst))[DoublePixel2] = (pixel); \
- ((CARD32 *) (dst))[DoublePixel3] = (pixel); \
- break; \
- } \
- }
-#endif /* PGSZ */
-
-#if PGSZ == 32
-#define SwitchBitGroup(dst,pixel,bits) { \
- switch (bits) { \
- case 0: \
- break; \
- case 1: \
- SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel0] = (pixel);) \
- break; \
- case 2: \
- SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel1] = (pixel);) \
- break; \
- case 3: \
- SwitchBitsLoop (((CARD32 *) (dst))[DoublePixel0] = (pixel);) \
- break; \
- case 4: \
- SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel2] = (pixel);) \
- break; \
- case 5: \
- SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD16 *) (dst))[SinglePixel2] = (pixel);) \
- break; \
- case 6: \
- SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD16 *) (dst))[SinglePixel2] = (pixel);) \
- break; \
- case 7: \
- SwitchBitsLoop (((CARD32 *) (dst))[DoublePixel0] = (pixel); \
- ((CARD16 *) (dst))[SinglePixel2] = (pixel);) \
- break; \
- case 8: \
- SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel3] = (pixel);) \
- break; \
- case 9: \
- SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD16 *) (dst))[SinglePixel3] = (pixel);) \
- break; \
- case 10: \
- SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD16 *) (dst))[SinglePixel3] = (pixel);) \
- break; \
- case 11: \
- SwitchBitsLoop (((CARD32 *) (dst))[DoublePixel0] = (pixel); \
- ((CARD16 *) (dst))[SinglePixel3] = (pixel);) \
- break; \
- case 12: \
- SwitchBitsLoop (((CARD32 *) (dst))[DoublePixel1] = (pixel);) \
- break; \
- case 13: \
- SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD32 *) (dst))[DoublePixel1] = (pixel);) \
- break; \
- case 14: \
- SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD32 *) (dst))[DoublePixel1] = (pixel);) \
- break; \
- case 15: \
- SwitchBitsLoop (((CARD32 *) (dst))[DoublePixel0] = (pixel); \
- ((CARD32 *) (dst))[DoublePixel1] = (pixel);) \
- break; \
- } \
-}
-#else /* PGSZ == 64 */
-#define SwitchBitGroup(dst,pixel,bits) { \
- cfb cannot hack 64-bit SwitchBitGroup psz=PSZ
-#endif /* PGSZ */
-
-#endif /* PSZ == 16 */
-
-#if PSZ == 24
-/* 32 000011112222*/
-/* 24 000111222333*/
-/* 16 001122334455*/
-/* 8 0123456789AB*/
-#if PGSZ == 32
-#define WriteBitGroup(dst,pixel,bits) \
- { \
- register CARD32 reg_pixel = (pixel); \
- switch (bits) { \
- case 0: \
- break; \
- case 1: \
- ((CARD16 *) (dst))[DoublePixel0] = reg_pixel; \
- ((CARD8 *) (dst))[SinglePixel2] = ((reg_pixel>>16)&0xFF); \
- break; \
- case 2: \
- ((CARD8 *) (dst))[SinglePixel3] = reg_pixel&0xFF; \
- ((CARD16 *) (dst))[DoublePixel2] = (reg_pixel>>8)&0xFFFF; \
- break; \
- case 3: \
- ((CARD8 *) (dst))[SinglePixel3] = reg_pixel & 0xFF; \
- ((CARD16 *) (dst))[DoublePixel0] = reg_pixel; \
- ((CARD16 *) (dst))[DoublePixel2] = (reg_pixel>>8)&0xFFFF; \
- ((CARD8 *) (dst))[SinglePixel2] = (reg_pixel>>16&0xFF); \
- break; \
- case 4: \
- ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \
- ((CARD8 *) (dst))[SinglePixel8] = (reg_pixel>>16)&0xFF; \
- break; \
- case 5: \
- ((CARD16 *) (dst))[DoublePixel0] = \
- ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \
- reg_pixel >>= 16; \
- ((CARD8 *) (dst))[SinglePixel2] = \
- ((CARD8 *) (dst))[SinglePixel8] = reg_pixel&0xFF; \
- break; \
- case 6: \
- ((CARD8 *) (dst))[SinglePixel3] = reg_pixel; \
- ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \
- reg_pixel >>= 8; \
- ((CARD16 *) (dst))[DoublePixel2] = reg_pixel; \
- reg_pixel >>= 8; \
- ((CARD8 *) (dst))[SinglePixel8] = reg_pixel&0xFF; \
- break; \
- case 7: \
- ((CARD16 *) (dst))[DoublePixel0] = \
- ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \
- ((CARD8 *) (dst))[SinglePixel3] = reg_pixel&0xFF; \
- reg_pixel >>= 8; \
- ((CARD16 *) (dst))[DoublePixel2] = reg_pixel; \
- reg_pixel >>= 8; \
- ((CARD8 *) (dst))[SinglePixel2] = \
- ((CARD8 *) (dst))[SinglePixel8] = reg_pixel&0xFF; \
- break; \
- case 8: \
- ((CARD8 *) (dst))[SinglePixel9] = reg_pixel&0xFF; \
- ((CARD16 *) (dst))[DoublePixel5] = (reg_pixel>>8); \
- break; \
- case 9: \
- ((CARD16 *) (dst))[DoublePixel0] = reg_pixel; \
- ((CARD8 *) (dst))[SinglePixel9] = reg_pixel&0xFF; \
- reg_pixel >>= 8; \
- ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \
- reg_pixel >>= 8; \
- ((CARD8 *) (dst))[SinglePixel2] = reg_pixel&0xFF; \
- break; \
- case 10: \
- ((CARD8 *) (dst))[SinglePixel3] = \
- ((CARD8 *) (dst))[SinglePixel9] = reg_pixel&0xFF; \
- reg_pixel >>= 8; \
- ((CARD16 *) (dst))[DoublePixel2] = \
- ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \
- break; \
- case 11: \
- ((CARD8 *) (dst))[SinglePixel3] = \
- ((CARD8 *) (dst))[SinglePixel9] = reg_pixel; \
- ((CARD16 *) (dst))[DoublePixel0] = reg_pixel; \
- reg_pixel >>= 8; \
- ((CARD16 *) (dst))[DoublePixel2] = \
- ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \
- reg_pixel >>= 8; \
- ((CARD8 *) (dst))[SinglePixel2] = reg_pixel; \
- break; \
- case 12: \
- ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \
- ((CARD8 *) (dst))[SinglePixel9] = reg_pixel; \
- reg_pixel >>= 8; \
- ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \
- reg_pixel >>= 8; \
- ((CARD8 *) (dst))[SinglePixel8] = reg_pixel; \
- break; \
- case 13: \
- ((CARD16 *) (dst))[DoublePixel0] = \
- ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \
- ((CARD8 *) (dst))[SinglePixel9] = reg_pixel; \
- reg_pixel >>= 8; \
- ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \
- reg_pixel >>= 8; \
- ((CARD8 *) (dst))[SinglePixel2] = \
- ((CARD8 *) (dst))[SinglePixel8] = reg_pixel; \
- break; \
- case 14: \
- ((CARD8 *) (dst))[SinglePixel3] = \
- ((CARD8 *) (dst))[SinglePixel9] = reg_pixel; \
- ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \
- reg_pixel >>= 8; \
- ((CARD16 *) (dst))[DoublePixel2] = \
- ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \
- reg_pixel >>= 8; \
- ((CARD8 *) (dst))[SinglePixel8] = reg_pixel; \
- break; \
- case 15: \
- ((CARD16 *) (dst))[DoublePixel0] = \
- ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \
- ((CARD8 *) (dst))[SinglePixel3] = \
- ((CARD8 *) (dst))[SinglePixel9] = reg_pixel; \
- reg_pixel >>= 8; \
- ((CARD16 *) (dst))[DoublePixel2] = \
- ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \
- reg_pixel >>= 8; \
- ((CARD8 *) (dst))[SinglePixel8] = \
- ((CARD8 *) (dst))[SinglePixel2] = reg_pixel; \
- break; \
- } \
- }
-#else /* PGSZ == 64 */
-#define WriteBitGroup(dst,pixel,bits) \
- if ( bits == 0xff ) { \
- ((PixelGroup *) (dst))[DoublePixel0] = (pixel); \
- ((PixelGroup *) (dst))[DoublePixel1] = (pixel); \
- ((PixelGroup *) (dst))[DoublePixel2] = (pixel); \
- ((PixelGroup *) (dst))[DoublePixel3] = (pixel); \
- } \
- else { \
- switch (bits & 0x0f) { \
- case 0: \
- break; \
- case 1: \
- ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
- break; \
- case 2: \
- ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
- break; \
- case 3: \
- ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
- break; \
- case 4: \
- ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
- break; \
- case 5: \
- ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
- break; \
- case 6: \
- ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
- break; \
- case 7: \
- ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
- break; \
- case 8: \
- ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 9: \
- ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 10: \
- ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 11: \
- ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 12: \
- ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 13: \
- ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 14: \
- ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 15: \
- ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- } \
- switch ((bits & 0xf0) >> 4) { \
- case 0: \
- break; \
- case 1: \
- ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
- break; \
- case 2: \
- ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
- break; \
- case 3: \
- ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
- break; \
- case 4: \
- ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
- break; \
- case 5: \
- ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
- break; \
- case 6: \
- ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
- break; \
- case 7: \
- ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
- break; \
- case 8: \
- ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
- break; \
- case 9: \
- ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
- break; \
- case 10: \
- ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
- break; \
- case 11: \
- ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
- break; \
- case 12: \
- ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
- break; \
- case 13: \
- ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
- break; \
- case 14: \
- ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
- break; \
- case 15: \
- ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
- break; \
- } \
- }
-#endif /* PGSZ */
-
-#if PGSZ == 32
-#define SwitchBitGroup(dst,pixel,bits) { \
- switch (bits) { \
- case 0: \
- break; \
- case 1: \
- SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \
- break; \
- case 2: \
- SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel); \
- ((CARD16 *) (dst))[DoublePixel2] = (pixel);) \
- break; \
- case 3: \
- SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel0] = (pixel); \
- ((CARD16 *) (dst))[DoublePixel2] = (pixel);) \
- break; \
- case 4: \
- SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel3] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel8] = (pixel);) \
- break; \
- case 5: \
- SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
- ((CARD16 *) (dst))[DoublePixel3] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel8] = (pixel);) \
- break; \
- case 6: \
- SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel); \
- ((CARD32 *) (dst))[QuadPixel2] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel8] = (pixel);) \
- break; \
- case 7: \
- SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel0] = (pixel); \
- ((CARD32 *) (dst))[QuadPixel1] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel8] = (pixel);) \
- break; \
- case 8: \
- SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel9] = (pixel); \
- ((CARD16 *) (dst))[DoublePixel5] = (pixel);) \
- break; \
- case 9: \
- SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel9] = (pixel); \
- ((CARD16 *) (dst))[DoublePixel5] = (pixel);) \
- break; \
- case 10: \
- SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel); \
- ((CARD16 *) (dst))[DoublePixel2] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel9] = (pixel); \
- ((CARD16 *) (dst))[DoublePixel5] = (pixel);) \
- break; \
- case 11: \
- SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel0] = (pixel); \
- ((CARD16 *) (dst))[DoublePixel3] = (pixel);) \
- ((CARD8 *) (dst))[SinglePixel9] = (pixel); \
- ((CARD16 *) (dst))[DoublePixel5] = (pixel);) \
- break; \
- case 12: \
- SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel3] = (pixel); \
- ((CARD32 *) (dst))[QuadPixel2] = (pixel);) \
- break; \
- case 13: \
- SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD8 *) (dst))[SinglePixel2] = (pixel); \
- ((CARD16 *) (dst))[DoublePixel3] = (pixel); \
- ((CARD32 *) (dst))[QuadPixel2] = (pixel);) \
- break; \
- case 14: \
- SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel); \
- ((CARD32 *) (dst))[QuadPixel1] = (pixel); \
- ((CARD32 *) (dst))[QuadPixel2] = (pixel);) \
- break; \
- case 15: \
- SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel0] = (pixel); \
- ((CARD32 *) (dst))[QuadPixel1] = (pixel); \
- ((CARD32 *) (dst))[QuadPixel2] = (pixel);) \
- break; \
- } \
-}
-#else /* PGSZ == 64 */
-#define SwitchBitGroup(dst,pixel,bits) { \
- cfb cannot hack 64-bit SwitchBitGroup psz=PSZ
-#endif /* PGSZ */
-
-#endif /* PSZ == 24 */
-
-#if PSZ == 32
-
-#if PGSZ == 32
-#define WriteBitGroup(dst,pixel,bits) \
- switch (bits) { \
- case 0: \
- break; \
- case 1: \
- ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
- break; \
- case 2: \
- ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
- break; \
- case 3: \
- ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
- break; \
- case 4: \
- ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
- break; \
- case 5: \
- ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
- break; \
- case 6: \
- ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
- break; \
- case 7: \
- ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
- break; \
- case 8: \
- ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 9: \
- ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 10: \
- ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 11: \
- ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 12: \
- ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 13: \
- ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 14: \
- ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 15: \
- ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- }
-#else /* PGSZ == 64 */
-#define WriteBitGroup(dst,pixel,bits) \
- if ( bits == 0xff ) { \
- ((PixelGroup *) (dst))[DoublePixel0] = (pixel); \
- ((PixelGroup *) (dst))[DoublePixel1] = (pixel); \
- ((PixelGroup *) (dst))[DoublePixel2] = (pixel); \
- ((PixelGroup *) (dst))[DoublePixel3] = (pixel); \
- } \
- else { \
- switch (bits & 0x0f) { \
- case 0: \
- break; \
- case 1: \
- ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
- break; \
- case 2: \
- ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
- break; \
- case 3: \
- ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
- break; \
- case 4: \
- ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
- break; \
- case 5: \
- ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
- break; \
- case 6: \
- ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
- break; \
- case 7: \
- ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
- break; \
- case 8: \
- ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 9: \
- ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 10: \
- ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 11: \
- ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 12: \
- ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 13: \
- ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 14: \
- ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- case 15: \
- ((CARD32 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel3] = (pixel); \
- break; \
- } \
- switch ((bits & 0xf0) >> 4) { \
- case 0: \
- break; \
- case 1: \
- ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
- break; \
- case 2: \
- ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
- break; \
- case 3: \
- ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
- break; \
- case 4: \
- ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
- break; \
- case 5: \
- ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
- break; \
- case 6: \
- ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
- break; \
- case 7: \
- ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
- break; \
- case 8: \
- ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
- break; \
- case 9: \
- ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
- break; \
- case 10: \
- ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
- break; \
- case 11: \
- ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
- break; \
- case 12: \
- ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
- break; \
- case 13: \
- ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
- break; \
- case 14: \
- ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
- break; \
- case 15: \
- ((CARD32 *) (dst))[SinglePixel4] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel5] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel6] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel7] = (pixel); \
- break; \
- } \
- }
-#endif /* PGSZ */
-
-#if PGSZ == 32
-#define SwitchBitGroup(dst,pixel,bits) { \
- switch (bits) { \
- case 0: \
- break; \
- case 1: \
- SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel);) \
- break; \
- case 2: \
- SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel1] = (pixel);) \
- break; \
- case 3: \
- SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel1] = (pixel);) \
- break; \
- case 4: \
- SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel2] = (pixel);) \
- break; \
- case 5: \
- SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel2] = (pixel);) \
- break; \
- case 6: \
- SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel2] = (pixel);) \
- break; \
- case 7: \
- SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel2] = (pixel);) \
- break; \
- case 8: \
- SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel3] = (pixel);) \
- break; \
- case 9: \
- SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel3] = (pixel);) \
- break; \
- case 10: \
- SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel3] = (pixel);) \
- break; \
- case 11: \
- SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel3] = (pixel);) \
- break; \
- case 12: \
- SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel2] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel3] = (pixel);) \
- break; \
- case 13: \
- SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel3] = (pixel);) \
- break; \
- case 14: \
- SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel3] = (pixel);) \
- break; \
- case 15: \
- SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel1] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel2] = (pixel); \
- ((CARD32 *) (dst))[SinglePixel3] = (pixel);) \
- break; \
- } \
-}
-#else /* PGSZ == 64 */
-#define SwitchBitGroup(dst,pixel,bits) { \
- cfb cannot hack 64-bit SwitchBitGroup psz=PSZ
-#endif /* PGSZ */
-
-#endif /* PSZ == 32 */
-#endif /* AVOID_MEMORY_READ */
-
-extern PixelGroup cfb8BitLenMasks[PGSZ];
-
-extern int cfb8SetStipple (
- int /*alu*/,
- CfbBits /*fg*/,
- CfbBits /*planemask*/
-);
-
-extern int cfb8SetOpaqueStipple (
- int /*alu*/,
- CfbBits /*fg*/,
- CfbBits /*bg*/,
- CfbBits /*planemask*/
-);
-
-extern int cfb8ComputeClipMasks32 (
- BoxPtr /*pBox*/,
- int /*numRects*/,
- int /*x*/,
- int /*y*/,
- int /*w*/,
- int /*h*/,
- CARD32 * /*clips*/
-);
diff --git a/cfb/cfb8line.c b/cfb/cfb8line.c
deleted file mode 100644
index 8c00d9fea..000000000
--- a/cfb/cfb8line.c
+++ /dev/null
@@ -1,1503 +0,0 @@
-/*
- *
-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
- *
- * Jeff Anton'x fixes: cfb8line.c 97/02/07
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stdlib.h>
-#include <X11/X.h>
-
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "regionstr.h"
-#include "scrnintstr.h"
-#include "mistruct.h"
-
-#include "cfb.h"
-#include "cfbmskbits.h"
-#include "cfbrrop.h"
-#include "miline.h"
-
-#ifdef PIXEL_ADDR
-
-#if defined(__GNUC__) && defined(mc68020)
-#define STUPID volatile
-#define REARRANGE
-#else
-#define STUPID
-#endif
-
-#ifdef __GNUC__
-/* lame compiler doesn't even look at 'register' attributes */
-#define I_H do{
-#define I_T }while(0);
-#define IMPORTANT_START I_H I_H I_H I_H I_H I_H I_H I_H I_H I_H
-#define IMPORTANT_END I_T I_T I_T I_T I_T I_T I_T I_T I_T I_T
-#else
-#define IMPORTANT_START
-#define IMPORTANT_END
-#endif
-
-#define isClipped(c,ul,lr) ((((c) - (ul)) | ((lr) - (c))) & ClipMask)
-
-#ifdef POLYSEGMENT
-
-# if (defined(sun) || defined(__bsdi__)) && \
- (defined(sparc) || defined(__sparc__))
-# define WIDTH_FAST 1152
-# endif
-
-# ifdef ultrix
-# define WIDTH_FAST 1024
-# endif
-
-# ifdef Mips
-# define WIDTH_FAST 4096
-# endif
-# ifdef WIDTH_FAST
-# if WIDTH_FAST == 1024
-# define FAST_MUL(y) ((y) << 10)
-# endif
-
-# if WIDTH_FAST == 1152
-# define FAST_MUL(y) (((y) << 10) + ((y) << 7))
-# endif
-
-# if WIDTH_FAST == 1280
-# define FAST_MUL(y) (((y) << 10) + ((y) << 8))
-# endif
-
-# if WIDTH_FAST == 2048
-# define FAST_MUL(y) ((y) << 11)
-# endif
-
-# if WIDTH_FAST == 4096
-# define FAST_MUL(y) ((y) << 12)
-# endif
-# endif
-
-# if defined(WIDTH_SHIFT)
-# ifdef FAST_MUL
-# define FUNC_NAME(e) RROP_NAME(RROP_NAME_CAT(e,Shift))
-# if RROP == GXcopy
-# define INCLUDE_OTHERS
-# define SERIOUS_UNROLLING
-# endif
-# define INCLUDE_DRAW
-# define NWIDTH(nwidth) WIDTH_FAST
-# define WIDTH_MUL(y,w) FAST_MUL(y)
-# endif
-# else
-# define FUNC_NAME(e) RROP_NAME(e)
-# define WIDTH_MUL(y,w) ((y) * (w))
-# define NWIDTH(nwidth) (nwidth)
-# define INCLUDE_DRAW
-# if !defined (FAST_MUL) && RROP == GXcopy
-# define INCLUDE_OTHERS
-# define SERIOUS_UNROLLING
-# endif
-# endif
-#else
-
-# define INCLUDE_DRAW
-# define WIDTH_MUL(y,w) ((y) * (w))
-# define NWIDTH(nwidth) nwidth
-# ifdef PREVIOUS
-# define FUNC_NAME(e) RROP_NAME(RROP_NAME_CAT(e,Previous))
-# else
-# define FUNC_NAME(e) RROP_NAME(e)
-# if RROP == GXcopy
-# define INCLUDE_OTHERS
-# ifdef PLENTIFUL_REGISTERS
-# define SAVE_X2Y2
-# endif
-# define ORIGIN
-# define SERIOUS_UNROLLING
-# else
-# define EITHER_MODE
-# endif
-# endif
-#endif
-
-#if PSZ == 24
-#define PXL2ADR(x) ((x)*3 >> 2)
-
-#if RROP == GXcopy
-#define body_rop \
- addrp = (PixelType *)((unsigned long)addrb & ~0x03); \
- switch((unsigned long)addrb & 3){ \
- case 0: \
- *addrp = (*addrp & 0xFF000000)|(piQxelXor[0] & 0xFFFFFF); \
- break; \
- case 1: \
- *addrp = (*addrp & 0xFF)|(piQxelXor[2] & 0xFFFFFF00); \
- break; \
- case 3: \
- *addrp = (*addrp & 0xFFFFFF)|(piQxelXor[0] & 0xFF000000); \
- *(addrp+1)=(*(addrp+1) & 0xFFFF0000)|(piQxelXor[1] & 0xFFFF); \
- break; \
- case 2: \
- *addrp = (*addrp & 0xFFFF)|(piQxelXor[1] & 0xFFFF0000); \
- *(addrp+1)=(*(addrp+1) & 0xFFFFFF00)|(piQxelXor[2] & 0xFF); \
- break; \
- }
-#endif
-#if RROP == GXxor
-#define body_rop \
- addrp = (PixelType *)((unsigned long)addrb & ~0x03); \
- switch((unsigned long)addrb & 3){ \
- case 0: \
- *addrp ^= piQxelXor[0] & 0xFFFFFF; \
- break; \
- case 1: \
- *addrp ^= piQxelXor[2] & 0xFFFFFF00; \
- break; \
- case 3: \
- *addrp ^= piQxelXor[0] & 0xFF000000; \
- *(addrp+1) ^= piQxelXor[1] & 0xFFFF; \
- break; \
- case 2: \
- *addrp ^= piQxelXor[1] & 0xFFFF0000; \
- *(addrp+1) ^= piQxelXor[2] & 0xFF; \
- break; \
- }
-#endif
-#if RROP == GXand
-#define body_rop \
- addrp = (PixelType *)((unsigned long)addrb & ~0x03); \
- switch((unsigned long)addrb & 3){ \
- case 0: \
- *addrp &= piQxelAnd[0] | 0xFF000000; \
- break; \
- case 1: \
- *addrp &= piQxelAnd[2] | 0xFF; \
- break; \
- case 3: \
- *addrp &= 0xFFFFFF | piQxelAnd[0]; \
- *(addrp+1) &= 0xFFFF0000 | piQxelAnd[1]; \
- break; \
- case 2: \
- *addrp &= 0xFFFF | piQxelAnd[1]; \
- *(addrp+1) &= 0xFFFFFF00 | piQxelAnd[2]; \
- break; \
- }
-#endif
-#if RROP == GXor
-#define body_rop \
- addrp = (PixelType *)((unsigned long)addrb & ~0x03); \
- switch((unsigned long)addrb & 3){ \
- case 0: \
- *addrp |= piQxelOr[0] & 0xFFFFFF; \
- break; \
- case 1: \
- *addrp |= piQxelOr[2] & 0xFFFFFF00; \
- break; \
- case 3: \
- *addrp |= piQxelOr[0] & 0xFF000000; \
- *(addrp+1) |= piQxelOr[1] & 0xFFFF; \
- break; \
- case 2: \
- *addrp |= piQxelOr[1] & 0xFFFF0000; \
- *(addrp+1) |= piQxelOr[2] & 0xFF; \
- break; \
- }
-#endif
-#if RROP == GXset
-#define body_rop \
- addrp = (PixelType *)((unsigned long)addrb & ~0x03); \
- switch((unsigned long)addrb & 3){ \
- case 0: \
- *addrp = (*addrp & (piQxelAnd[0]|0xFF000000)) \
- ^ (piQxelXor[0] & 0xFFFFFF); \
- break; \
- case 1: \
- *addrp = (*addrp & (piQxelAnd[2]|0xFF)) \
- ^ (piQxelXor[2] & 0xFFFFFF00); \
- break; \
- case 3: \
- *addrp = (*addrp & (piQxelAnd[0]|0xFFFFFF)) \
- ^ (piQxelXor[0] & 0xFF000000); \
- *(addrp+1) = (*(addrp+1) & (piQxelAnd[1]|0xFFFF0000)) \
- ^ (piQxelXor[1] & 0xFFFF); \
- break; \
- case 2: \
- *addrp = (*addrp & (piQxelAnd[1]|0xFFFF)) \
- ^ (piQxelXor[1] & 0xFFFF0000); \
- *(addrp+1) = (*(addrp+1) & (piQxelAnd[2]|0xFFFFFF00)) \
- ^ (piQxelXor[2] & 0xFF); \
- break; \
- }
-#endif
-#endif /* PSZ == 24 */
-
-#define BUGFIX_clip
-
-#ifdef INCLUDE_DRAW
-
-int
-#ifdef POLYSEGMENT
-FUNC_NAME(cfb8SegmentSS1Rect) (pDrawable, pGC, nseg, pSegInit)
- DrawablePtr pDrawable;
- GCPtr pGC;
- int nseg;
- xSegment *pSegInit;
-#else
-FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig,
- x1p,y1p,x2p,y2p)
- DrawablePtr pDrawable;
- GCPtr pGC;
- int mode; /* Origin or Previous */
- int npt; /* number of points */
- DDXPointPtr pptInit, pptInitOrig;
- int *x1p, *y1p, *x2p, *y2p;
-#endif /* POLYSEGMENT */
-{
- register long e;
- register int y1_or_e1;
- register PixelType *addrp;
- register int stepmajor;
- register int stepminor;
-#ifndef REARRANGE
- register long e3;
-#endif
-#ifdef mc68000
- register short x1_or_len;
-#else
- register int x1_or_len;
-#endif
- RROP_DECLARE
-
-#ifdef SAVE_X2Y2
-# define c2 y2
-#else
- register int c2;
-#endif
-#if !defined(ORIGIN) && !defined(POLYSEGMENT)
- register int _x1 = 0, _y1 = 0, _x2 = 0, _y2 = 0;
- int extents_x1, extents_y1, extents_x2, extents_y2;
-#endif /* !ORIGIN */
-#ifndef PREVIOUS
- register int upperleft, lowerright;
- CARD32 ClipMask = 0x80008000;
-#endif /* !PREVIOUS */
-#ifdef POLYSEGMENT
- register int capStyle;
-#endif /* POLYSEGMENT */
-#ifdef SAVE_X2Y2
- register int x2, y2;
-# define X1 x1_or_len
-# define Y1 y1_or_e1
-# define X2 x2
-# define Y2 y2
-#else
-# ifdef POLYSEGMENT
-# define X1 x1_or_len
-# define Y1 y1_or_e1
-# else
-# define X1 intToX(y1_or_e1)
-# define Y1 intToY(y1_or_e1)
-# endif /* POLYSEGMENT */
-# define X2 intToX(c2)
-# define Y2 intToY(c2)
-#endif /* SAVE_X2Y2 */
- PixelType *addr;
- int nwidth;
- cfbPrivGCPtr devPriv;
- BoxPtr extents;
- int *ppt;
-#if PSZ == 24
- int xBase; /* x of addr */
- int xOffset; /* x of addrp */
- PixelType *addrLineEnd;
- char *addrb;
- int stepmajor3, stepminor3, majordx, minordx;
-#endif
-#ifndef POLYSEGMENT
-#ifndef ORIGIN
-#ifdef BUGFIX_clip
- int ex_x1, ex_y1, ex_x2, ex_y2;
-#endif
-#endif
-#endif
- int octant;
- unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
-
- devPriv = cfbGetGCPrivate(pGC);
- cfbGetPixelWidthAndPointer (pDrawable, nwidth, addr);
-#ifndef REARRANGE
- RROP_FETCH_GCPRIV(devPriv);
-#endif
- extents = &pGC->pCompositeClip->extents;
-#ifndef PREVIOUS
- c2 = *((int *) &pDrawable->x);
- c2 -= (c2 & 0x8000) << 1;
- upperleft = *((int *) &extents->x1) - c2;
- lowerright = *((int *) &extents->x2) - c2 - 0x00010001;
-#endif /* !PREVIOUS */
-#ifndef POLYSEGMENT
-#ifndef ORIGIN
-#ifdef BUGFIX_clip
- ex_x1 = extents->x1 - pDrawable->x;
- ex_y1 = extents->y1 - pDrawable->y;
- ex_x2 = extents->x2 - pDrawable->x;
- ex_y2 = extents->y2 - pDrawable->y;
-#endif
-#endif
-#endif
-#if PSZ == 24
- xBase = pDrawable->x;
- addr += WIDTH_MUL(pDrawable->y,nwidth);
-#else
- addr = addr + WIDTH_MUL(pDrawable->y,nwidth) + pDrawable->x;
-#endif
-#ifdef POLYSEGMENT
- capStyle = pGC->capStyle - CapNotLast;
- ppt = (int *) pSegInit;
- while (nseg--)
-#else /* POLYSEGMENT */
-#ifdef EITHER_MODE
- mode -= CoordModePrevious;
- if (!mode)
-#endif /* EITHER_MODE */
-#ifndef ORIGIN
- { /* CoordModePrevious */
- ppt = (int *)pptInit + 1;
- _x1 = *x1p;
- _y1 = *y1p;
- extents_x1 = extents->x1 - pDrawable->x;
- extents_x2 = extents->x2 - pDrawable->x;
- extents_y1 = extents->y1 - pDrawable->y;
- extents_y2 = extents->y2 - pDrawable->y;
- if (_x1 < extents_x1 || _x1 >= extents_x2 ||
- _y1 < extents_y1 || _y1 >= extents_y2)
- {
- c2 = *ppt++;
- intToCoord(c2, _x2, _y2);
- *x2p = _x1 + _x2;
- *y2p = _y1 + _y2;
- return 1;
- }
-#if PSZ == 24
- addrLineEnd = addr + WIDTH_MUL(_y1, nwidth);
- xOffset = xBase + _x1;
- addrb = (char *)addrLineEnd + xOffset * 3;
- addrp = (PixelType *)((unsigned long)addrb & ~0x03);
-#else
- addrp = addr + WIDTH_MUL(_y1, nwidth) + _x1;
-#endif
- _x2 = _x1;
- _y2 = _y1;
- }
-#endif /* !ORIGIN */
-#ifdef EITHER_MODE
- else
-#endif /* EITHER_MODE */
-#ifndef PREVIOUS
- {
- ppt = (int *) pptInit;
- c2 = *ppt++;
- if (isClipped (c2, upperleft, lowerright))
- {
- return 1;
- }
-#ifdef SAVE_X2Y2
- intToCoord(c2,x2,y2);
-#endif
-#if PSZ == 24
- addrLineEnd = addr + WIDTH_MUL(Y2, nwidth);
- xOffset = xBase + X2;
- addrb = (char *)addrLineEnd + xOffset * 3;
- addrp = (PixelType *)((unsigned long)addrb & ~0x03);
-#else
- addrp = addr + WIDTH_MUL(Y2, nwidth) + X2;
-#endif
- }
-#endif /* !PREVIOUS */
- while (--npt)
-#endif /* POLYSEGMENT */
- {
-#ifdef POLYSEGMENT
- y1_or_e1 = ppt[0];
- c2 = ppt[1];
- ppt += 2;
- if (isClipped(y1_or_e1,upperleft,lowerright)|isClipped(c2,upperleft,lowerright))
- break;
- intToCoord(y1_or_e1,x1_or_len,y1_or_e1);
- /* compute now to avoid needing x1, y1 later */
-#if PSZ == 24
- addrLineEnd = addr + WIDTH_MUL(y1_or_e1, nwidth);
- xOffset = xBase + x1_or_len;
- addrb = (char *)addrLineEnd + xOffset * 3;
- addrp = (PixelType *)((unsigned long)addrb & ~0x03);
-#else
- addrp = addr + WIDTH_MUL(y1_or_e1, nwidth) + x1_or_len;
-#endif
-#else /* !POLYSEGMENT */
-#ifdef EITHER_MODE
- if (!mode)
-#endif /* EITHER_MODE */
-#ifndef ORIGIN
- {
- /* CoordModePrevious */
- _x1 = _x2;
- _y1 = _y2;
- c2 = *ppt++;
- intToCoord(c2, _x2, _y2);
- _x2 = _x1 + _x2;
- _y2 = _y1 + _y2;
-
-#ifdef BUGFIX_clip
- if (_x2 < ex_x1 || _x2 >= ex_x2 ||
- _y2 < ex_y1 || _y2 >= ex_y2)
-#else
- if (_x2 < extents_x1 || _x2 >= extents_x2 ||
- _y2 < extents_y1 || _y2 >= extents_y2)
-#endif
- {
- break;
- }
- CalcLineDeltas(_x1, _y1, _x2, _y2, x1_or_len, y1_or_e1,
- stepmajor, stepminor, 1, NWIDTH(nwidth), octant);
- }
-#endif /* !ORIGIN */
-#ifdef EITHER_MODE
- else
-#endif /* EITHER_MODE */
-#ifndef PREVIOUS
- {
-#ifndef SAVE_X2Y2
- y1_or_e1 = c2;
-#else
- y1_or_e1 = y2;
- x1_or_len = x2;
-#endif /* SAVE_X2Y2 */
- c2 = *ppt++;
-
- if (isClipped (c2, upperleft, lowerright))
- break;
-#ifdef SAVE_X2Y2
- intToCoord(c2,x2,y2);
-#endif
- CalcLineDeltas(X1, Y1, X2, Y2, x1_or_len, y1_or_e1,
- stepmajor, stepminor, 1, NWIDTH(nwidth), octant);
- }
-#endif /* !PREVIOUS */
-#endif /* POLYSEGMENT */
-
-#ifdef POLYSEGMENT
- CalcLineDeltas(X1, Y1, X2, Y2, x1_or_len, y1_or_e1,
- stepmajor, stepminor, 1, NWIDTH(nwidth), octant);
- /*
- * although the horizontal code works for polyline, it
- * slows down 10 pixel lines by 15%. Thus, this
- * code is optimized for horizontal segments and
- * random orientation lines, which seems like a reasonable
- * assumption
- */
- if (y1_or_e1 != 0)
- {
-#endif /* POLYSEGMENT */
- if (x1_or_len < y1_or_e1)
- {
-#ifdef REARRANGE
- register int e3;
-#endif
-
- e3 = x1_or_len;
- x1_or_len = y1_or_e1;
- y1_or_e1 = e3;
-
- e3 = stepminor;
- stepminor = stepmajor;
- stepmajor = e3;
- SetYMajorOctant(octant);
- }
-
- e = -x1_or_len;
-#ifdef POLYSEGMENT
- if (!capStyle)
- x1_or_len--;
-#endif
-
- {
-#ifdef REARRANGE
- register int e3;
- RROP_DECLARE
- RROP_FETCH_GCPRIV(devPriv);
-#endif
-
- y1_or_e1 = y1_or_e1 << 1;
- e3 = e << 1;
-
- FIXUP_ERROR(e, octant, bias);
-
-#if PSZ == 24
- if (stepmajor == 1 || stepmajor == -1){
- stepmajor3 = stepmajor * 3;
- stepminor3 = stepminor * sizeof (CfbBits);
- majordx = stepmajor; minordx = 0;
- } else {
- stepmajor3 = stepmajor * sizeof (CfbBits);
- stepminor3 = stepminor * 3;
- majordx = 0; minordx = stepminor;
- }
-#endif
-
-#if PSZ == 24
-#define body {\
- body_rop \
- addrb += stepmajor3; \
- xOffset += majordx; \
- e += y1_or_e1; \
- if (e >= 0){ \
- addrb += stepminor3; \
- xOffset += minordx; \
- e += e3; \
- } \
- }
-#else /* PSZ == 24 */
-
-#define body {\
- RROP_SOLID(addrp); \
- addrp += stepmajor; \
- e += y1_or_e1; \
- if (e >= 0) \
- { \
- addrp += stepminor; \
- e += e3; \
- } \
- }
-#endif /* PSZ == 24 */
-
-#ifdef LARGE_INSTRUCTION_CACHE
-
-# ifdef SERIOUS_UNROLLING
-# define UNROLL 16
-# else
-# define UNROLL 4
-# endif
-#define CASE(n) case -n: body
-
- while ((x1_or_len -= UNROLL) >= 0)
- {
- body body body body
-# if UNROLL >= 8
- body body body body
-# endif
-# if UNROLL >= 12
- body body body body
-# endif
-# if UNROLL >= 16
- body body body body
-# endif
- }
- switch (x1_or_len)
- {
- CASE(1) CASE(2) CASE(3)
-# if UNROLL >= 8
- CASE(4) CASE(5) CASE(6) CASE(7)
-# endif
-# if UNROLL >= 12
- CASE(8) CASE(9) CASE(10) CASE(11)
-# endif
-# if UNROLL >= 16
- CASE(12) CASE(13) CASE(14) CASE(15)
-# endif
- }
-#else /* !LARGE_INSTRUCTION_CACHE */
-
- IMPORTANT_START
- IMPORTANT_START
-
- if (x1_or_len & 1)
- body
- x1_or_len >>= 1;
- while (x1_or_len--) {
- body body
- }
-
- IMPORTANT_END
- IMPORTANT_END
-#endif /* LARGE_INSTRUCTION_CACHE */
-
-#ifdef POLYSEGMENT
-#if PSZ == 24
- body_rop
-#else
- RROP_SOLID(addrp);
-#endif
-#endif
-#if PSZ == 24
- addrp = (PixelType *)((unsigned long)addrb & ~0x03);
-#endif
- }
-#undef body
-#ifdef POLYSEGMENT
- }
- else /* Polysegment horizontal line optimization */
- {
-# ifdef REARRANGE
- register int e3;
- RROP_DECLARE
- RROP_FETCH_GCPRIV(devPriv);
-# endif /* REARRANGE */
- if (stepmajor < 0)
- {
-#if PSZ == 24
- xOffset -= x1_or_len;
- addrp = addrLineEnd + PXL2ADR(xOffset);
-#else
- addrp -= x1_or_len;
-#endif
- if (capStyle)
- x1_or_len++;
- else
-#if PSZ == 24
- xOffset++;
- addrp = addrLineEnd + PXL2ADR(xOffset);
-#else
- addrp++;
-#endif
- }
- else
- {
-#if PSZ == 24
- addrp = addrLineEnd + PXL2ADR(xOffset);
-#endif
- if (capStyle)
- x1_or_len++;
- }
-# if PSZ == 24
- y1_or_e1 = xOffset & 3;
-# else
-# if PGSZ == 64 /* PIM value from <cfbmskbits.h> is not it! (for 16/32 PSZ)*/
- y1_or_e1 = ((long) addrp) & 0x7;
- addrp = (PixelType *) (((unsigned char *) addrp) - y1_or_e1);
-# else
- y1_or_e1 = ((long) addrp) & PIM;
- addrp = (PixelType *) (((unsigned char *) addrp) - y1_or_e1);
-# endif
-#if PGSZ == 32
-# if PWSH != 2
- y1_or_e1 >>= (2 - PWSH);
-# endif
-#else /* PGSZ == 64 */
-# if PWSH != 3
- y1_or_e1 >>= (3 - PWSH);
-# endif
-#endif /* PGSZ */
-# endif /* PSZ == 24 */
-#if PSZ == 24
- {
-#if RROP == GXcopy
- register int nlmiddle;
- int leftIndex = xOffset & 3;
- int rightIndex = (xOffset + x1_or_len) & 3;
-#else
- register int pidx;
-#endif
-
-#if RROP == GXcopy
- nlmiddle = x1_or_len;
- if(leftIndex){
- nlmiddle -= (4 - leftIndex);
- }
- if(rightIndex){
- nlmiddle -= rightIndex;
- }
-
- nlmiddle >>= 2;
- switch(leftIndex+x1_or_len){
- case 4:
- switch(leftIndex){
- case 0:
- *addrp++ = piQxelXor[0];
- *addrp++ = piQxelXor[1];
- *addrp = piQxelXor[2];
- break;
- case 1:
- *addrp = ((*addrp) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
- addrp++;
- *addrp = piQxelXor[1];
- addrp++;
- *addrp = piQxelXor[2];
- break;
- case 2:
- *addrp = ((*addrp) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000);
- addrp++;
- *addrp = piQxelXor[2];
- break;
- case 3:
- *addrp = ((*addrp) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00);
- break;
- }
- break;
- case 3:
- switch(leftIndex){
- case 0:
- *addrp++ = piQxelXor[0];
- *addrp++ = piQxelXor[1];
- *addrp = ((*addrp) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
- break;
- case 1:
- *addrp = ((*addrp) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
- addrp++;
- *addrp = piQxelXor[1];
- addrp++;
- *addrp = ((*addrp) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
- break;
- case 2:
- *addrp = ((*addrp) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000);
- addrp++;
- *addrp = ((*addrp) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
- break;
- }
- break;
- case 2:
- switch(leftIndex){
-/*
- case 2:
- *addrp = ((*addrp) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000);
- addrp++;
- *addrp = ((*addrp) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
- break;
-*/
- case 1:
- *addrp = ((*addrp) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
- addrp++;
- *addrp = ((*addrp) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF);
- break;
- case 0:
- *addrp++ = piQxelXor[0];
- *addrp = ((*addrp) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF);
- break;
- }
- break;
- case 1: /*only if leftIndex = 0 and w = 1*/
- if(x1_or_len){
- *addrp = ((*addrp) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF);
- }
-/*
- else{
- *addrp = ((*addrp) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
- addrp++;
- *addrp = ((*addrp) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF);
- }
-*/
- break;
- case 0: /*never*/
- break;
- default:
- {
-/*
- maskbits(y1_or_e1, x1_or_len, e, e3, x1_or_len)
-*/
- switch(leftIndex){
- case 0:
- break;
- case 1:
- *addrp = ((*addrp) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
- addrp++;
- *addrp = piQxelXor[1];
- addrp++;
- *addrp = piQxelXor[2];
- addrp++;
- break;
- case 2:
- *addrp = ((*addrp) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000);
- addrp++;
- *addrp = piQxelXor[2];
- addrp++;
- break;
- case 3:
- *addrp = ((*addrp) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00);
- addrp++;
- break;
- }
- while(nlmiddle--){
- *addrp++ = piQxelXor[0];
- *addrp++ = piQxelXor[1];
- *addrp++ = piQxelXor[2];
- }
- switch(rightIndex++){
- case 0:
- break;
- case 1:
- *addrp = ((*addrp) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF);
- break;
- case 2:
- *addrp++ = piQxelXor[0];
- *addrp = ((*addrp) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF);
- break;
- case 3:
- *addrp++ = piQxelXor[0];
- *addrp++ = piQxelXor[1];
- *addrp = ((*addrp) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
- break;
- }
-/*
- if (e3){
- e3 &= 0xFFFFFF;
- switch(rightIndex&3){
- case 0:
- *addrp = ((*addrp) & (0xFF000000 | ~e3))
- | (piQxelXor[0] & 0xFFFFFF & e3);
- break;
- case 1:
- *addrp = ((*addrp) & (0xFFFFFF | ~(e3<<24)))
- + (piQxelXor[0] & 0xFF000000 & (e3<<24));
- addrp++;
- *addrp = ((*addrp) & (0xFFFF0000|~(e3 >> 8)))
- | (piQxelXor[1] & 0xFFFF & (e3 >> 8));
- break;
- case 2:
- *addrp = ((*addrp) & (0xFFFF|~(e3 << 16)))
- | (piQxelXor[1] & 0xFFFF0000 & (e3 << 16));
- addrp++;
- *addrp = ((*addrp) & (0xFFFFFF00|~(e3>>16)))
- | (piQxelXor[2] & 0xFF & (e3 >> 16));
- break;
- case 3:
- *addrp = ((*addrp) & (0xFF|~(e3<<8)))
- | (piQxelXor[2] & 0xFFFFFF00 & (e3<<8));
- addrp++;
- break;
- }
- }
-*/
- }
- }
-#else /* GXcopy */
- addrp = (PixelType *)((char *)addrLineEnd + ((xOffset * 3) & ~0x03));
- if (x1_or_len <= 1){
- if (x1_or_len)
- RROP_SOLID24(addrp, xOffset);
- } else {
- maskbits(xOffset, x1_or_len, e, e3, x1_or_len);
- pidx = xOffset & 3;
- if (e){
- RROP_SOLID_MASK(addrp, e, pidx-1);
- addrp++;
- if (pidx == 3)
- pidx = 0;
- }
- while (--x1_or_len >= 0){
- RROP_SOLID(addrp, pidx);
- addrp++;
- if (++pidx == 3)
- pidx = 0;
- }
- if (e3)
- RROP_SOLID_MASK(addrp, e3, pidx);
- }
-#endif /* GXcopy */
- }
-#else /* PSZ == 24 */
- if (y1_or_e1 + x1_or_len <= PPW)
- {
- if (x1_or_len)
- {
- maskpartialbits(y1_or_e1, x1_or_len, e)
- RROP_SOLID_MASK((CfbBits *) addrp, e);
- }
- }
- else
- {
- maskbits(y1_or_e1, x1_or_len, e, e3, x1_or_len)
- if (e)
- {
- RROP_SOLID_MASK((CfbBits *) addrp, e);
- addrp += PPW;
- }
- RROP_SPAN(addrp, x1_or_len)
- if (e3)
- RROP_SOLID_MASK((CfbBits *) addrp, e3);
- }
-#endif /* PSZ == 24 */
- }
-#endif /* POLYSEGMENT */
- }
-#ifdef POLYSEGMENT
- if (nseg >= 0)
- return (xSegment *) ppt - pSegInit;
-#else
- if (npt)
- {
-#ifdef EITHER_MODE
- if (!mode)
-#endif /* EITHER_MODE */
-#ifndef ORIGIN
- {
- *x1p = _x1;
- *y1p = _y1;
- *x2p = _x2;
- *y2p = _y2;
- }
-#endif /* !ORIGIN */
- return ((DDXPointPtr) ppt - pptInit) - 1;
- }
-
-# ifndef ORIGIN
-# define C2 c2
-# else
-# define C2 ppt[-1]
-# endif
-#ifdef EITHER_MODE
- if (pGC->capStyle != CapNotLast &&
- ((mode ? (C2 != *((int *) pptInitOrig))
- : ((_x2 != pptInitOrig->x) ||
- (_y2 != pptInitOrig->y)))
- || (ppt == ((int *)pptInitOrig) + 2)))
-#endif /* EITHER_MODE */
-#ifdef PREVIOUS
- if (pGC->capStyle != CapNotLast &&
- ((_x2 != pptInitOrig->x) ||
- (_y2 != pptInitOrig->y) ||
- (ppt == ((int *)pptInitOrig) + 2)))
-#endif /* PREVIOUS */
-#ifdef ORIGIN
- if (pGC->capStyle != CapNotLast &&
- ((C2 != *((int *) pptInitOrig)) ||
- (ppt == ((int *)pptInitOrig) + 2)))
-#endif /* !PREVIOUS */
- {
-# ifdef REARRANGE
- RROP_DECLARE
-
- RROP_FETCH_GCPRIV(devPriv);
-# endif
-#if PSZ == 24
-#if RROP == GXcopy
- switch(xOffset & 3){
- case 0:
- *addrp = ((*addrp)&0xFF000000)|(piQxelXor[0] & 0xFFFFFF);
- break;
- case 3:
- *addrp = ((*addrp)&0xFF)|(piQxelXor[2] & 0xFFFFFF00);
- break;
- case 1:
- *addrp = ((*addrp)&0xFFFFFF)|(piQxelXor[0] & 0xFF000000);
- *(addrp+1) = ((*(addrp+1))&0xFFFF0000)|(piQxelXor[1] & 0xFFFF);
- break;
- case 2:
- *addrp = ((*addrp)&0xFFFF)|(piQxelXor[1] & 0xFFFF0000);
- *(addrp+1) = ((*(addrp+1))&0xFFFFFF00)|(piQxelXor[2] & 0xFF);
- break;
- }
-#endif
-#if RROP == GXxor
- switch(xOffset & 3){
- case 0:
- *addrp ^= (piQxelXor[0] & 0xFFFFFF);
- break;
- case 3:
- *addrp ^= (piQxelXor[2] & 0xFFFFFF00);
- break;
- case 1:
- *addrp ^= (piQxelXor[0] & 0xFF000000);
- *(addrp+1) ^= (piQxelXor[1] & 0xFFFF);
- break;
- case 2:
- *addrp ^= (piQxelXor[1] & 0xFFFF0000);
- *(addrp+1) ^= (piQxelXor[2] & 0xFF);
- break;
- }
-#endif
-#if RROP == GXand
- switch(xOffset & 3){
- case 0:
- *addrp &= (piQxelAnd[0] | 0xFF000000);
- break;
- case 3:
- *addrp &= (piQxelAnd[2] | 0xFF);
- break;
- case 1:
- *addrp &= (0xFFFFFF|piQxelAnd[0]);
- *(addrp+1) &= (0xFFFF0000|piQxelAnd[1]);
- break;
- case 2:
- *addrp &= (0xFFFF|piQxelAnd[1]);
- *(addrp+1) &= (0xFFFFFF00|piQxelAnd[2]);
- break;
- }
-#endif
-#if RROP == GXor
- switch(xOffset & 3){
- case 0:
- *addrp |= (piQxelOr[0] & 0xFFFFFF);
- break;
- case 3:
- *addrp |= (piQxelOr[2] & 0xFFFFFF00);
- break;
- case 1:
- *addrp |= (piQxelOr[0] & 0xFF000000);
- *(addrp+1) |= (piQxelOr[1] & 0xFFFF);
- break;
- case 2:
- *addrp |= (piQxelOr[1] & 0xFFFF0000);
- *(addrp+1) |= (piQxelOr[2] & 0xFF);
- break;
- }
-#endif
-#if RROP == GXset
- switch(xOffset & 3){
- case 0:
- *addrp = (((*addrp)&(piQxelAnd[0] |0xFF000000))^(piQxelXor[0] & 0xFFFFFF));
- break;
- case 3:
- *addrp = (((*addrp)&(piQxelAnd[2]|0xFF))^(piQxelXor[2] & 0xFFFFFF00));
- break;
- case 1:
- *addrp = (((*addrp)&(piQxelAnd[0]|0xFFFFFF))^(piQxelXor[0] & 0xFF000000));
- *(addrp+1) = (((*(addrp+1))&(piQxelAnd[1]|0xFFFF0000))^(piQxelXor[1] & 0xFFFF));
- break;
- case 2:
- *addrp = (((*addrp)&(piQxelAnd[1]|0xFFFF))^(piQxelXor[1] & 0xFFFF0000));
- *(addrp+1) = (((*(addrp+1))&(piQxelAnd[2]|0xFFFFFF00))^(piQxelXor[2] & 0xFF));
- break;
- }
-#endif
-#else
- RROP_SOLID (addrp);
-# endif
- }
-#endif /* !POLYSEGMENT */
- RROP_UNDECLARE;
- return -1;
-}
-
-#endif /* INCLUDE_DRAW */
-
-
-#ifdef INCLUDE_OTHERS
-
-#ifdef POLYSEGMENT
-
-void
-cfb8SegmentSS1Rect (pDrawable, pGC, nseg, pSegInit)
- DrawablePtr pDrawable;
- GCPtr pGC;
- int nseg;
- xSegment *pSegInit;
-{
- int (*func)(DrawablePtr, GCPtr, int, xSegment *);
- void (*clip)(DrawablePtr, GCPtr, int, int, int, int, BoxPtr, Bool);
- int drawn;
- cfbPrivGCPtr devPriv;
-
-#if defined(__arm32__) && PSZ != 8
- /* XXX -JJK */
- /* There is a painting bug when PSZ != 8; I need to track it down! */
- cfbSegmentSS(pDrawable, pGC, nseg, pSegInit);
- return;
-#endif
-
- devPriv = cfbGetGCPrivate(pGC);
-#ifdef NO_ONE_RECT
- if (REGION_NUM_RECTS(pGC->pCompositeClip) != 1)
- {
- cfbSegmentSS(pDrawable, pGC, nseg, pSegInit);
- return;
- }
-#endif
- switch (devPriv->rop)
- {
- case GXcopy:
- func = cfb8SegmentSS1RectCopy;
- clip = cfb8ClippedLineCopy;
-#ifdef FAST_MUL
- if (cfbGetPixelWidth (pDrawable) == WIDTH_FAST)
- func = cfb8SegmentSS1RectShiftCopy;
-#endif
- break;
- case GXxor:
- func = cfb8SegmentSS1RectXor;
- clip = cfb8ClippedLineXor;
- break;
- default:
- func = cfb8SegmentSS1RectGeneral;
- clip = cfb8ClippedLineGeneral;
- break;
- }
- while (nseg)
- {
- drawn = (*func) (pDrawable, pGC, nseg, pSegInit);
- if (drawn == -1)
- break;
- (*clip) (pDrawable, pGC,
- pSegInit[drawn-1].x1, pSegInit[drawn-1].y1,
- pSegInit[drawn-1].x2, pSegInit[drawn-1].y2,
- &pGC->pCompositeClip->extents,
- pGC->capStyle == CapNotLast);
- pSegInit += drawn;
- nseg -= drawn;
- }
-}
-
-#else /* POLYSEGMENT */
-
-void
-cfb8LineSS1Rect (pDrawable, pGC, mode, npt, pptInit)
- DrawablePtr pDrawable;
- GCPtr pGC;
- int mode;
- int npt;
- DDXPointPtr pptInit;
-{
- int (*func)(DrawablePtr, GCPtr, int, int,
- DDXPointPtr, DDXPointPtr,
- int *, int *, int *, int *);
- void (*clip)(DrawablePtr, GCPtr, int, int, int, int, BoxPtr, Bool);
- int drawn;
- cfbPrivGCPtr devPriv;
- int x1, y1, x2, y2;
- DDXPointPtr pptInitOrig = pptInit;
-
-#if defined(__arm32__) && PSZ != 8
- /* XXX -JJK */
- /* There is a painting bug when PSZ != 8; I need to track it down! */
- cfbLineSS(pDrawable, pGC, mode, npt, pptInit);
- return;
-#endif
-
- devPriv = cfbGetGCPrivate(pGC);
-#ifdef NO_ONE_RECT
- if (REGION_NUM_RECTS(pGC->pCompositeClip) != 1)
- {
- cfbLineSS(pDrawable, pGC, mode, npt, pptInit);
- return;
- }
-#endif
- switch (devPriv->rop)
- {
- case GXcopy:
- func = cfb8LineSS1RectCopy;
- clip = cfb8ClippedLineCopy;
- if (mode == CoordModePrevious)
- func = cfb8LineSS1RectPreviousCopy;
- break;
- case GXxor:
- func = cfb8LineSS1RectXor;
- clip = cfb8ClippedLineXor;
- break;
- default:
- func = cfb8LineSS1RectGeneral;
- clip = cfb8ClippedLineGeneral;
- break;
- }
- if (mode == CoordModePrevious)
- {
- x1 = pptInit->x;
- y1 = pptInit->y;
- while (npt > 1)
- {
- drawn = (*func) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig,
- &x1, &y1, &x2, &y2);
- if (drawn == -1)
- break;
- (*clip) (pDrawable, pGC, x1, y1, x2, y2,
- &pGC->pCompositeClip->extents,
- drawn != npt - 1 || pGC->capStyle == CapNotLast);
- pptInit += drawn;
- npt -= drawn;
- x1 = x2;
- y1 = y2;
- }
- }
- else
- {
- while (npt > 1)
- {
- drawn = (*func) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig,
- &x1, &y1, &x2, &y2);
- if (drawn == -1)
- break;
- (*clip) (pDrawable, pGC,
- pptInit[drawn-1].x, pptInit[drawn-1].y,
- pptInit[drawn].x, pptInit[drawn].y,
- &pGC->pCompositeClip->extents,
- drawn != npt - 1 || pGC->capStyle == CapNotLast);
- pptInit += drawn;
- npt -= drawn;
- }
- }
-}
-
-#endif /* else POLYSEGMENT */
-#endif /* INCLUDE_OTHERS */
-
-#if !defined(POLYSEGMENT) && !defined (PREVIOUS)
-
-void
-RROP_NAME (cfb8ClippedLine) (pDrawable, pGC, x1, y1, x2, y2, boxp, shorten)
- DrawablePtr pDrawable;
- GCPtr pGC;
- int x1, y1, x2, y2;
- BoxPtr boxp;
- Bool shorten;
-{
- int oc1, oc2;
- int e, e1, e3, len;
- int adx, ady;
-
- PixelType *addr;
- int nwidth;
- int stepx, stepy;
- int xorg, yorg;
- int new_x1, new_y1, new_x2, new_y2;
- Bool pt1_clipped, pt2_clipped;
- int changex, changey, result;
-#if PSZ == 24
- PixelType *addrLineEnd;
- char *addrb;
- int stepx3, stepy3;
-#endif
- int octant;
- unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
-
- cfbGetPixelWidthAndPointer(pDrawable, nwidth, addr);
-
- xorg = pDrawable->x;
- yorg = pDrawable->y;
- x1 += xorg;
- y1 += yorg;
- x2 += xorg;
- y2 += yorg;
- oc1 = 0;
- oc2 = 0;
- OUTCODES (oc1, x1, y1, boxp);
- OUTCODES (oc2, x2, y2, boxp);
-
- if (oc1 & oc2)
- return;
-
- CalcLineDeltas(x1, y1, x2, y2, adx, ady, stepx, stepy, 1, nwidth, octant);
-
- if (adx <= ady)
- {
- int t;
-
- t = adx;
- adx = ady;
- ady = t;
-
- t = stepx;
- stepx = stepy;
- stepy = t;
-
- SetYMajorOctant(octant);
- }
- e = - adx;
- e1 = ady << 1;
- e3 = - (adx << 1);
-
- FIXUP_ERROR(e, octant, bias);
-
- new_x1 = x1;
- new_y1 = y1;
- new_x2 = x2;
- new_y2 = y2;
- pt1_clipped = 0;
- pt2_clipped = 0;
-
- if (IsXMajorOctant(octant))
- {
- result = miZeroClipLine(boxp->x1, boxp->y1, boxp->x2 - 1, boxp->y2 - 1,
- &new_x1, &new_y1, &new_x2, &new_y2,
- adx, ady,
- &pt1_clipped, &pt2_clipped,
- octant, bias, oc1, oc2);
- if (result == -1)
- return;
-
- len = abs(new_x2 - new_x1) - 1; /* this routine needs the "-1" */
-
- /* if we've clipped the endpoint, always draw the full length
- * of the segment, because then the capstyle doesn't matter
- * if x2,y2 isn't clipped, use the capstyle
- * (shorten == TRUE <--> CapNotLast)
- */
- if (pt2_clipped || !shorten)
- len++;
-
- if (pt1_clipped)
- {
- /* must calculate new error terms */
- changex = abs(new_x1 - x1);
- changey = abs(new_y1 - y1);
- e = e + changey * e3 + changex * e1;
- }
- }
- else /* Y_AXIS */
- {
- result = miZeroClipLine(boxp->x1, boxp->y1, boxp->x2 - 1, boxp->y2 - 1,
- &new_x1, &new_y1, &new_x2, &new_y2,
- ady, adx,
- &pt1_clipped, &pt2_clipped,
- octant, bias, oc1, oc2);
- if (result == -1)
- return;
-
- len = abs(new_y2 - new_y1) - 1; /* this routine needs the "-1" */
-
- /* if we've clipped the endpoint, always draw the full length
- * of the segment, because then the capstyle doesn't matter
- * if x2,y2 isn't clipped, use the capstyle
- * (shorten == TRUE <--> CapNotLast)
- */
- if (pt2_clipped || !shorten)
- len++;
-
- if (pt1_clipped)
- {
- /* must calculate new error terms */
- changex = abs(new_x1 - x1);
- changey = abs(new_y1 - y1);
- e = e + changex * e3 + changey * e1;
- }
- }
- x1 = new_x1;
- y1 = new_y1;
- {
- register PixelType *addrp;
- RROP_DECLARE
-
- RROP_FETCH_GC(pGC);
-
-#if PSZ == 24
- addrLineEnd = addr + (y1 * nwidth);
- addrb = (char *)addrLineEnd + x1 * 3;
- if (stepx == 1 || stepx == -1){
- stepx3 = stepx * 3;
- stepy3 = stepy * sizeof (CfbBits);
- } else {
- stepx3 = stepx * sizeof (CfbBits);
- stepy3 = stepy * 3;
- }
-#else
- addrp = addr + (y1 * nwidth) + x1;
-#endif
-
-#ifndef REARRANGE
- if (!ady)
- {
-#if PSZ == 24
-#define body {\
- body_rop \
- addrb += stepx3; \
- }
-#else
-#define body { RROP_SOLID(addrp); addrp += stepx; }
-#endif
- while (len >= PGSZB)
- {
- body body body body
-#if PGSZ == 64
- body body body body
-#endif
- len -= PGSZB;
- }
- switch (len)
- {
-#if PGSZ == 64
- case 7: body case 6: body case 5: body case 4: body
-#endif
- case 3: body case 2: body case 1: body
- }
-#undef body
- }
- else
-#endif /* !REARRANGE */
- {
-#if PSZ == 24
-#define body {\
- body_rop \
- addrb += stepx3; \
- e += e1; \
- if (e >= 0) \
- { \
- addrb += stepy3; \
- e += e3; \
- } \
- }
-#else
-#define body {\
- RROP_SOLID(addrp); \
- addrp += stepx; \
- e += e1; \
- if (e >= 0) \
- { \
- addrp += stepy; \
- e += e3; \
- } \
- }
-#endif
-
-#ifdef LARGE_INSTRUCTION_CACHE
- while ((len -= PGSZB) >= 0)
- {
- body body body body
-#if PGSZ == 64
- body body body body
-#endif
- }
- switch (len)
- {
- case -1: body case -2: body case -3: body
-#if PGSZ == 64
- case -4: body case -5: body case -6: body case -7: body
-#endif
- }
-#else /* !LARGE_INSTRUCTION_CACHE */
- IMPORTANT_START;
-
- while ((len -= 2) >= 0)
- {
- body body;
- }
- if (len & 1)
- body;
-
- IMPORTANT_END;
-#endif /* LARGE_INSTRUCTION_CACHE */
- }
-#if PSZ == 24
- body_rop
-#else
- RROP_SOLID(addrp);
-#endif
-#undef body
- RROP_UNDECLARE
- }
-}
-
-#endif /* !POLYSEGMENT && !PREVIOUS */
-#endif /* PIXEL_ADDR */
diff --git a/cfb/cfballpriv.c b/cfb/cfballpriv.c
deleted file mode 100644
index 3b58266c5..000000000
--- a/cfb/cfballpriv.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- *
-Copyright 1991, 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
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include "servermd.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "resource.h"
-#include "colormap.h"
-#include "colormapst.h"
-#include "cfb.h"
-#include "mi.h"
-#include "mistruct.h"
-#include "dix.h"
-#include "cfbmskbits.h"
-#include "mibstore.h"
-
-#if 1 || PSZ==8
-DevPrivateKey cfbGCPrivateKey = &cfbGCPrivateKey;
-#endif
-#ifdef CFB_NEED_SCREEN_PRIVATE
-DevPrivateKey cfbScreenPrivateKey = &cfbScreenPrivateKey;
-#endif
-
-
-Bool
-cfbAllocatePrivates(ScreenPtr pScreen, DevPrivateKey *gc_key)
-{
- if (!gc_key || !*gc_key)
- {
- if (!mfbAllocatePrivates(pScreen, &cfbGCPrivateKey))
- return FALSE;
- if (gc_key)
- *gc_key = cfbGCPrivateKey;
- }
- else
- {
- cfbGCPrivateKey = *gc_key;
- }
- return dixRequestPrivate(cfbGCPrivateKey, sizeof(cfbPrivGC));
-}
diff --git a/cfb/cfbbitblt.c b/cfb/cfbbitblt.c
deleted file mode 100644
index 00bf41367..000000000
--- a/cfb/cfbbitblt.c
+++ /dev/null
@@ -1,1455 +0,0 @@
-/*
- * cfb copy area
- */
-
-
-/*
-
-Copyright 1989, 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
-
-*/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <X11/Xproto.h>
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "regionstr.h"
-#include "mi.h"
-#include "cfb.h"
-#include "cfbmskbits.h"
-#include "cfb8bit.h"
-#include "fastblt.h"
-#define MFB_CONSTS_ONLY
-#include "maskbits.h"
-
-#if PSZ == 8
-#define cfbCopyPlane1toN cfbCopyPlane1to8
-#define cfbCopyPlaneNto1 cfbCopyPlane8to1
-#else
-static unsigned int FgPixel, BgPixel;
-# if PSZ == 16
-#define cfbCopyPlane1toN cfbCopyPlane1to16
-#define cfbCopyPlaneNto1 cfbCopyPlane16to1
-# endif
-# if PSZ == 24
-#define cfbCopyPlane1toN cfbCopyPlane1to24
-#define cfbCopyPlaneNto1 cfbCopyPlane24to1
-# endif
-# if PSZ == 32
-#define cfbCopyPlane1toN cfbCopyPlane1to32
-#define cfbCopyPlaneNto1 cfbCopyPlane32to1
-# endif
-#endif
-
-/* cfbBitBltcfb == cfbCopyPlaneExpand */
-RegionPtr
-cfbBitBlt (
- register DrawablePtr pSrcDrawable,
- register DrawablePtr pDstDrawable,
- GC *pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty,
- void (*doBitBlt)(
- DrawablePtr /*pSrc*/,
- DrawablePtr /*pDst*/,
- int /*alu*/,
- RegionPtr /*prgnDst*/,
- DDXPointPtr /*pptSrc*/,
- unsigned long /*planemask*/),
- unsigned long bitPlane)
-{
- RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */
- Bool freeSrcClip = FALSE;
-
- RegionPtr prgnExposed;
- RegionRec rgnDst;
- DDXPointPtr pptSrc;
- register DDXPointPtr ppt;
- register BoxPtr pbox;
- int i;
- register int dx;
- register int dy;
- xRectangle origSource;
- DDXPointRec origDest;
- int numRects;
- BoxRec fastBox;
- int fastClip = 0; /* for fast clipping with pixmap source */
- int fastExpose = 0; /* for fast exposures with pixmap source */
-
- origSource.x = srcx;
- origSource.y = srcy;
- origSource.width = width;
- origSource.height = height;
- origDest.x = dstx;
- origDest.y = dsty;
-
- if ((pSrcDrawable != pDstDrawable) &&
- pSrcDrawable->pScreen->SourceValidate)
- {
- (*pSrcDrawable->pScreen->SourceValidate) (pSrcDrawable, srcx, srcy, width, height);
- }
-
- srcx += pSrcDrawable->x;
- srcy += pSrcDrawable->y;
-
- /* clip the source */
-
- if (pSrcDrawable->type == DRAWABLE_PIXMAP)
- {
- if ((pSrcDrawable == pDstDrawable) &&
- (pGC->clientClipType == CT_NONE))
- {
- prgnSrcClip = cfbGetCompositeClip(pGC);
- }
- else
- {
- fastClip = 1;
- }
- }
- else
- {
- if (pGC->subWindowMode == IncludeInferiors)
- {
- /*
- * XFree86 DDX empties the border clip when the
- * VT is inactive
- */
- if (!((WindowPtr) pSrcDrawable)->parent &&
- REGION_NOTEMPTY (pSrcDrawable->pScreen,
- &((WindowPtr) pSrcDrawable)->borderClip))
- {
- /*
- * special case bitblt from root window in
- * IncludeInferiors mode; just like from a pixmap
- */
- fastClip = 1;
- }
- else if ((pSrcDrawable == pDstDrawable) &&
- (pGC->clientClipType == CT_NONE))
- {
- prgnSrcClip = cfbGetCompositeClip(pGC);
- }
- else
- {
- prgnSrcClip = NotClippedByChildren((WindowPtr)pSrcDrawable);
- freeSrcClip = TRUE;
- }
- }
- else
- {
- prgnSrcClip = &((WindowPtr)pSrcDrawable)->clipList;
- }
- }
-
- fastBox.x1 = srcx;
- fastBox.y1 = srcy;
- fastBox.x2 = srcx + width;
- fastBox.y2 = srcy + height;
-
- /* Don't create a source region if we are doing a fast clip */
- if (fastClip)
- {
- fastExpose = 1;
- /*
- * clip the source; if regions extend beyond the source size,
- * make sure exposure events get sent
- */
- if (fastBox.x1 < pSrcDrawable->x)
- {
- fastBox.x1 = pSrcDrawable->x;
- fastExpose = 0;
- }
- if (fastBox.y1 < pSrcDrawable->y)
- {
- fastBox.y1 = pSrcDrawable->y;
- fastExpose = 0;
- }
- if (fastBox.x2 > pSrcDrawable->x + (int) pSrcDrawable->width)
- {
- fastBox.x2 = pSrcDrawable->x + (int) pSrcDrawable->width;
- fastExpose = 0;
- }
- if (fastBox.y2 > pSrcDrawable->y + (int) pSrcDrawable->height)
- {
- fastBox.y2 = pSrcDrawable->y + (int) pSrcDrawable->height;
- fastExpose = 0;
- }
- }
- else
- {
- REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
- REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, prgnSrcClip);
- }
-
- dstx += pDstDrawable->x;
- dsty += pDstDrawable->y;
-
- if (pDstDrawable->type == DRAWABLE_WINDOW)
- {
- if (!((WindowPtr)pDstDrawable)->realized)
- {
- if (!fastClip)
- REGION_UNINIT(pGC->pScreen, &rgnDst);
- if (freeSrcClip)
- REGION_DESTROY(pGC->pScreen, prgnSrcClip);
- return NULL;
- }
- }
-
- dx = srcx - dstx;
- dy = srcy - dsty;
-
- /* Translate and clip the dst to the destination composite clip */
- if (fastClip)
- {
- RegionPtr cclip;
-
- /* Translate the region directly */
- fastBox.x1 -= dx;
- fastBox.x2 -= dx;
- fastBox.y1 -= dy;
- fastBox.y2 -= dy;
-
- /* If the destination composite clip is one rectangle we can
- do the clip directly. Otherwise we have to create a full
- blown region and call intersect */
-
- /* XXX because CopyPlane uses this routine for 8-to-1 bit
- * copies, this next line *must* also correctly fetch the
- * composite clip from an mfb gc
- */
-
- cclip = cfbGetCompositeClip(pGC);
- if (REGION_NUM_RECTS(cclip) == 1)
- {
- BoxPtr pBox = REGION_RECTS(cclip);
-
- if (fastBox.x1 < pBox->x1) fastBox.x1 = pBox->x1;
- if (fastBox.x2 > pBox->x2) fastBox.x2 = pBox->x2;
- if (fastBox.y1 < pBox->y1) fastBox.y1 = pBox->y1;
- if (fastBox.y2 > pBox->y2) fastBox.y2 = pBox->y2;
-
- /* Check to see if the region is empty */
- if (fastBox.x1 >= fastBox.x2 || fastBox.y1 >= fastBox.y2)
- {
- REGION_NULL(pGC->pScreen, &rgnDst);
- }
- else
- {
- REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
- }
- }
- else
- {
- /* We must turn off fastClip now, since we must create
- a full blown region. It is intersected with the
- composite clip below. */
- fastClip = 0;
- REGION_INIT(pGC->pScreen, &rgnDst, &fastBox,1);
- }
- }
- else
- {
- REGION_TRANSLATE(pGC->pScreen, &rgnDst, -dx, -dy);
- }
-
- if (!fastClip)
- {
- REGION_INTERSECT(pGC->pScreen, &rgnDst,
- &rgnDst,
- cfbGetCompositeClip(pGC));
- }
-
- /* Do bit blitting */
- numRects = REGION_NUM_RECTS(&rgnDst);
- if (numRects && width && height)
- {
- if(!(pptSrc = (DDXPointPtr)xalloc(numRects *
- sizeof(DDXPointRec))))
- {
- REGION_UNINIT(pGC->pScreen, &rgnDst);
- if (freeSrcClip)
- REGION_DESTROY(pGC->pScreen, prgnSrcClip);
- return NULL;
- }
- pbox = REGION_RECTS(&rgnDst);
- ppt = pptSrc;
- for (i = numRects; --i >= 0; pbox++, ppt++)
- {
- ppt->x = pbox->x1 + dx;
- ppt->y = pbox->y1 + dy;
- }
-
- (*doBitBlt) (pSrcDrawable, pDstDrawable, pGC->alu, &rgnDst, pptSrc, pGC->planemask);
- xfree(pptSrc);
- }
-
- prgnExposed = NULL;
- if (pGC->fExpose)
- {
- /* Pixmap sources generate a NoExposed (we return NULL to do this) */
- if (!fastExpose)
- prgnExposed =
- miHandleExposures(pSrcDrawable, pDstDrawable, pGC,
- origSource.x, origSource.y,
- (int)origSource.width,
- (int)origSource.height,
- origDest.x, origDest.y, bitPlane);
- }
- REGION_UNINIT(pGC->pScreen, &rgnDst);
- if (freeSrcClip)
- REGION_DESTROY(pGC->pScreen, prgnSrcClip);
- return prgnExposed;
-}
-
-
-RegionPtr
-cfbCopyPlaneReduce (
- register DrawablePtr pSrcDrawable,
- register DrawablePtr pDstDrawable,
- GC *pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty,
- void (*doCopyPlane)(
- DrawablePtr /*pSrc*/,
- DrawablePtr /*pDst*/,
- int /*alu*/,
- RegionPtr /*prgnDst*/,
- DDXPointPtr /*pptSrc*/,
- unsigned long /*planemask*/,
- unsigned long /*bitPlane*/),
- unsigned long bitPlane)
-{
- RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */
- Bool freeSrcClip = FALSE;
-
- RegionPtr prgnExposed;
- RegionRec rgnDst;
- DDXPointPtr pptSrc;
- register DDXPointPtr ppt;
- register BoxPtr pbox;
- int i;
- register int dx;
- register int dy;
- xRectangle origSource;
- DDXPointRec origDest;
- int numRects;
- BoxRec fastBox;
- int fastClip = 0; /* for fast clipping with pixmap source */
- int fastExpose = 0; /* for fast exposures with pixmap source */
-
- origSource.x = srcx;
- origSource.y = srcy;
- origSource.width = width;
- origSource.height = height;
- origDest.x = dstx;
- origDest.y = dsty;
-
- if ((pSrcDrawable != pDstDrawable) &&
- pSrcDrawable->pScreen->SourceValidate)
- {
- (*pSrcDrawable->pScreen->SourceValidate) (pSrcDrawable, srcx, srcy, width, height);
- }
-
- srcx += pSrcDrawable->x;
- srcy += pSrcDrawable->y;
-
- /* clip the source */
-
- if (pSrcDrawable->type == DRAWABLE_PIXMAP)
- {
- if ((pSrcDrawable == pDstDrawable) &&
- (pGC->clientClipType == CT_NONE))
- {
- prgnSrcClip = cfbGetCompositeClip(pGC);
- }
- else
- {
- fastClip = 1;
- }
- }
- else
- {
- if (pGC->subWindowMode == IncludeInferiors)
- {
- /*
- * XFree86 DDX empties the border clip when the
- * VT is inactive
- */
- if (!((WindowPtr) pSrcDrawable)->parent &&
- REGION_NOTEMPTY (pSrcDrawable->pScreen,
- &((WindowPtr) pSrcDrawable)->borderClip))
- {
- /*
- * special case bitblt from root window in
- * IncludeInferiors mode; just like from a pixmap
- */
- fastClip = 1;
- }
- else if ((pSrcDrawable == pDstDrawable) &&
- (pGC->clientClipType == CT_NONE))
- {
- prgnSrcClip = cfbGetCompositeClip(pGC);
- }
- else
- {
- prgnSrcClip = NotClippedByChildren((WindowPtr)pSrcDrawable);
- freeSrcClip = TRUE;
- }
- }
- else
- {
- prgnSrcClip = &((WindowPtr)pSrcDrawable)->clipList;
- }
- }
-
- fastBox.x1 = srcx;
- fastBox.y1 = srcy;
- fastBox.x2 = srcx + width;
- fastBox.y2 = srcy + height;
-
- /* Don't create a source region if we are doing a fast clip */
- if (fastClip)
- {
- fastExpose = 1;
- /*
- * clip the source; if regions extend beyond the source size,
- * make sure exposure events get sent
- */
- if (fastBox.x1 < pSrcDrawable->x)
- {
- fastBox.x1 = pSrcDrawable->x;
- fastExpose = 0;
- }
- if (fastBox.y1 < pSrcDrawable->y)
- {
- fastBox.y1 = pSrcDrawable->y;
- fastExpose = 0;
- }
- if (fastBox.x2 > pSrcDrawable->x + (int) pSrcDrawable->width)
- {
- fastBox.x2 = pSrcDrawable->x + (int) pSrcDrawable->width;
- fastExpose = 0;
- }
- if (fastBox.y2 > pSrcDrawable->y + (int) pSrcDrawable->height)
- {
- fastBox.y2 = pSrcDrawable->y + (int) pSrcDrawable->height;
- fastExpose = 0;
- }
- }
- else
- {
- REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
- REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, prgnSrcClip);
- }
-
- dstx += pDstDrawable->x;
- dsty += pDstDrawable->y;
-
- if (pDstDrawable->type == DRAWABLE_WINDOW)
- {
- if (!((WindowPtr)pDstDrawable)->realized)
- {
- if (!fastClip)
- REGION_UNINIT(pGC->pScreen, &rgnDst);
- if (freeSrcClip)
- REGION_DESTROY(pGC->pScreen, prgnSrcClip);
- return NULL;
- }
- }
-
- dx = srcx - dstx;
- dy = srcy - dsty;
-
- /* Translate and clip the dst to the destination composite clip */
- if (fastClip)
- {
- RegionPtr cclip;
-
- /* Translate the region directly */
- fastBox.x1 -= dx;
- fastBox.x2 -= dx;
- fastBox.y1 -= dy;
- fastBox.y2 -= dy;
-
- /* If the destination composite clip is one rectangle we can
- do the clip directly. Otherwise we have to create a full
- blown region and call intersect */
-
- /* XXX because CopyPlane uses this routine for 8-to-1 bit
- * copies, this next line *must* also correctly fetch the
- * composite clip from an mfb gc
- */
-
- cclip = cfbGetCompositeClip(pGC);
- if (REGION_NUM_RECTS(cclip) == 1)
- {
- BoxPtr pBox = REGION_RECTS(cclip);
-
- if (fastBox.x1 < pBox->x1) fastBox.x1 = pBox->x1;
- if (fastBox.x2 > pBox->x2) fastBox.x2 = pBox->x2;
- if (fastBox.y1 < pBox->y1) fastBox.y1 = pBox->y1;
- if (fastBox.y2 > pBox->y2) fastBox.y2 = pBox->y2;
-
- /* Check to see if the region is empty */
- if (fastBox.x1 >= fastBox.x2 || fastBox.y1 >= fastBox.y2)
- {
- REGION_NULL(pGC->pScreen, &rgnDst);
- }
- else
- {
- REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
- }
- }
- else
- {
- /* We must turn off fastClip now, since we must create
- a full blown region. It is intersected with the
- composite clip below. */
- fastClip = 0;
- REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
- }
- }
- else
- {
- REGION_TRANSLATE(pGC->pScreen, &rgnDst, -dx, -dy);
- }
-
- if (!fastClip)
- {
- REGION_INTERSECT(pGC->pScreen, &rgnDst,
- &rgnDst,
- cfbGetCompositeClip(pGC));
- }
-
- /* Do bit blitting */
- numRects = REGION_NUM_RECTS(&rgnDst);
- if (numRects && width && height)
- {
- if(!(pptSrc = (DDXPointPtr)xalloc(numRects *
- sizeof(DDXPointRec))))
- {
- REGION_UNINIT(pGC->pScreen, &rgnDst);
- if (freeSrcClip)
- REGION_DESTROY(pGC->pScreen, prgnSrcClip);
- return NULL;
- }
- pbox = REGION_RECTS(&rgnDst);
- ppt = pptSrc;
- for (i = numRects; --i >= 0; pbox++, ppt++)
- {
- ppt->x = pbox->x1 + dx;
- ppt->y = pbox->y1 + dy;
- }
-
- (*doCopyPlane) (pSrcDrawable, pDstDrawable, pGC->alu, &rgnDst, pptSrc, pGC->planemask, bitPlane);
- xfree(pptSrc);
- }
-
- prgnExposed = NULL;
- if (pGC->fExpose)
- {
- /* Pixmap sources generate a NoExposed (we return NULL to do this) */
- if (!fastExpose)
- prgnExposed =
- miHandleExposures(pSrcDrawable, pDstDrawable, pGC,
- origSource.x, origSource.y,
- (int)origSource.width,
- (int)origSource.height,
- origDest.x, origDest.y, bitPlane);
- }
- REGION_UNINIT(pGC->pScreen, &rgnDst);
- if (freeSrcClip)
- REGION_DESTROY(pGC->pScreen, prgnSrcClip);
- return prgnExposed;
-}
-
-
-void
-cfbDoBitblt (pSrc, pDst, alu, prgnDst, pptSrc, planemask)
- DrawablePtr pSrc, pDst;
- int alu;
- RegionPtr prgnDst;
- DDXPointPtr pptSrc;
- unsigned long planemask;
-{
- void (*doBitBlt)(
- DrawablePtr /*pSrc*/,
- DrawablePtr /*pDst*/,
- int /*alu*/,
- RegionPtr /*prgnDst*/,
- DDXPointPtr /*pptSrc*/,
- unsigned long /*planemask*/)
- = cfbDoBitbltGeneral;
-
- if ((planemask & PMSK) == PMSK) {
- switch (alu) {
- case GXcopy:
- doBitBlt = cfbDoBitbltCopy;
- break;
- case GXxor:
- doBitBlt = cfbDoBitbltXor;
- break;
- case GXor:
- doBitBlt = cfbDoBitbltOr;
- break;
- }
- }
- (*doBitBlt) (pSrc, pDst, alu, prgnDst, pptSrc, planemask);
-}
-
-RegionPtr
-cfbCopyArea(pSrcDrawable, pDstDrawable,
- pGC, srcx, srcy, width, height, dstx, dsty)
- register DrawablePtr pSrcDrawable;
- register DrawablePtr pDstDrawable;
- GC *pGC;
- int srcx, srcy;
- int width, height;
- int dstx, dsty;
-{
- void (*doBitBlt) (
- DrawablePtr /*pSrc*/,
- DrawablePtr /*pDst*/,
- int /*alu*/,
- RegionPtr /*prgnDst*/,
- DDXPointPtr /*pptSrc*/,
- unsigned long /*planemask*/);
-
- doBitBlt = cfbDoBitbltCopy;
- if (pGC->alu != GXcopy || (pGC->planemask & PMSK) != PMSK)
- {
- doBitBlt = cfbDoBitbltGeneral;
- if ((pGC->planemask & PMSK) == PMSK)
- {
- switch (pGC->alu) {
- case GXxor:
- doBitBlt = cfbDoBitbltXor;
- break;
- case GXor:
- doBitBlt = cfbDoBitbltOr;
- break;
- }
- }
- }
- return cfbBitBlt (pSrcDrawable, pDstDrawable,
- pGC, srcx, srcy, width, height, dstx, dsty, doBitBlt, 0L);
-}
-
-#if PSZ == 8
-void
-cfbCopyPlane1to8 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, planemask)
- DrawablePtr pSrcDrawable; /* must be a bitmap */
- DrawablePtr pDstDrawable; /* must be depth 8 drawable */
- int rop; /* not used; caller must call cfb8CheckOpaqueStipple
- * beforehand to get cfb8StippleRRop set correctly */
- RegionPtr prgnDst; /* region in destination to draw to;
- * screen relative coords. if dest is a window;
- * drawable relative if dest is a pixmap */
- DDXPointPtr pptSrc; /* drawable relative src coords to copy from;
- * must be one point for each box in prgnDst */
- unsigned long planemask; /* to apply to destination writes */
-{
- int srcx, srcy; /* upper left corner of box being copied in source */
- int dstx, dsty; /* upper left corner of box being copied in dest */
- int width, height; /* in pixels, unpadded, of box being copied */
- int xoffSrc; /* bit # in leftmost word of row from which copying starts */
- int xoffDst; /* byte # in leftmost word of row from which copying starts */
- CfbBits *psrcBase, *pdstBase; /* start of drawable's pixel data */
- int widthSrc; /* # of groups of 32 pixels (1 bit/pixel) in src bitmap*/
- int widthDst; /* # of groups of 4 pixels (8 bits/pixel) in dst */
- CfbBits *psrcLine, *pdstLine; /* steps a row at a time thru src/dst;
- * may point into middle of row */
- register CfbBits *psrc, *pdst; /* steps within the row */
- register CfbBits bits, tmp; /* bits from source */
- register int leftShift;
- register int rightShift;
- CfbBits startmask; /* left edge pixel mask */
- CfbBits endmask; /* right edge pixel mask */
- register int nlMiddle; /* number of words in middle of the row to draw */
- register int nl;
- int firstoff = 0;
- int secondoff = 0;
- CfbBits src;
- int nbox; /* number of boxes in region to copy */
- BoxPtr pbox; /* steps thru boxes in region */
- int pixelsRemainingOnRightEdge; /* # pixels to be drawn on a row after
- * the main "middle" loop */
-
- cfbGetLongWidthAndPointer (pSrcDrawable, widthSrc, psrcBase)
- cfbGetLongWidthAndPointer (pDstDrawable, widthDst, pdstBase)
-
- 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 >> MFB_PWSH);
- pdstLine = pdstBase + dsty * widthDst + (dstx >> PWSH);
- xoffSrc = srcx & MFB_PIM; /* finds starting bit in src */
- xoffDst = dstx & PIM; /* finds starting byte in dst */
-
- /* compute startmask, endmask, nlMiddle */
-
- if (xoffDst + width < PPW) /* XXX should this be '<= PPW' ? */
- { /* the copy only affects one word per row in destination */
- maskpartialbits(dstx, width, startmask);
- endmask = 0; /* nothing on right edge */
- nlMiddle = 0; /* nothing in middle */
- }
- else
- { /* the copy will affect multiple words per row in destination */
- maskbits(dstx, width, startmask, endmask, nlMiddle);
- }
-
- /*
- * compute constants for the first four bits to be
- * copied. This avoids troubles with partial first
- * writes, and difficult shift computation
- */
- if (startmask)
- {
- firstoff = xoffSrc - xoffDst;
- if (firstoff > (MFB_PPW-PPW))
- secondoff = MFB_PPW - firstoff;
- if (xoffDst)
- {
- srcx += (PPW-xoffDst);
- xoffSrc = srcx & MFB_PIM;
- }
- }
- leftShift = xoffSrc;
- rightShift = MFB_PPW - leftShift;
-
- pixelsRemainingOnRightEdge = (nlMiddle & 7) * PPW +
- ((dstx + width) & PIM);
-
- /* setup is done; now let's move some bits */
-
- /* caller must call cfb8CheckOpaqueStipple before this function
- * to set cfb8StippleRRop!
- */
-
- if (cfb8StippleRRop == GXcopy)
- {
- while (height--)
- { /* one iteration of this loop copies one row */
- psrc = psrcLine;
- pdst = pdstLine;
- psrcLine += widthSrc;
- pdstLine += widthDst;
- bits = *psrc++;
- if (startmask)
- {
- if (firstoff < 0)
- tmp = BitRight (bits, -firstoff);
- else
- {
- tmp = BitLeft (bits, firstoff);
- /*
- * need a more cautious test for partialmask
- * case...
- */
- if (firstoff >= (MFB_PPW-PPW))
- {
- bits = *psrc++;
- if (firstoff != (MFB_PPW-PPW))
- tmp |= BitRight (bits, secondoff);
- }
- }
- *pdst = (*pdst & ~startmask) | (GetPixelGroup(tmp) & startmask);
- pdst++;
- }
- nl = nlMiddle;
- while (nl >= 8)
- {
- nl -= 8;
- tmp = BitLeft(bits, leftShift);
- bits = *psrc++;
- if (rightShift != MFB_PPW)
- tmp |= BitRight(bits, rightShift);
-
-#ifdef FAST_CONSTANT_OFFSET_MODE
-# define StorePixels(pdst,o,pixels) (pdst)[o] = (pixels)
-# define EndStep(pdst,o) (pdst) += (o)
-# define StoreRopPixels(pdst,o,and,xor) (pdst)[o] = DoRRop((pdst)[o],and,xor);
-#else
-# define StorePixels(pdst,o,pixels) *(pdst)++ = (pixels)
-# define EndStep(pdst,o)
-# define StoreRopPixels(pdst,o,and,xor) *(pdst) = DoRRop(*(pdst),and,xor); (pdst)++;
-#endif
-
-#define Step(c) NextBitGroup(c);
-#define StoreBitsPlain(o,c) StorePixels(pdst,o,GetPixelGroup(c))
-#define StoreRopBitsPlain(o,c) StoreRopPixels(pdst,o,\
- cfb8StippleAnd[GetBitGroup(c)], \
- cfb8StippleXor[GetBitGroup(c)])
-#define StoreBits0(c) StoreBitsPlain(0,c)
-#define StoreRopBits0(c) StoreRopBitsPlain(0,c)
-
-#if (BITMAP_BIT_ORDER == MSBFirst)
-# define StoreBits(o,c) StoreBitsPlain(o,c)
-# define StoreRopBits(o,c) StoreRopBitsPlain(o,c)
-# define FirstStep(c) Step(c)
-#else /* BITMAP_BIT_ORDER == LSBFirst */
-#if PGSZ == 64
-# define StoreBits(o,c) StorePixels(pdst,o, (cfb8Pixels[c & 0xff]))
-# define StoreRopBits(o,c) StoreRopPixels(pdst,o, \
- (cfb8StippleAnd[c & 0xff]), \
- (cfb8StippleXor[c & 0xff]))
-# define FirstStep(c) c = BitLeft (c, 8);
-#else
-/* 0x3c is 0xf << 2 (4 bits, long word) */
-# define StoreBits(o,c) StorePixels(pdst,o,*((CfbBits *)\
- (((char *) cfb8Pixels) + (c & 0x3c))))
-# define StoreRopBits(o,c) StoreRopPixels(pdst,o, \
- *((CfbBits *) (((char *) cfb8StippleAnd) + (c & 0x3c))), \
- *((CfbBits *) (((char *) cfb8StippleXor) + (c & 0x3c))))
-# define FirstStep(c) c = BitLeft (c, 2);
-#endif /* PGSZ */
-#endif /* BITMAP_BIT_ORDER */
-
- StoreBits0(tmp); FirstStep(tmp);
- StoreBits(1,tmp); Step(tmp);
- StoreBits(2,tmp); Step(tmp);
- StoreBits(3,tmp); Step(tmp);
- StoreBits(4,tmp); Step(tmp);
- StoreBits(5,tmp); Step(tmp);
- StoreBits(6,tmp); Step(tmp);
- StoreBits(7,tmp); EndStep (pdst,8);
- }
-
- /* do rest of middle and partial word on right edge */
-
- if (pixelsRemainingOnRightEdge)
- {
- tmp = BitLeft(bits, leftShift);
-
- if (pixelsRemainingOnRightEdge > rightShift)
- {
- bits = *psrc++;
- tmp |= BitRight (bits, rightShift);
- }
- EndStep (pdst, nl);
- switch (nl)
- {
- case 7:
- StoreBitsPlain(-7,tmp); Step(tmp);
- case 6:
- StoreBitsPlain(-6,tmp); Step(tmp);
- case 5:
- StoreBitsPlain(-5,tmp); Step(tmp);
- case 4:
- StoreBitsPlain(-4,tmp); Step(tmp);
- case 3:
- StoreBitsPlain(-3,tmp); Step(tmp);
- case 2:
- StoreBitsPlain(-2,tmp); Step(tmp);
- case 1:
- StoreBitsPlain(-1,tmp); Step(tmp);
- }
- if (endmask)
- *pdst = (*pdst & ~endmask) | (GetPixelGroup(tmp) & endmask);
- }
- }
- }
- else /* cfb8StippleRRop != GXcopy */
- {
- while (height--)
- { /* one iteration of this loop copies one row */
- psrc = psrcLine;
- pdst = pdstLine;
- psrcLine += widthSrc;
- pdstLine += widthDst;
- bits = *psrc++;
-
- /* do partial word on left edge */
-
- if (startmask)
- {
- if (firstoff < 0)
- tmp = BitRight (bits, -firstoff);
- else
- {
- tmp = BitLeft (bits, firstoff);
- if (firstoff >= (MFB_PPW-PPW))
- {
- bits = *psrc++;
- if (firstoff != (MFB_PPW-PPW))
- tmp |= BitRight (bits, secondoff);
- }
- }
- src = GetBitGroup(tmp);
- *pdst = MaskRRopPixels (*pdst, src, startmask);
- pdst++;
- }
-
- /* do middle of row */
-
- nl = nlMiddle;
- while (nl >= 8)
- {
- nl -= 8;
- tmp = BitLeft(bits, leftShift);
- bits = *psrc++;
- if (rightShift != MFB_PPW)
- tmp |= BitRight(bits, rightShift);
- StoreRopBits0(tmp); FirstStep(tmp);
- StoreRopBits(1,tmp); Step(tmp);
- StoreRopBits(2,tmp); Step(tmp);
- StoreRopBits(3,tmp); Step(tmp);
- StoreRopBits(4,tmp); Step(tmp);
- StoreRopBits(5,tmp); Step(tmp);
- StoreRopBits(6,tmp); Step(tmp);
- StoreRopBits(7,tmp); EndStep(pdst,8);
- }
-
- /* do rest of middle and partial word on right edge */
-
- if (pixelsRemainingOnRightEdge)
- {
- tmp = BitLeft(bits, leftShift);
-
- if (pixelsRemainingOnRightEdge > rightShift)
- {
- bits = *psrc++; /* XXX purify abr here */
- tmp |= BitRight (bits, rightShift);
- }
- while (nl--)
- {
- src = GetBitGroup (tmp);
- *pdst = RRopPixels (*pdst, src);
- pdst++;
- NextBitGroup(tmp);
- }
- if (endmask)
- {
- src = GetBitGroup (tmp);
- *pdst = MaskRRopPixels (*pdst, src, endmask);
- }
- }
- } /* end copy one row */
- } /* end alu is non-copy-mode case */
- } /* end iteration over region boxes */
-}
-
-#else /* PSZ == 8 */
-
-#define mfbmaskbits(x, w, startmask, endmask, nlw) \
- startmask = mfbGetstarttab((x)&0x1f); \
- endmask = mfbGetendtab(((x)+(w)) & 0x1f); \
- if (startmask) \
- nlw = (((w) - (32 - ((x)&0x1f))) >> 5); \
- else \
- nlw = (w) >> 5;
-
-#define mfbmaskpartialbits(x, w, mask) \
- mask = mfbGetpartmasks((x)&0x1f,(w)&0x1f);
-
-#define LeftMost 0
-#define StepBit(bit, inc) ((bit) += (inc))
-
-
-#define GetBits(psrc, nBits, curBit, bitPos, bits) {\
- bits = 0; \
- while (nBits--) \
- { \
- bits |= ((*psrc++ >> bitPos) & 1) << curBit; \
- StepBit (curBit, 1); \
- } \
-}
-
-/******************************************************************/
-
-static void
-#if PSZ == 16
-cfbCopyPlane1to16
-#endif
-#if PSZ == 24
-cfbCopyPlane1to24
-#endif
-#if PSZ == 32
-cfbCopyPlane1to32
-#endif
-(
- DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- int rop,
- RegionPtr prgnDst,
- DDXPointPtr pptSrc,
- unsigned long planemask)
-{
- int srcx, srcy, dstx, dsty;
- int width, height;
- int xoffSrc;
- CfbBits *psrcBase, *pdstBase;
- int widthSrc, widthDst;
- unsigned int *psrcLine;
- register unsigned int *psrc;
-#if PSZ == 16
- unsigned short *pdstLine;
- register unsigned short *pdst;
-#endif
-#if PSZ == 32
- unsigned int *pdstLine;
- register unsigned int *pdst;
-#endif
-#if PSZ == 24
- unsigned char *pdstLine;
- register unsigned char *pdst;
-#endif
- register unsigned int bits, tmp;
- register unsigned int fgpixel, bgpixel;
- register unsigned int src;
-#if PSZ == 24
- register unsigned int dst;
-#endif
- register int leftShift, rightShift;
- register int i, nl;
- int nbox;
- BoxPtr pbox;
- int result;
-
-#if PSZ == 16
- unsigned int doublet[4]; /* Pixel values for 16bpp expansion. */
-#endif
-#if PSZ == 32
- unsigned int doublet[8]; /* Pixel values for 32bpp expansion */
-#endif
-
- fgpixel = FgPixel & planemask;
- bgpixel = BgPixel & planemask;
-
-#if PSZ == 16
- if (rop == GXcopy && (planemask & PMSK) == PMSK) {
- doublet[0] = bgpixel | (bgpixel << 16);
- doublet[1] = fgpixel | (bgpixel << 16);
- doublet[2] = bgpixel | (fgpixel << 16);
- doublet[3] = fgpixel | (fgpixel << 16);
- }
-#endif
-#if PSZ == 32
- if (rop == GXcopy && (planemask & PMSK) == PMSK) {
- doublet[0] = bgpixel; doublet[1] = bgpixel;
- doublet[2] = fgpixel; doublet[3] = bgpixel;
- doublet[4] = bgpixel; doublet[5] = fgpixel;
- doublet[6] = fgpixel; doublet[7] = fgpixel;
- }
-#endif
-
- /* 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
- widthDst <<= 1;
-#endif
-#if PSZ == 24
- widthDst <<= 2;
-#endif
-
- 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 = (unsigned int *)psrcBase + srcy * widthSrc + (srcx >> 5);
-#if PSZ == 16
- pdstLine = (unsigned short *)pdstBase + dsty * widthDst + dstx;
-#endif
-#if PSZ == 24
- pdstLine = (unsigned char *)pdstBase + dsty * widthDst + dstx * 3;
-#endif
-#if PSZ == 32
- pdstLine = (unsigned int *)pdstBase + dsty * widthDst + dstx;
-#endif
- xoffSrc = srcx & 0x1f;
-
- /*
- * compute constants for the first four bits to be
- * copied. This avoids troubles with partial first
- * writes, and difficult shift computation
- */
- leftShift = xoffSrc;
- rightShift = 32 - leftShift;
-
- if (rop == GXcopy && (planemask & PMSK) == PMSK)
- {
- while (height--)
- {
- psrc = psrcLine;
- pdst = pdstLine;
- psrcLine += widthSrc;
- pdstLine += widthDst;
- bits = *psrc++;
- nl = width;
- while (nl >= 32)
- {
- tmp = BitLeft(bits, leftShift);
- bits = *psrc++;
- if (rightShift != 32)
- tmp |= BitRight(bits, rightShift);
- i = 0;
-#if PSZ == 16
- /*
- * I've thrown in some optimization to at least write
- * some aligned 32-bit words instead of 16-bit shorts.
- */
- if ((unsigned long)psrc & 2) {
- /* Write unaligned 16-bit word at left edge. */
- if (tmp & 0x01)
- *pdst = fgpixel;
- else
- *pdst = bgpixel;
- pdst++;
- i++;
- }
- while (i <= 24)
- {
- unsigned tmpbits = tmp >> i;
- *(unsigned int *)pdst = doublet[tmpbits & 0x03];
- *(unsigned int *)(pdst + 2) =
- doublet[(tmpbits >> 2) & 0x03];
- *(unsigned int *)(pdst + 4) =
- doublet[(tmpbits >> 4) & 0x03];
- *(unsigned int *)(pdst + 6) =
- doublet[(tmpbits >> 6) & 0x03];
- pdst += 8; /* Advance four 32-bit words. */
- i += 8;
- }
- while (i <= 30)
- {
- *(unsigned int *)pdst =
- doublet[(tmp >> i) & 0x03];
- pdst += 2; /* Advance one 32-bit word. */
- i += 2;
- }
- if (i == 31) {
- if ((tmp >> 31) & 0x01)
- *pdst = fgpixel;
- else
- *pdst = bgpixel;
- pdst++;
- }
-#endif
-#if PSZ == 24
- while (i < 32) {
- if ((tmp >> i) & 0x01) {
- *pdst = fgpixel;
- *(pdst + 1) = fgpixel >> 8;
- *(pdst + 2) = fgpixel >> 16;
- }
- else {
- *pdst = bgpixel;
- *(pdst + 1) = bgpixel >> 8;
- *(pdst + 2) = bgpixel >> 16;
- }
- pdst += 3;
- i++;
- }
-#endif
-#if PSZ == 32
- while (i <= 28) {
- int pair;
- pair = (tmp >> i) & 0x03;
- *pdst = doublet[pair * 2];
- *(pdst + 1) = doublet[pair * 2 + 1];
- pair = (tmp >> (i + 2)) & 0x03;
- *(pdst + 2) = doublet[pair * 2];
- *(pdst + 3) = doublet[pair * 2 + 1];
- pdst += 4;
- i += 4;
- }
- while (i < 32) {
- *pdst = ((tmp >> i) & 0x01) ? fgpixel : bgpixel;
- pdst++;
- i++;
- }
-#endif
- nl -= 32;
- }
-
- if (nl)
- {
- tmp = BitLeft(bits, leftShift);
- /*
- * better condition needed -- mustn't run
- * off the end of the source...
- */
- if (rightShift != 32)
- {
- bits = *psrc++;
- tmp |= BitRight (bits, rightShift);
- }
- i = 32;
- while (nl--)
- {
- --i;
-#if PSZ == 24
- if ((tmp >> (31 - i)) & 0x01) {
- *pdst = fgpixel;
- *(pdst + 1) = fgpixel >> 8;
- *(pdst + 2) = fgpixel >> 16;
- }
- else {
- *pdst = bgpixel;
- *(pdst + 1) = bgpixel >> 8;
- *(pdst + 2) = bgpixel >> 16;
- }
- pdst += 3;
-#else
- *pdst = ((tmp >> (31 - i)) & 0x01) ? fgpixel : bgpixel;
- pdst++;
-#endif
- }
- }
- }
- }
- else
- {
- while (height--)
- {
- psrc = psrcLine;
- pdst = pdstLine;
- psrcLine += widthSrc;
- pdstLine += widthDst;
- bits = *psrc++;
- nl = width;
- while (nl >= 32)
- {
- tmp = BitLeft(bits, leftShift);
- bits = *psrc++;
- if (rightShift != 32)
- tmp |= BitRight(bits, rightShift);
- i = 32;
- while (i--)
- {
- src = ((tmp >> (31 - i)) & 0x01) ? fgpixel : bgpixel;
-#if PSZ == 24
- dst = *pdst;
- dst |= (*(pdst + 1)) << 8;
- dst |= (*(pdst + 2)) << 16;
- DoRop (result, rop, src, dst);
- *pdst = (dst & ~planemask) |
- (result & planemask);
- *(pdst+1) = ((dst & ~planemask) >> 8) |
- ((result & planemask) >> 8);
- *(pdst+2) = ((dst & ~planemask) >> 16) |
- ((result & planemask) >> 16);
- pdst += 3;
-#else
- DoRop (result, rop, src, *pdst);
-
- *pdst = (*pdst & ~planemask) |
- (result & planemask);
- pdst++;
-#endif
- }
- nl -= 32;
- }
-
- if (nl)
- {
- tmp = BitLeft(bits, leftShift);
- /*
- * better condition needed -- mustn't run
- * off the end of the source...
- */
- if (rightShift != 32)
- {
- bits = *psrc++;
- tmp |= BitRight (bits, rightShift);
- }
- i = 32;
- while (nl--)
- {
- --i;
- src = ((tmp >> (31 - i)) & 0x01) ? fgpixel : bgpixel;
-#if PSZ == 24
- dst = *pdst;
- dst |= (*(pdst + 1)) << 8;
- dst |= (*(pdst + 2)) << 16;
- DoRop (result, rop, src, dst);
- *pdst = (dst & ~planemask) |
- (result & planemask);
- *(pdst+1) = ((dst & ~planemask) >> 8) |
- ((result & planemask) >> 8);
- *(pdst+2) = ((dst & ~planemask) >> 16) |
- ((result & planemask) >> 16);
- pdst += 3;
-#else
- DoRop (result, rop, src, *pdst);
-
- *pdst = (*pdst & ~planemask) |
- (result & planemask);
- pdst++;
-#endif
- }
- }
- }
- }
- }
-}
-
-#endif /* PSZ == 8 */
-
-/* shared among all different cfb depths through linker magic */
-
-RegionPtr cfbCopyPlane(pSrcDrawable, pDstDrawable,
- pGC, srcx, srcy, width, height, dstx, dsty, bitPlane)
- DrawablePtr pSrcDrawable;
- DrawablePtr pDstDrawable;
- GCPtr pGC;
- int srcx, srcy;
- int width, height;
- int dstx, dsty;
- unsigned long bitPlane;
-{
- RegionPtr ret;
-
-#if IMAGE_BYTE_ORDER == LSBFirst
-
- void (*doCopyPlaneExpand)(
- DrawablePtr /*pSrc*/,
- DrawablePtr /*pDst*/,
- int /*alu*/,
- RegionPtr /*prgnDst*/,
- DDXPointPtr /*pptSrc*/,
- unsigned long /*planemask*/);
-
- if (pSrcDrawable->bitsPerPixel == 1 && pDstDrawable->bitsPerPixel == PSZ)
- {
- if (bitPlane == 1)
- {
- doCopyPlaneExpand = cfbCopyPlane1toN;
-#if PSZ == 8
- cfb8CheckOpaqueStipple (pGC->alu,
- pGC->fgPixel, pGC->bgPixel,
- pGC->planemask);
-#else
- FgPixel = pGC->fgPixel;
- BgPixel = pGC->bgPixel;
-#endif
- ret = cfbCopyPlaneExpand (pSrcDrawable, pDstDrawable,
- pGC, srcx, srcy, width, height, dstx, dsty, doCopyPlaneExpand, bitPlane);
- }
- else
- ret = miHandleExposures (pSrcDrawable, pDstDrawable,
- pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
- }
- else if (pSrcDrawable->bitsPerPixel == PSZ && pDstDrawable->bitsPerPixel == 1)
- {
- int oldalu;
-
- oldalu = pGC->alu;
- if ((pGC->fgPixel & 1) == 0 && (pGC->bgPixel&1) == 1)
- pGC->alu = mfbGetInverseAlu(pGC->alu);
- else if ((pGC->fgPixel & 1) == (pGC->bgPixel & 1))
- pGC->alu = mfbReduceRop(pGC->alu, pGC->fgPixel);
- ret = cfbCopyPlaneReduce(pSrcDrawable, pDstDrawable,
- pGC, srcx, srcy, width, height, dstx, dsty,
- cfbCopyPlaneNto1, bitPlane);
- pGC->alu = oldalu;
- }
- else if (pSrcDrawable->bitsPerPixel == PSZ && pDstDrawable->bitsPerPixel == PSZ)
- {
- PixmapPtr pBitmap;
- ScreenPtr pScreen = pSrcDrawable->pScreen;
- GCPtr pGC1;
-
- pBitmap = (*pScreen->CreatePixmap) (pScreen, width, height, 1,
- CREATE_PIXMAP_USAGE_SCRATCH);
- if (!pBitmap)
- return NULL;
- pGC1 = GetScratchGC (1, pScreen);
- if (!pGC1)
- {
- (*pScreen->DestroyPixmap) (pBitmap);
- return NULL;
- }
- /*
- * don't need to set pGC->fgPixel,bgPixel as copyPlaneNto1
- * ignores pixel values, expecting the rop to "do the
- * right thing", which GXcopy will.
- */
- ValidateGC ((DrawablePtr) pBitmap, pGC1);
- /* no exposures here, scratch GC's don't get graphics expose */
- cfbCopyPlaneReduce(pSrcDrawable, (DrawablePtr) pBitmap,
- pGC1, srcx, srcy, width, height, 0, 0,
- cfbCopyPlaneNto1, bitPlane);
-#if PSZ == 8
- cfb8CheckOpaqueStipple (pGC->alu,
- pGC->fgPixel, pGC->bgPixel,
- pGC->planemask);
-#else
- FgPixel = pGC->fgPixel;
- BgPixel = pGC->bgPixel;
-#endif
- /* no exposures here, copy bits from inside a pixmap */
- cfbCopyPlaneExpand((DrawablePtr) pBitmap, pDstDrawable, pGC,
- 0, 0, width, height, dstx, dsty, cfbCopyPlane1toN, 1);
- FreeScratchGC (pGC1);
- (*pScreen->DestroyPixmap) (pBitmap);
- /* compute resultant exposures */
- ret = miHandleExposures (pSrcDrawable, pDstDrawable, pGC,
- srcx, srcy, width, height,
- dstx, dsty, bitPlane);
- }
- else
-#endif
- ret = miCopyPlane (pSrcDrawable, pDstDrawable,
- pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
- return ret;
-}
-
-
diff --git a/cfb/cfbblt.c b/cfb/cfbblt.c
deleted file mode 100644
index ff34589ff..000000000
--- a/cfb/cfbblt.c
+++ /dev/null
@@ -1,933 +0,0 @@
-/*
- * cfb copy area
- */
-
-/*
-
-Copyright 1989, 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
-
-*/
-
-/* 24-bit bug fixes: Peter Wainwright, 1998/11/28 */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <X11/Xproto.h>
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "regionstr.h"
-#include "cfb.h"
-#include "cfbmskbits.h"
-#include "cfb8bit.h"
-#include "fastblt.h"
-#include "mergerop.h"
-
-#ifdef notdef /* XXX fails right now, walks off end of pixmaps */
-#if defined (FAST_UNALIGNED_READS) && PSZ == 8
-#define DO_UNALIGNED_BITBLT
-#endif
-#endif
-
-#if defined(FAST_MEMCPY) && (MROP == Mcopy) && PSZ == 8
-#define DO_MEMCPY
-#endif
-
-/* ................................................. */
-/* SPECIAL CODE FOR 24 BITS by Peter Wainwright */
-
-#if PSZ == 24 && (MROP) == 0
-
-/* The default macros are defined in mergerop.h, and none of them are
- really appropriate for what we want to do.
-
- There are two ways of fixing this: either define SLOW_24BIT_COPY
- to copy pixel by pixel, or (by default) use the following macros
- modified from mergerop.h
-
- MROP_SOLID and MROP_MASK are defined for each of the operations,
- i.e. each value of MROP.
-
- There are special cases for Mcopy, McopyInverted, Mxor, and Mor.
- There is a completely generic version for MROP=0, and a simplified
- generic version which works for (Mcopy|Mxor|MandReverse|Mor).
-
- However, the generic version does not work for the 24-bit case
- because the pixels cannot be packed exactly into a machine word (32
- bits).
-
- Alternative macros MROP_SOLID24 and MROP_MASK24 are provided for
- the 24-bit case. However, these each copy a single *pixel*, not a
- single machine word. They take an rvalue source pixel, an lvalue
- destination, and the pixel index. The latter is used to find the
- position of the pixel data within the two words *dst and *(dst+1).
-
- Further macros MROP_SOLID24P and MROP_MASK24P are used to copy from
- an lvalue source to an lvalue destination. MROP_PIXEL24 is used to
- assemble the source pixel from the adjacent words *src and
- *(src+1), and this is then split between the destination words
- using the non-P macros above.
-
- But we want to copy entire words for the sake of efficiency.
- Unfortunately if a plane mask is specified this must be shifted
- from one word to the next. Fortunately the pattern repeats after 3
- words, so we unroll the planemask here and redefine MROP_SOLID
- and MROP_MASK. */
-
-
-#endif /* MROP == 0 && PSZ == 24 */
-
-/* ................................................. */
-
-#if PSZ == 24
-#define BYPP 3
-#if PGSZ == 32
-#define P3W 4 /* pixels in 3 machine words */
-#define PAM 3 /* pixel align mask; PAM = P3W -1 */
-#define P2WSH 2
-#else
-#define P3W 8 /* pixels in 3 machine words */
-#define PAM 7 /* pixel align mask; PAM = P3W -1 */
-#define P2WSH 3
-#endif
-#endif
-
-void
-MROP_NAME(cfbDoBitblt)(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- int alu,
- RegionPtr prgnDst,
- DDXPointPtr pptSrc,
- unsigned long planemask)
-{
- CfbBits *psrcBase, *pdstBase;
- /* start of src and dst bitmaps */
- int widthSrc, widthDst; /* add to get to same position in next line */
-
- BoxPtr pbox;
- int nbox;
-
- BoxPtr pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2;
- /* temporaries for shuffling rectangles */
- DDXPointPtr pptTmp, pptNew1, pptNew2;
- /* shuffling boxes entails shuffling the
- source points too */
- int w, h;
- int xdir; /* 1 = left right, -1 = right left/ */
- int ydir; /* 1 = top down, -1 = bottom up */
-
- CfbBits *psrcLine, *pdstLine;
- /* pointers to line with current src and dst */
- register CfbBits *psrc;/* pointer to current src longword */
- register CfbBits *pdst;/* pointer to current dst longword */
-
- MROP_DECLARE_REG()
-
- /* following used for looping through a line */
- CfbBits startmask, endmask; /* masks for writing ends of dst */
- int nlMiddle; /* whole longwords in dst */
- int xoffSrc, xoffDst;
- register int nl; /* temp copy of nlMiddle */
- int careful;
-
-#if (PSZ != 24) || (MROP != 0)
- register int leftShift, rightShift;
- register CfbBits bits;
- register CfbBits bits1;
-#endif
-
-#if PSZ == 24
-#ifdef DO_MEMCPY
- int w2;
-#endif
-
-#if MROP == 0
- int widthSrcBytes = cfbGetByteWidth(pSrc);
- int widthDstBytes = cfbGetByteWidth(pDst);
-#endif
-#endif
-
- MROP_INITIALIZE(alu,planemask)
-
- cfbGetLongWidthAndPointer (pSrc, widthSrc, psrcBase)
-
- cfbGetLongWidthAndPointer (pDst, widthDst, pdstBase)
-
- /* XXX we have to err on the side of safety when both are windows,
- * because we don't know if IncludeInferiors is being used.
- */
- careful = ((pSrc == pDst) ||
- ((pSrc->type == DRAWABLE_WINDOW) &&
- (pDst->type == DRAWABLE_WINDOW)));
-
- pbox = REGION_RECTS(prgnDst);
- nbox = REGION_NUM_RECTS(prgnDst);
-
- pboxNew1 = NULL;
- pptNew1 = NULL;
- pboxNew2 = NULL;
- pptNew2 = NULL;
- if (careful && (pptSrc->y < pbox->y1))
- {
- /* walk source botttom to top */
- ydir = -1;
- widthSrc = -widthSrc;
- widthDst = -widthDst;
-
- if (nbox > 1)
- {
- /* keep ordering in each band, reverse order of bands */
- pboxNew1 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
- if(!pboxNew1)
- return;
- pptNew1 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
- if(!pptNew1)
- {
- xfree(pboxNew1);
- return;
- }
- pboxBase = pboxNext = pbox+nbox-1;
- while (pboxBase >= pbox)
- {
- while ((pboxNext >= pbox) &&
- (pboxBase->y1 == pboxNext->y1))
- pboxNext--;
- pboxTmp = pboxNext+1;
- pptTmp = pptSrc + (pboxTmp - pbox);
- while (pboxTmp <= pboxBase)
- {
- *pboxNew1++ = *pboxTmp++;
- *pptNew1++ = *pptTmp++;
- }
- pboxBase = pboxNext;
- }
- pboxNew1 -= nbox;
- pbox = pboxNew1;
- pptNew1 -= nbox;
- pptSrc = pptNew1;
- }
- }
- else
- {
- /* walk source top to bottom */
- ydir = 1;
- }
-
- if (careful && (pptSrc->x < pbox->x1))
- {
- /* walk source right to left */
- xdir = -1;
-
- if (nbox > 1)
- {
- /* reverse order of rects in each band */
- pboxNew2 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
- pptNew2 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
- if(!pboxNew2 || !pptNew2)
- {
- if (pptNew2) xfree(pptNew2);
- if (pboxNew2) xfree(pboxNew2);
- if (pboxNew1)
- {
- xfree(pptNew1);
- xfree(pboxNew1);
- }
- return;
- }
- pboxBase = pboxNext = pbox;
- while (pboxBase < pbox+nbox)
- {
- while ((pboxNext < pbox+nbox) &&
- (pboxNext->y1 == pboxBase->y1))
- pboxNext++;
- pboxTmp = pboxNext;
- pptTmp = pptSrc + (pboxTmp - pbox);
- while (pboxTmp != pboxBase)
- {
- *pboxNew2++ = *--pboxTmp;
- *pptNew2++ = *--pptTmp;
- }
- pboxBase = pboxNext;
- }
- pboxNew2 -= nbox;
- pbox = pboxNew2;
- pptNew2 -= nbox;
- pptSrc = pptNew2;
- }
- }
- else
- {
- /* walk source left to right */
- xdir = 1;
- }
-
- while(nbox--)
- {
- w = pbox->x2 - pbox->x1;
- h = pbox->y2 - pbox->y1;
-
-#if PSZ == 24
-#ifdef DO_MEMCPY
- w2 = w * BYPP;
-#endif
-#endif
- if (ydir == -1) /* start at last scanline of rectangle */
- {
- psrcLine = psrcBase + ((pptSrc->y+h-1) * -widthSrc);
- pdstLine = pdstBase + ((pbox->y2-1) * -widthDst);
- }
- else /* start at first scanline */
- {
- psrcLine = psrcBase + (pptSrc->y * widthSrc);
- pdstLine = pdstBase + (pbox->y1 * widthDst);
- }
-#if PSZ == 24
- if (w == 1 && ((pbox->x1 & PAM) == 0 || (pbox->x1 & PAM) == PAM))
-#else
- if ((pbox->x1 & PIM) + w <= PPW)
-#endif
- {
- maskpartialbits (pbox->x1, w, endmask);
- startmask = 0;
- nlMiddle = 0;
- }
- else
- {
- maskbits(pbox->x1, w, startmask, endmask, nlMiddle);
- }
-
-#if PSZ == 24
-#if 0
- nlMiddle = w - (pbox->x2 &PAM);;
- if(pbox->x1 & PAM){
- nlMiddle -= (PAM+1 - (pbox->x1 &PAM));
- }
- nlMiddle >>= P2WSH;
- if(nlMiddle < 0)
- nlMiddle = 0;
-#endif
-#endif
-
-#ifdef DO_MEMCPY
- /* If the src and dst scanline don't overlap, do forward case. */
-
- if ((xdir == 1) || (pptSrc->y != pbox->y1)
- || (pptSrc->x + w <= pbox->x1))
- {
-#if PSZ == 24
- char *psrc = (char *) psrcLine + (pptSrc->x * BYPP);
- char *pdst = (char *) pdstLine + (pbox->x1 * BYPP);
-#else
- char *psrc = (char *) psrcLine + pptSrc->x;
- char *pdst = (char *) pdstLine + pbox->x1;
-#endif
- while (h--)
- {
-#if PSZ == 24
- memcpy(pdst, psrc, w2);
-#else
- memcpy(pdst, psrc, w);
-#endif
- pdst += widthDst << PWSH;
- psrc += widthSrc << PWSH;
- }
- }
-#else /* ! DO_MEMCPY */
- if (xdir == 1)
- {
-#if PSZ == 24 && MROP == 0
- /* Note: x is a pixel number; the byte offset is 3*x;
- therefore the offset within a word is (3*x) & 3 ==
- (4*x-x) & 3 == (-x) & 3. The offsets therefore
- DECREASE by 1 for each pixel.
- */
- xoffSrc = ( - pptSrc->x) & PAM;
- xoffDst = ( - pbox->x1) & PAM;
-#if 1
- if((int)xoffSrc != (int)xoffDst /* Alignments must be same. */
- || ((widthDstBytes & PAM) != (widthSrcBytes & PAM) && h > 1))
-#else
- if(1)
-#endif
- /* Width also must be same, if hight > 1 */
- {
- /* ...otherwise, pixel by pixel operation */
- while (h--)
- {
- register int i, si, sii, di;
-
- for (i = 0, si = pptSrc->x, di = pbox->x1;
- i < w;
- i++, si++, di++) {
- psrc = psrcLine + ((si * BYPP) >> P2WSH);
- pdst = pdstLine + ((di * BYPP) >> P2WSH);
- sii = (si & 3);
- MROP_SOLID24P(psrc, pdst, sii, di);
- }
- pdstLine += widthDst;
- psrcLine += widthSrc;
- }
- }
- else
-#endif
- {
-
-#if PSZ == 24
-
-#if MROP != 0
- xoffSrc = ( - pptSrc->x) & PAM;
- xoffDst = ( - pbox->x1) & PAM;
-#endif
- pdstLine += (pbox->x1 * BYPP) >> P2WSH;
- psrcLine += (pptSrc->x * BYPP) >> P2WSH;
-#else
- xoffSrc = pptSrc->x & PIM;
- xoffDst = pbox->x1 & PIM;
- pdstLine += (pbox->x1 >> PWSH);
- psrcLine += (pptSrc->x >> PWSH);
-#endif
-#ifdef DO_UNALIGNED_BITBLT
- nl = xoffSrc - xoffDst;
- psrcLine = (CfbBits *)
- (((unsigned char *) psrcLine) + nl);
-#else
-#if PSZ == 24 && MROP == 0
- /* alredy satisfied */
-#else
- if (xoffSrc == xoffDst)
-#endif
-#endif
- {
- while (h--)
- {
-#if PSZ == 24 && MROP == 0
- register int index;
- register int im3;
-#endif /* PSZ == 24 && MROP == 0 */
- psrc = psrcLine;
- pdst = pdstLine;
- pdstLine += widthDst;
- psrcLine += widthSrc;
-#if PSZ == 24 && MROP == 0
- index = (int)(pdst - pdstBase);
- im3 = index % 3;
-#endif /* PSZ == 24 && MROP == 0 */
- if (startmask)
- {
-#if PSZ == 24 && MROP == 0
- *pdst = DoMaskMergeRop24u(*psrc, *pdst, startmask, im3);
- index++;
- im3 = index % 3;
-#else /* PSZ != 24 || MROP != 0 */
- *pdst = MROP_MASK(*psrc, *pdst, startmask);
-#endif /* PSZ == 24 && MROP == 0 */
- psrc++;
- pdst++;
- }
-
- nl = nlMiddle;
-#ifdef LARGE_INSTRUCTION_CACHE
-#ifdef FAST_CONSTANT_OFFSET_MODE
-
- psrc += nl & (UNROLL-1);
- pdst += nl & (UNROLL-1);
-
-#if PSZ == 24 && MROP == 0
-#define BodyOdd(n) pdst[-n] = DoMergeRop24u(psrc[-n], pdst[-n], ((int)(pdst - n - pdstBase))%3);
-#define BodyEven(n) pdst[-n] = DoMergeRop24u(psrc[-n], pdst[-n], ((int)(pdst - n - pdstBase))%3);
-#else /* PSZ != 24 || MROP != 0 */
-#define BodyOdd(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]);
-#define BodyEven(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]);
-#endif /* PSZ == 24 && MROP == 0 */
-
-#define LoopReset \
-pdst += UNROLL; \
-psrc += UNROLL;
-
-#else
-
-#if PSZ == 24 && MROP == 0
-#define BodyOdd(n) *pdst = DoMergeRop24u(*psrc, *pdst, im3); pdst++; psrc++; index++; im3 = index % 3;
-#define BodyEven(n) BodyOdd(n)
-#else /* PSZ != 24 || MROP != 0 */
-#define BodyOdd(n) *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++;
-#define BodyEven(n) BodyOdd(n)
-#endif /* PSZ == 24 && MROP == 0 */
-
-#define LoopReset ;
-
-#endif
- PackedLoop
-
-#undef BodyOdd
-#undef BodyEven
-#undef LoopReset
-
-#else
-#ifdef NOTDEF
- /* you'd think this would be faster --
- * a single instruction instead of 6
- * but measurements show it to be ~15% slower
- */
- while ((nl -= 6) >= 0)
- {
- asm ("moveml %1+,#0x0c0f;moveml#0x0c0f,%0"
- : "=m" (*(char *)pdst)
- : "m" (*(char *)psrc)
- : "d0", "d1", "d2", "d3",
- "a2", "a3");
- pdst += 6;
- }
- nl += 6;
- while (nl--)
- *pdst++ = *psrc++;
-#endif
-#if 0 /*PSZ == 24 && MROP == 0*/
- DuffL(nl, label1,
- *pdst = DoMergeRop24u(*psrc, *pdst, im3);
- pdst++; psrc++; index++;im3 = index % 3;)
-#else /* !(PSZ == 24 && MROP == 0) */
- DuffL(nl, label1,
- *pdst = MROP_SOLID (*psrc, *pdst);
- pdst++; psrc++;)
-#endif /* PSZ == 24 && MROP == 0 */
-#endif
-
- if (endmask)
-#if PSZ == 24 && MROP == 0
- *pdst = DoMaskMergeRop24u(*psrc, *pdst, endmask, (int)(pdst - pdstBase) % 3);
-#else /* !(PSZ == 24 && MROP == 0) */
- *pdst = MROP_MASK(*psrc, *pdst, endmask);
-#endif /* PSZ == 24 && MROP == 0 */
- }
- }
-#ifndef DO_UNALIGNED_BITBLT
-#if PSZ == 24 && MROP == 0
- /* can not happen */
-#else /* !(PSZ == 24 && MROP == 0) */
- else /* xoffSrc != xoffDst */
- {
- if (xoffSrc > xoffDst)
- {
-#if PSZ == 24
- leftShift = (xoffSrc - xoffDst) << 3;
-#else
-#if PGSZ == 32
- leftShift = (xoffSrc - xoffDst) << (5 - PWSH);
-#else /* PGSZ == 64 */
- leftShift = (xoffSrc - xoffDst) << (6 - PWSH);
-#endif /* PGSZ */
-#endif
- rightShift = PGSZ - leftShift;
- }
- else
- {
-#if PSZ == 24
- rightShift = (xoffDst - xoffSrc) << 3;
-#else
-#if PGSZ == 32
- rightShift = (xoffDst - xoffSrc) << (5 - PWSH);
-#else /* PGSZ == 64 */
- rightShift = (xoffDst - xoffSrc) << (6 - PWSH);
-#endif /* PGSZ */
-#endif
- leftShift = PGSZ - rightShift;
- }
- while (h--)
- {
- psrc = psrcLine;
- pdst = pdstLine;
- pdstLine += widthDst;
- psrcLine += widthSrc;
- bits = 0;
- if (xoffSrc > xoffDst)
- bits = *psrc++;
- if (startmask)
- {
- bits1 = BitLeft(bits,leftShift);
- bits = *psrc++;
- bits1 |= BitRight(bits,rightShift);
- *pdst = MROP_MASK(bits1, *pdst, startmask);
- pdst++;
- }
- nl = nlMiddle;
-#ifdef LARGE_INSTRUCTION_CACHE
- bits1 = bits;
-
-#ifdef FAST_CONSTANT_OFFSET_MODE
-
- psrc += nl & (UNROLL-1);
- pdst += nl & (UNROLL-1);
-
-#define BodyOdd(n) \
-bits = psrc[-n]; \
-pdst[-n] = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), pdst[-n]);
-
-#define BodyEven(n) \
-bits1 = psrc[-n]; \
-pdst[-n] = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), pdst[-n]);
-
-#define LoopReset \
-pdst += UNROLL; \
-psrc += UNROLL;
-
-#else
-
-#define BodyOdd(n) \
-bits = *psrc++; \
-*pdst = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), *pdst); \
-pdst++;
-
-#define BodyEven(n) \
-bits1 = *psrc++; \
-*pdst = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), *pdst); \
-pdst++;
-
-#define LoopReset ;
-
-#endif /* !FAST_CONSTANT_OFFSET_MODE */
-
- PackedLoop
-
-#undef BodyOdd
-#undef BodyEven
-#undef LoopReset
-
-#else
- DuffL (nl,label2,
- bits1 = BitLeft(bits, leftShift);
- bits = *psrc++;
- *pdst = MROP_SOLID (bits1 | BitRight(bits, rightShift), *pdst);
- pdst++;
- )
-#endif
-
- if (endmask)
- {
- bits1 = BitLeft(bits, leftShift);
- if (BitLeft(endmask, rightShift))
- {
- bits = *psrc;
- bits1 |= BitRight(bits, rightShift);
- }
- *pdst = MROP_MASK (bits1, *pdst, endmask);
- }
- }
- }
-#endif /* (PSZ == 24 && MROP == 0) */
-#endif /* DO_UNALIGNED_BITBLT */
-
- }
- }
-#endif /* ! DO_MEMCPY */
- else /* xdir == -1 */
- {
-#if PSZ == 24 && MROP == 0
- xoffSrc = (-(pptSrc->x + w)) & PAM;
- xoffDst = (-pbox->x2) & PAM;
-#if 1
- if(xoffSrc != xoffDst /* Alignments must be same. */
- || ((widthDstBytes & PAM) != (widthSrcBytes & PAM) && h > 1))
-#else
- if(1)
-#endif
- /* Width also must be same, if hight > 1 */
- {
- /* ...otherwise, pixel by pixel operation */
- while (h--)
- {
- register int i, si, sii, di;
-
- for (i = 0, si = pptSrc->x + w - 1, di = pbox->x2 - 1;
- i < w;
- i++, si--, di--) {
- psrc = psrcLine + ((si * BYPP) >> P2WSH);
- pdst = pdstLine + ((di * BYPP) >> P2WSH);
- sii = (si & PAM);
- MROP_SOLID24P(psrc, pdst, sii, di);
- }
- psrcLine += widthSrc;
- pdstLine += widthDst;
- }
- }else
-#endif /* MROP == 0 && PSZ == 24 */
- {
-
-#if PSZ == 24
-#if MROP == 0
- /* already calculated */
-#else
- xoffSrc = (pptSrc->x + w) & PAM;
- xoffDst = pbox->x2 & PAM;
-#endif
- pdstLine += ((pbox->x2 * BYPP - 1) >> P2WSH) + 1;
- psrcLine += (((pptSrc->x+w) * BYPP - 1) >> P2WSH) + 1;
-#else
- xoffSrc = (pptSrc->x + w - 1) & PIM;
- xoffDst = (pbox->x2 - 1) & PIM;
- pdstLine += ((pbox->x2-1) >> PWSH) + 1;
- psrcLine += ((pptSrc->x+w - 1) >> PWSH) + 1;
-#endif
-#ifdef DO_UNALIGNED_BITBLT
-#if PSZ == 24
- nl = xoffDst - xoffSrc;
-#else
- nl = xoffSrc - xoffDst;
-#endif
- psrcLine = (CfbBits *)
- (((unsigned char *) psrcLine) + nl);
-#else
-#if PSZ == 24 && MROP == 0
- /* already satisfied */
-#else
- if (xoffSrc == xoffDst)
-#endif
-#endif
- {
- while (h--)
- {
-#if PSZ == 24 && MROP == 0
- register int index;
- register int im3;
-#endif /* PSZ == 24 && MROP == 0 */
- psrc = psrcLine;
- pdst = pdstLine;
- pdstLine += widthDst;
- psrcLine += widthSrc;
-#if PSZ == 24 && MROP == 0
- index = (int)(pdst - pdstBase);
-#endif /* PSZ == 24 && MROP == 0 */
-
- if (endmask)
- {
- pdst--;
- psrc--;
-#if PSZ == 24 && MROP == 0
- index--;
- im3 = index % 3;
- *pdst = DoMaskMergeRop24u(*psrc, *pdst, endmask, im3);
-#else /* !(PSZ == 24 && MROP == 0) */
- *pdst = MROP_MASK (*psrc, *pdst, endmask);
-#endif /* PSZ == 24 && MROP == 0 */
- }
- nl = nlMiddle;
-#ifdef LARGE_INSTRUCTION_CACHE
-#ifdef FAST_CONSTANT_OFFSET_MODE
- psrc -= nl & (UNROLL - 1);
- pdst -= nl & (UNROLL - 1);
-
-#if PSZ == 24 && MROP == 0
-#define BodyOdd(n) pdst[n-1] = DoMergeRop24u(psrc[n-1], pdst[n-1], ((int)(pdst - (n - 1) -pdstBase)) % 3);
-#else /* !(PSZ == 24 && MROP == 0) */
-#define BodyOdd(n) pdst[n-1] = MROP_SOLID (psrc[n-1], pdst[n-1]);
-#endif /* PSZ == 24 && MROP == 0 */
-
-#define BodyEven(n) BodyOdd(n)
-
-#define LoopReset \
-pdst -= UNROLL;\
-psrc -= UNROLL;
-
-#else
-
-#if PSZ == 24 && MROP == 0
-#define BodyOdd(n) --pdst; --psrc; --index; im3 = index % 3;*pdst = DoMergeRop24u(*psrc, *pdst, im3);
-#else /* !(PSZ == 24 && MROP == 0) */
-#define BodyOdd(n) --pdst; --psrc; *pdst = MROP_SOLID(*psrc, *pdst);
-#endif /* PSZ == 24 && MROP == 0 */
-#define BodyEven(n) BodyOdd(n)
-#define LoopReset ;
-
-#endif
- PackedLoop
-
-#undef BodyOdd
-#undef BodyEven
-#undef LoopReset
-
-#else
-#if PSZ == 24 && MROP == 0
- DuffL(nl,label3,
- --pdst; --psrc; --index; im3= index%3;*pdst = DoMergeRop24u(*psrc, *pdst, im3);)
-#else /* !(PSZ == 24 && MROP == 0) */
- DuffL(nl,label3,
- --pdst; --psrc; *pdst = MROP_SOLID (*psrc, *pdst);)
-#endif /* PSZ == 24 && MROP == 0 */
-#endif
-
- if (startmask)
- {
- --pdst;
- --psrc;
-#if PSZ == 24 && MROP == 0
- *pdst = DoMaskMergeRop24u(*psrc, *pdst, startmask, (int)(pdst - pdstBase) % 3);
-#else /* !(PSZ == 24 && MROP == 0) */
- *pdst = MROP_MASK(*psrc, *pdst, startmask);
-#endif /* PSZ == 24 && MROP == 0 */
- }
- }
- }
-#ifndef DO_UNALIGNED_BITBLT
-#if PSZ == 24 && MROP == 0
- /* can not happen */
-#else /* !( PSZ == 24 && MROP == 0) */
- else
- {
- if (xoffDst > xoffSrc)
- {
-#if PSZ == 24
- leftShift = (xoffDst - xoffSrc) << 3;
- rightShift = PGSZ - leftShift;
-#else
-#if PGSZ == 32
- rightShift = (xoffDst - xoffSrc) << (5 - PWSH);
-#else /* PGSZ == 64 */
- rightShift = (xoffDst - xoffSrc) << (6 - PWSH);
-#endif /* PGSZ */
- leftShift = PGSZ - rightShift;
-#endif
- }
- else
- {
-#if PSZ == 24
- rightShift = (xoffSrc - xoffDst) << 3;
- leftShift = PGSZ - rightShift;
-#else
-#if PGSZ == 32
- leftShift = (xoffSrc - xoffDst) << (5 - PWSH);
-#else /* PGSZ == 64 */
- leftShift = (xoffSrc - xoffDst) << (6 - PWSH);
-#endif /* PGSZ */
- rightShift = PGSZ - leftShift;
-#endif
- }
- while (h--)
- {
- psrc = psrcLine;
- pdst = pdstLine;
- pdstLine += widthDst;
- psrcLine += widthSrc;
- bits = 0;
-#if PSZ == 24
- if (xoffSrc > xoffDst)
-#else
- if (xoffDst > xoffSrc)
-#endif
- bits = *--psrc;
- if (endmask)
- {
- bits1 = BitRight(bits, rightShift);
- bits = *--psrc;
- bits1 |= BitLeft(bits, leftShift);
- pdst--;
- *pdst = MROP_MASK(bits1, *pdst, endmask);
- }
- nl = nlMiddle;
-#ifdef LARGE_INSTRUCTION_CACHE
- bits1 = bits;
-#ifdef FAST_CONSTANT_OFFSET_MODE
- psrc -= nl & (UNROLL - 1);
- pdst -= nl & (UNROLL - 1);
-
-#define BodyOdd(n) \
-bits = psrc[n-1]; \
-pdst[n-1] = MROP_SOLID(BitRight(bits1, rightShift) | BitLeft(bits, leftShift),pdst[n-1]);
-
-#define BodyEven(n) \
-bits1 = psrc[n-1]; \
-pdst[n-1] = MROP_SOLID(BitRight(bits, rightShift) | BitLeft(bits1, leftShift),pdst[n-1]);
-
-#define LoopReset \
-pdst -= UNROLL; \
-psrc -= UNROLL;
-
-#else
-
-#define BodyOdd(n) \
-bits = *--psrc; --pdst; \
-*pdst = MROP_SOLID(BitRight(bits1, rightShift) | BitLeft(bits, leftShift),*pdst);
-
-#define BodyEven(n) \
-bits1 = *--psrc; --pdst; \
-*pdst = MROP_SOLID(BitRight(bits, rightShift) | BitLeft(bits1, leftShift),*pdst);
-
-#define LoopReset ;
-
-#endif
-
- PackedLoop
-
-#undef BodyOdd
-#undef BodyEven
-#undef LoopReset
-
-#else
- DuffL (nl, label4,
- bits1 = BitRight(bits, rightShift);
- bits = *--psrc;
- --pdst;
- *pdst = MROP_SOLID(bits1 | BitLeft(bits, leftShift),*pdst);
- )
-#endif
-
- if (startmask)
- {
- bits1 = BitRight(bits, rightShift);
- if (BitRight (startmask, leftShift))
- {
- bits = *--psrc;
- bits1 |= BitLeft(bits, leftShift);
- }
- --pdst;
- *pdst = MROP_MASK(bits1, *pdst, startmask);
- }
- }
- }
-#endif /* PSZ == 24 && MROP == 0 */
-#endif
- }
- }
- pbox++;
- pptSrc++;
- }
- if (pboxNew2)
- {
- xfree(pptNew2);
- xfree(pboxNew2);
- }
- if (pboxNew1)
- {
- xfree(pptNew1);
- xfree(pboxNew1);
- }
-}
diff --git a/cfb/cfbbres.c b/cfb/cfbbres.c
deleted file mode 100644
index fa1ee1379..000000000
--- a/cfb/cfbbres.c
+++ /dev/null
@@ -1,340 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 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.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include "misc.h"
-#include "cfb.h"
-#include "cfbmskbits.h"
-#include "servermd.h"
-#include "miline.h"
-
-/* Solid bresenham line */
-/* NOTES
- e2 is used less often than e1, so it's not in a register
-*/
-
-void
-cfbBresS(rop, and, xor, addrl, nlwidth, signdx, signdy, axis, x1, y1, e, e1,
- e2, len)
- int rop;
- CfbBits and, xor;
- CfbBits *addrl; /* pointer to base of bitmap */
- int nlwidth; /* width in longwords of bitmap */
- register int signdx;
- int signdy; /* signs of directions */
- int axis; /* major axis (Y_AXIS or X_AXIS) */
- int x1, y1; /* initial point */
- register int e; /* error accumulator */
- register int e1; /* bresenham increments */
- int e2;
- int len; /* length of line */
-{
- register int e3 = e2-e1;
-#if PSZ == 24
- CfbBits piQxelXor[3],piQxelAnd[3];
- char *addrb;
- int nlwidth3, signdx3;
-#endif
-#ifdef PIXEL_ADDR
- register PixelType *addrp; /* Pixel pointer */
-
- if (len == 0)
- return;
- /* point to first point */
- nlwidth <<= PWSH;
-#if PSZ == 24
- addrp = (PixelType *)(addrl) + (y1 * nlwidth);
- addrb = (char *)addrp + x1 * 3;
-
- piQxelXor[0] = (xor << 24) | xor;
- piQxelXor[1] = (xor << 16)| (xor >> 8);
- piQxelXor[2] = (xor << 8) | (xor >> 16);
- piQxelAnd[0] = (and << 24) | and;
- piQxelAnd[1] = (and << 16)| (and >> 8);
- piQxelAnd[2] = (and << 8) | (and >> 16);
-#else
- addrp = (PixelType *)(addrl) + (y1 * nlwidth) + x1;
-#endif
- if (signdy < 0)
- nlwidth = -nlwidth;
- e = e-e1; /* to make looping easier */
-#if PSZ == 24
- nlwidth3 = nlwidth * sizeof (CfbBits);
- signdx3 = signdx * 3;
-#endif
-
- if (axis == Y_AXIS)
- {
- int t;
-
- t = nlwidth;
- nlwidth = signdx;
- signdx = t;
-#if PSZ == 24
- t = nlwidth3;
- nlwidth3 = signdx3;
- signdx3 = t;
-#endif
- }
- if (rop == GXcopy)
- {
- --len;
-#if PSZ == 24
-#define body_copy \
- addrp = (PixelType *)((unsigned long)addrb & ~0x03); \
- switch((unsigned long)addrb & 3){ \
- case 0: \
- *addrp = ((*addrp)&0xFF000000)|(piQxelXor[0] & 0xFFFFFF); \
- break; \
- case 1: \
- *addrp = ((*addrp)&0xFF)|(piQxelXor[2] & 0xFFFFFF00); \
- break; \
- case 3: \
- *addrp = ((*addrp)&0xFFFFFF)|(piQxelXor[0] & 0xFF000000); \
- *(addrp+1) = ((*(addrp+1))&0xFFFF0000)|(piQxelXor[1] & 0xFFFF); \
- break; \
- case 2: \
- *addrp = ((*addrp)&0xFFFF)|(piQxelXor[1] & 0xFFFF0000); \
- *(addrp+1) = ((*(addrp+1))&0xFFFFFF00)|(piQxelXor[2] & 0xFF); \
- break; \
- }
-#define body {\
- body_copy \
- addrb += signdx3; \
- e += e1; \
- if (e >= 0) \
- { \
- addrb += nlwidth3; \
- e += e3; \
- } \
- }
-#else /* PSZ == 24 */
-#define body {\
- *addrp = xor; \
- addrp += signdx; \
- e += e1; \
- if (e >= 0) \
- { \
- addrp += nlwidth; \
- e += e3; \
- } \
- }
-#endif /* PSZ == 24 */
- while (len >= 4)
- {
- body body body body
- len -= 4;
- }
- switch (len)
- {
- case 3: body case 2: body case 1: body
- }
-#undef body
-#if PSZ == 24
- body_copy
-# undef body_copy
-#else
- *addrp = xor;
-#endif
- }
- else /* not GXcopy */
- {
- while(len--)
- {
-#if PSZ == 24
- addrp = (PixelType *)((unsigned long)addrb & ~0x03);
- switch((unsigned long)addrb & 3){
- case 0:
- *addrp = (*addrp & (piQxelAnd[0]|0xFF000000))
- ^ (piQxelXor[0] & 0xFFFFFF);
- break;
- case 1:
- *addrp = (*addrp & (piQxelAnd[2]|0xFF))
- ^ (piQxelXor[2] & 0xFFFFFF00);
- break;
- case 3:
- *addrp = (*addrp & (piQxelAnd[0]|0xFFFFFF))
- ^ (piQxelXor[0] & 0xFF000000);
- *(addrp+1) = (*(addrp+1) & (piQxelAnd[1]|0xFFFF0000))
- ^ (piQxelXor[1] & 0xFFFF);
- break;
- case 2:
- *addrp = (*addrp & (piQxelAnd[1]|0xFFFF))
- ^ (piQxelXor[1] & 0xFFFF0000);
- *(addrp+1) = (*(addrp+1) & (piQxelAnd[2]|0xFFFFFF00))
- ^ (piQxelXor[2] & 0xFF);
- break;
- }
- e += e1;
- if (e >= 0)
- {
- addrb += nlwidth3;
- e += e3;
- }
- addrb += signdx3;
-#else /* PSZ == 24 */
- *addrp = DoRRop (*addrp, and, xor);
- e += e1;
- if (e >= 0)
- {
- addrp += nlwidth;
- e += e3;
- }
- addrp += signdx;
-#endif /* PSZ == 24 */
- }
- }
-#else /* !PIXEL_ADDR */
- register CfbBits tmp, bit;
- CfbBits leftbit, rightbit;
-
- /* point to longword containing first point */
-#if PSZ == 24
- addrl = (addrl + (y1 * nlwidth) + ((x1 * 3) >>2);
-#else
- addrl = (addrl + (y1 * nlwidth) + (x1 >> PWSH));
-#endif
- if (signdy < 0)
- nlwidth = -nlwidth;
- e = e-e1; /* to make looping easier */
-
- leftbit = cfbmask[0];
-#if PSZ == 24
- rightbit = cfbmask[(PPW-1)<<1];
- bit = cfbmask[(x1 & 3)<<1];
-#else
- rightbit = cfbmask[PPW-1];
- bit = cfbmask[x1 & PIM];
-#endif
-
- if (axis == X_AXIS)
- {
- if (signdx > 0)
- {
- while (len--)
- {
- *addrl = DoMaskRRop (*addrl, and, xor, bit);
- bit = SCRRIGHT(bit,1);
- e += e1;
- if (e >= 0)
- {
- addrl += nlwidth;
- e += e3;
- }
- if (!bit)
- {
- bit = leftbit;
- addrl++;
- }
- }
- }
- else
- {
- while (len--)
- {
- *addrl = DoMaskRRop (*addrl, and, xor, bit);
- e += e1;
- bit = SCRLEFT(bit,1);
- if (e >= 0)
- {
- addrl += nlwidth;
- e += e3;
- }
- if (!bit)
- {
- bit = rightbit;
- addrl--;
- }
- }
- }
- } /* if X_AXIS */
- else
- {
- if (signdx > 0)
- {
- while(len--)
- {
- *addrl = DoMaskRRop (*addrl, and, xor, bit);
- e += e1;
- if (e >= 0)
- {
- bit = SCRRIGHT(bit,1);
- if (!bit)
- {
- bit = leftbit;
- addrl++;
- }
- e += e3;
- }
- addrl += nlwidth;
- }
- }
- else
- {
- while(len--)
- {
- *addrl = DoMaskRRop (*addrl, and, xor, bit);
- e += e1;
- if (e >= 0)
- {
- bit = SCRLEFT(bit,1);
- if (!bit)
- {
- bit = rightbit;
- addrl--;
- }
- e += e3;
- }
- addrl += nlwidth;
- }
- }
- } /* else Y_AXIS */
-#endif
-}
diff --git a/cfb/cfbbresd.c b/cfb/cfbbresd.c
deleted file mode 100644
index ee48a74ec..000000000
--- a/cfb/cfbbresd.c
+++ /dev/null
@@ -1,404 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 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.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include "misc.h"
-#include "cfb.h"
-#include "cfbmskbits.h"
-#include "miline.h"
-
-/* Dashed bresenham line */
-
-void
-cfbBresD(rrops,
- pdashIndex, pDash, numInDashList, pdashOffset, isDoubleDash,
- addrl, nlwidth,
- signdx, signdy, axis, x1, y1, e, e1, e2, len)
- cfbRRopPtr rrops;
- int *pdashIndex; /* current dash */
- unsigned char *pDash; /* dash list */
- int numInDashList; /* total length of dash list */
- int *pdashOffset; /* offset into current dash */
- int isDoubleDash;
- CfbBits *addrl; /* pointer to base of bitmap */
- int nlwidth; /* width in longwords of bitmap */
- int signdx, signdy; /* signs of directions */
- int axis; /* major axis (Y_AXIS or X_AXIS) */
- int x1, y1; /* initial point */
- register int e; /* error accumulator */
- register int e1; /* bresenham increments */
- int e2;
- int len; /* length of line */
-{
-#ifdef PIXEL_ADDR
- register PixelType *addrp;
-#endif
- register int e3 = e2-e1;
- int dashIndex;
- int dashOffset;
- int dashRemaining;
- CfbBits xorFg, andFg, xorBg, andBg;
- Bool isCopy;
- int thisDash;
-#if PSZ == 24
- CfbBits xorPiQxlFg[3], andPiQxlFg[3], xorPiQxlBg[3], andPiQxlBg[3];
- char *addrb;
- int signdx3, signdy3;
-#endif
-
- dashOffset = *pdashOffset;
- dashIndex = *pdashIndex;
- isCopy = (rrops[0].rop == GXcopy && rrops[1].rop == GXcopy);
-#if PSZ == 24
- xorFg = rrops[0].xor & 0xffffff;
- andFg = rrops[0].and & 0xffffff;
- xorBg = rrops[1].xor & 0xffffff;
- andBg = rrops[1].and & 0xffffff;
- xorPiQxlFg[0] = xorFg | (xorFg << 24);
- xorPiQxlFg[1] = (xorFg >> 8) | (xorFg << 16);
- xorPiQxlFg[2] = (xorFg >> 16) | (xorFg << 8);
- andPiQxlFg[0] = andFg | (andFg << 24);
- andPiQxlFg[1] = (andFg >> 8) | (andFg << 16);
- andPiQxlFg[2] = (andFg >> 16) | (andFg << 8);
- xorPiQxlBg[0] = xorBg | (xorBg << 24);
- xorPiQxlBg[1] = (xorBg >> 8) | (xorBg << 16);
- xorPiQxlBg[2] = (xorBg >> 16) | (xorBg << 8);
- andPiQxlBg[0] = andBg | (andBg << 24);
- andPiQxlBg[1] = (andBg >> 8) | (andBg << 16);
- andPiQxlBg[2] = (andFg >> 16) | (andBg << 8);
-#else
- xorFg = rrops[0].xor;
- andFg = rrops[0].and;
- xorBg = rrops[1].xor;
- andBg = rrops[1].and;
-#endif
- dashRemaining = pDash[dashIndex] - dashOffset;
- if ((thisDash = dashRemaining) >= len)
- {
- thisDash = len;
- dashRemaining -= len;
- }
- e = e-e1; /* to make looping easier */
-
-#define BresStep(minor,major) {if ((e += e1) >= 0) { e += e3; minor; } major;}
-
-#define NextDash {\
- dashIndex++; \
- if (dashIndex == numInDashList) \
- dashIndex = 0; \
- dashRemaining = pDash[dashIndex]; \
- if ((thisDash = dashRemaining) >= len) \
- { \
- dashRemaining -= len; \
- thisDash = len; \
- } \
-}
-
-#ifdef PIXEL_ADDR
-
-#if PSZ == 24
-#define Loop(store) while (thisDash--) {\
- store; \
- BresStep(addrb+=signdy3,addrb+=signdx3) \
- }
- /* point to first point */
- nlwidth <<= PWSH;
- addrp = (PixelType *)(addrl) + (y1 * nlwidth);
- addrb = (char *)addrp + x1 * 3;
-
-#else
-#define Loop(store) while (thisDash--) {\
- store; \
- BresStep(addrp+=signdy,addrp+=signdx) \
- }
- /* point to first point */
- nlwidth <<= PWSH;
- addrp = (PixelType *)(addrl) + (y1 * nlwidth) + x1;
-#endif
- signdy *= nlwidth;
-#if PSZ == 24
- signdx3 = signdx * 3;
- signdy3 = signdy * sizeof (CfbBits);
-#endif
- if (axis == Y_AXIS)
- {
- int t;
-
- t = signdx;
- signdx = signdy;
- signdy = t;
-#if PSZ == 24
- t = signdx3;
- signdx3 = signdy3;
- signdy3 = t;
-#endif
- }
-
- if (isCopy)
- {
-#if PSZ == 24
-#define body_copy(pix) { \
- addrp = (PixelType *)((unsigned long)addrb & ~0x03); \
- switch((unsigned long)addrb & 3){ \
- case 0: \
- *addrp = (*addrp & 0xFF000000)|((pix)[0] & 0xFFFFFF); \
- break; \
- case 1: \
- *addrp = (*addrp & 0xFF)|((pix)[2] & 0xFFFFFF00); \
- break; \
- case 3: \
- *addrp = (*addrp & 0xFFFFFF)|((pix)[0] & 0xFF000000); \
- *(addrp+1) = (*(addrp+1) & 0xFFFF0000)|((pix)[1] & 0xFFFF); \
- break; \
- case 2: \
- *addrp = (*addrp & 0xFFFF)|((pix)[1] & 0xFFFF0000); \
- *(addrp+1) = (*(addrp+1) & 0xFFFFFF00)|((pix)[2] & 0xFF); \
- break; \
- } \
-}
-#endif /* PSZ == 24 */
-
- for (;;)
- {
- len -= thisDash;
- if (dashIndex & 1) {
- if (isDoubleDash) {
-#if PSZ == 24
- Loop(body_copy(xorPiQxlBg))
-#else
- Loop(*addrp = xorBg)
-#endif
- } else {
- Loop(;)
- }
- } else {
-#if PSZ == 24
- Loop(body_copy(xorPiQxlFg))
-#else
- Loop(*addrp = xorFg)
-#endif
- }
- if (!len)
- break;
- NextDash
- }
-#undef body_copy
- }
- else
- {
-#define body_set(and, xor) { \
- addrp = (PixelType *)((unsigned long)addrb & ~0x03); \
- switch((unsigned long)addrb & 3){ \
- case 0: \
- *addrp = (*addrp & ((and)[0]|0xFF000000)) ^ ((xor)[0] & 0xFFFFFF); \
- break; \
- case 1: \
- *addrp = (*addrp & ((and)[2]|0xFF)) ^ ((xor)[2] & 0xFFFFFF00); \
- break; \
- case 3: \
- *addrp = (*addrp & ((and)[0]|0xFFFFFF)) ^ ((xor)[0] & 0xFF000000); \
- *(addrp+1)=(*(addrp+1)&((and)[1]|0xFFFF0000)) ^ ((xor)[1]&0xFFFF); \
- break; \
- case 2: \
- *addrp = (*addrp & ((and)[1]|0xFFFF)) ^ ((xor)[1] & 0xFFFF0000); \
- *(addrp+1)=(*(addrp+1)&((and)[2]|0xFFFFFF00)) ^ ((xor)[2] & 0xFF); \
- break; \
- } \
-}
-
- for (;;)
- {
- len -= thisDash;
- if (dashIndex & 1) {
- if (isDoubleDash) {
-#if PSZ == 24
- Loop(body_set(andPiQxlBg, xorPiQxlBg))
-#else
- Loop(*addrp = DoRRop(*addrp,andBg, xorBg))
-#endif
- } else {
- Loop(;)
- }
- } else {
-#if PSZ == 24
- Loop(body_set(andPiQxlFg, xorPiQxlFg))
-#else
- Loop(*addrp = DoRRop(*addrp,andFg, xorFg))
-#endif
- }
- if (!len)
- break;
- NextDash
- }
-#undef body_set
- }
-#else /* !PIXEL_ADDR */
- {
- register CfbBits tmp;
- CfbBits startbit, bit;
-
- /* point to longword containing first point */
-#if PSZ == 24
- addrl = (addrl + (y1 * nlwidth) + ((x1*3) >> 2);
-#else
- addrl = (addrl + (y1 * nlwidth) + (x1 >> PWSH));
-#endif
- signdy = signdy * nlwidth;
-
- if (signdx > 0)
- startbit = cfbmask[0];
- else
-#if PSZ == 24
- startbit = cfbmask[(PPW-1)<<1];
- bit = cfbmask[(x1 & 3)<<1];
-#else
- startbit = cfbmask[PPW-1];
- bit = cfbmask[x1 & PIM];
-#endif
-
-#if PSZ == 24
-#define X_Loop(store) while(thisDash--) {\
- store; \
- BresStep(addrl += signdy, \
- if (signdx > 0) \
- bit = SCRRIGHT(bit,1); \
- else \
- bit = SCRLEFT(bit,1); \
- if (!bit) \
- { \
- bit = startbit; \
- addrl += signdx; \
- }) \
- }
-#define Y_Loop(store) while(thisDash--) {\
- store; \
- BresStep(if (signdx > 0) \
- bit = SCRRIGHT(bit,1); \
- else \
- bit = SCRLEFT(bit,1); \
- if (!bit) \
- { \
- bit = startbit; \
- addrl += signdx; \
- }, \
- addrl += signdy) \
- }
-#else
-#define X_Loop(store) while(thisDash--) {\
- store; \
- BresStep(addrl += signdy, \
- if (signdx > 0) \
- bit = SCRRIGHT(bit,1); \
- else \
- bit = SCRLEFT(bit,1); \
- if (!bit) \
- { \
- bit = startbit; \
- addrl += signdx; \
- }) \
- }
-#define Y_Loop(store) while(thisDash--) {\
- store; \
- BresStep(if (signdx > 0) \
- bit = SCRRIGHT(bit,1); \
- else \
- bit = SCRLEFT(bit,1); \
- if (!bit) \
- { \
- bit = startbit; \
- addrl += signdx; \
- }, \
- addrl += signdy) \
- }
-#endif
-
- if (axis == X_AXIS)
- {
- for (;;)
- {
- len -= thisDash;
- if (dashIndex & 1) {
- if (isDoubleDash) {
- X_Loop(*addrl = DoMaskRRop(*addrl, andBg, xorBg, bit));
- } else {
- X_Loop(;)
- }
- } else {
- X_Loop(*addrl = DoMaskRRop(*addrl, andFg, xorFg, bit));
- }
- if (!len)
- break;
- NextDash
- }
- } /* if X_AXIS */
- else
- {
- for (;;)
- {
- len -= thisDash;
- if (dashIndex & 1) {
- if (isDoubleDash) {
- Y_Loop(*addrl = DoMaskRRop(*addrl, andBg, xorBg, bit));
- } else {
- Y_Loop(;)
- }
- } else {
- Y_Loop(*addrl = DoMaskRRop(*addrl, andFg, xorFg, bit));
- }
- if (!len)
- break;
- NextDash
- }
- } /* else Y_AXIS */
- }
-#endif
- *pdashIndex = dashIndex;
- *pdashOffset = pDash[dashIndex] - dashRemaining;
-}
diff --git a/cfb/cfbcmap.c b/cfb/cfbcmap.c
deleted file mode 100644
index b96f67170..000000000
--- a/cfb/cfbcmap.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/************************************************************
-Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this
-software and its documentation for any purpose and without
-fee is hereby granted, provided that the above copyright no-
-tice appear in all copies and that both that copyright no-
-tice and this permission notice appear in supporting docu-
-mentation, and that the names of Sun or The Open Group
-not be used in advertising or publicity pertaining to
-distribution of the software without specific prior
-written permission. Sun and The Open Group make no
-representations about the suitability of this software for
-any purpose. It is provided "as is" without any express or
-implied warranty.
-
-SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
-NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
-ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
-PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
-OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
-THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-********************************************************/
-
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "scrnintstr.h"
-#include "colormapst.h"
-#include "resource.h"
-#include "micmap.h"
-#include "cfb.h"
-
-int
-cfbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
-{
- return miListInstalledColormaps(pScreen, pmaps);
-}
-
-void
-cfbInstallColormap(ColormapPtr pmap)
-{
- miInstallColormap(pmap);
-}
-
-void
-cfbUninstallColormap(ColormapPtr pmap)
-{
- miUninstallColormap(pmap);
-}
-
-void
-cfbResolveColor(unsigned short *pred,
- unsigned short *pgreen,
- unsigned short *pblue,
- VisualPtr pVisual)
-{
- miResolveColor(pred, pgreen, pblue, pVisual);
-}
-
-Bool
-cfbInitializeColormap(ColormapPtr pmap)
-{
- return miInitializeColormap(pmap);
-}
-
-int
-cfbExpandDirectColors (ColormapPtr pmap, int ndef,
- xColorItem *indefs, xColorItem *outdefs)
-{
- return miExpandDirectColors(pmap, ndef, indefs, outdefs);
-}
-
-Bool
-cfbCreateDefColormap(ScreenPtr pScreen)
-{
- return miCreateDefColormap(pScreen);
-}
-
-void
-cfbClearVisualTypes(void)
-{
- miClearVisualTypes();
-}
-
-Bool
-cfbSetVisualTypes (int depth, int visuals, int bitsPerRGB)
-{
- return miSetVisualTypes(depth, visuals, bitsPerRGB, -1);
-}
-
-/*
- * Given a list of formats for a screen, create a list
- * of visuals and depths for the screen which coorespond to
- * the set which can be used with this version of cfb.
- */
-
-Bool
-cfbInitVisuals (VisualPtr *visualp,
- DepthPtr *depthp,
- int *nvisualp,
- int *ndepthp,
- int *rootDepthp,
- VisualID *defaultVisp,
- unsigned long sizes,
- int bitsPerRGB)
-{
- return miInitVisuals(visualp, depthp, nvisualp, ndepthp, rootDepthp,
- defaultVisp, sizes, bitsPerRGB, -1);
-}
diff --git a/cfb/cfbcppl.c b/cfb/cfbcppl.c
deleted file mode 100644
index 00714cbc4..000000000
--- a/cfb/cfbcppl.c
+++ /dev/null
@@ -1,486 +0,0 @@
-/*
-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
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <string.h>
-#include <X11/X.h>
-#include <X11/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(
- DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- int rop,
- RegionPtr prgnDst,
- DDXPointPtr pptSrc,
- unsigned long planemask)
-{
- /* note: there must be some sort of trick behind,
- passing a planemask value with all bits set
- whilst using the current planemask for the bitPlane value. */
-#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(
- 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 = mfbGetstarttab((x)&0x1f); \
- endmask = mfbGetendtab(((x)+(w)) & 0x1f); \
- if (startmask) \
- nlw = (((w) - (32 - ((x)&0x1f))) >> 5); \
- else \
- nlw = (w) >> 5;
-
-#define mfbmaskpartialbits(x, w, mask) \
- mask = mfbGetpartmasks((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
-#endif
-#if PSZ == 24
-cfbCopyPlane24to1
-#endif
-#if PSZ == 32
-cfbCopyPlane32to1
-#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 = 0, endmask = 0;
- int niStart = 0, niEnd = 0;
- int bitStart = 0, bitEnd = 0;
- int nl, nlMiddle;
- int nbox;
- BoxPtr pbox;
- int result;
-
-
- 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/cfbfillarc.c b/cfb/cfbfillarc.c
deleted file mode 100644
index 0eb5ff469..000000000
--- a/cfb/cfbfillarc.c
+++ /dev/null
@@ -1,374 +0,0 @@
-/************************************************************
-
-Copyright 1989, 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.
-
-********************************************************/
-
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <limits.h>
-
-#include <X11/X.h>
-#include <X11/Xprotostr.h>
-#include "regionstr.h"
-#include "gcstruct.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-#include "cfb.h"
-#include "cfbmskbits.h"
-#include "mifillarc.h"
-#include "cfbrrop.h"
-#include "mi.h"
-
-/* gcc 1.35 is stupid */
-#if defined(__GNUC__) && __GNUC__ < 2 && defined(mc68020)
-#define STUPID volatile
-#else
-#define STUPID
-#endif
-
-static void
-RROP_NAME(cfbFillEllipseSolid)(
- DrawablePtr pDraw,
- GCPtr pGC,
- xArc *arc)
-{
- STUPID int x, y, e;
- STUPID int yk, xk, ym, xm, dx, dy, xorg, yorg;
- miFillArcRec info;
-#if PSZ == 24
- unsigned char *addrlt, *addrlb;
-#else
- CfbBits *addrlt, *addrlb;
-#endif
- register CfbBits *addrl;
- register int n;
- int nlwidth;
- RROP_DECLARE
- register int xpos;
- register int slw;
- CfbBits startmask, endmask;
- int nlmiddle;
-#if PSZ == 24
- register int pidx;
- int xpos3;
-#endif
-
-#if PSZ == 24
- cfbGetByteWidthAndPointer (pDraw, nlwidth, addrlt)
-#else
- cfbGetLongWidthAndPointer (pDraw, nlwidth, addrlt)
-#endif
-
- RROP_FETCH_GC(pGC);
- miFillArcSetup(arc, &info);
- MIFILLARCSETUP();
- xorg += pDraw->x;
- yorg += pDraw->y;
- addrlb = addrlt;
- addrlt += nlwidth * (yorg - y);
- addrlb += nlwidth * (yorg + y + dy);
- while (y)
- {
- addrlt += nlwidth;
- addrlb -= nlwidth;
- MIFILLARCSTEP(slw);
- if (!slw)
- continue;
- xpos = xorg - x;
-#if PSZ == 24
- xpos3 = (xpos * 3) & ~0x03;
- addrl = (CfbBits *)((char *)addrlt + xpos3);
- if (slw == 1){
- RROP_SOLID24(addrl, xpos);
- if (miFillArcLower(slw)){
- addrl = (CfbBits *)((char *)addrlb + xpos3);
- RROP_SOLID24(addrl, xpos);
- }
- continue;
- }
- maskbits(xpos, slw, startmask, endmask, nlmiddle);
- xpos &= 3;
- pidx = xpos;
- if (startmask){
- RROP_SOLID_MASK(addrl, startmask, pidx-1);
- addrl++;
- if (pidx == 3)
- pidx = 0;
- }
- n = nlmiddle;
- while (--n >= 0){
- RROP_SOLID(addrl, pidx);
- addrl++;
- if (++pidx == 3)
- pidx = 0;
- }
- if (endmask)
- RROP_SOLID_MASK(addrl, endmask, pidx);
- if (!miFillArcLower(slw))
- continue;
- addrl = (CfbBits *)((char *)addrlb + xpos3);
- pidx = xpos;
- if (startmask){
- RROP_SOLID_MASK(addrl, startmask, pidx-1);
- addrl++;
- if (pidx == 3)
- pidx = 0;
- }
- n = nlmiddle;
- while (--n >= 0){
- RROP_SOLID(addrl, pidx);
- addrl++;
- if (++pidx == 3)
- pidx = 0;
- }
- if (endmask)
- RROP_SOLID_MASK(addrl, endmask, pidx);
-#else /* PSZ == 24 */
- addrl = addrlt + (xpos >> PWSH);
- if (((xpos & PIM) + slw) <= PPW)
- {
- maskpartialbits(xpos, slw, startmask);
- RROP_SOLID_MASK(addrl,startmask);
- if (miFillArcLower(slw))
- {
- addrl = addrlb + (xpos >> PWSH);
- RROP_SOLID_MASK(addrl, startmask);
- }
- continue;
- }
- maskbits(xpos, slw, startmask, endmask, nlmiddle);
- if (startmask)
- {
- RROP_SOLID_MASK(addrl, startmask);
- addrl++;
- }
- n = nlmiddle;
- RROP_SPAN(addrl,n)
-
- if (endmask)
- RROP_SOLID_MASK(addrl, endmask);
- if (!miFillArcLower(slw))
- continue;
- addrl = addrlb + (xpos >> PWSH);
- if (startmask)
- {
- RROP_SOLID_MASK(addrl, startmask);
- addrl++;
- }
- n = nlmiddle;
- RROP_SPAN(addrl, n);
- if (endmask)
- RROP_SOLID_MASK(addrl, endmask);
-#endif /* PSZ == 24 */
- }
- RROP_UNDECLARE
-}
-
-#if PSZ == 24
-#define FILLSPAN(xl,xr,addr) \
- if (xr >= xl){ \
- n = xr - xl + 1; \
- addrl = (CfbBits *)((char *)addr + ((xl * 3) & ~0x03)); \
- if (n <= 1){ \
- if (n) \
- RROP_SOLID24(addrl, xl); \
- } else { \
- maskbits(xl, n, startmask, endmask, n); \
- pidx = xl & 3; \
- if (startmask){ \
- RROP_SOLID_MASK(addrl, startmask, pidx-1); \
- addrl++; \
- if (pidx == 3) \
- pidx = 0; \
- } \
- while (--n >= 0){ \
- RROP_SOLID(addrl, pidx); \
- addrl++; \
- if (++pidx == 3) \
- pidx = 0; \
- } \
- if (endmask) \
- RROP_SOLID_MASK(addrl, endmask, pidx); \
- } \
- }
-#else /* PSZ == 24 */
-#define FILLSPAN(xl,xr,addr) \
- if (xr >= xl) \
- { \
- n = xr - xl + 1; \
- addrl = addr + (xl >> PWSH); \
- if (((xl & PIM) + n) <= PPW) \
- { \
- maskpartialbits(xl, n, startmask); \
- RROP_SOLID_MASK(addrl, startmask); \
- } \
- else \
- { \
- maskbits(xl, n, startmask, endmask, n); \
- if (startmask) \
- { \
- RROP_SOLID_MASK(addrl, startmask); \
- addrl++; \
- } \
- while (n--) \
- { \
- RROP_SOLID(addrl); \
- ++addrl; \
- } \
- if (endmask) \
- RROP_SOLID_MASK(addrl, endmask); \
- } \
- }
-#endif /* PSZ == 24 */
-
-#define FILLSLICESPANS(flip,addr) \
- if (!flip) \
- { \
- FILLSPAN(xl, xr, addr); \
- } \
- else \
- { \
- xc = xorg - x; \
- FILLSPAN(xc, xr, addr); \
- xc += slw - 1; \
- FILLSPAN(xl, xc, addr); \
- }
-
-static void
-RROP_NAME(cfbFillArcSliceSolid)(
- DrawablePtr pDraw,
- GCPtr pGC,
- xArc *arc)
-{
- int yk, xk, ym, xm, dx, dy, xorg, yorg, slw;
- register int x, y, e;
- miFillArcRec info;
- miArcSliceRec slice;
- int xl, xr, xc;
-#if PSZ == 24
- unsigned char *addrlt, *addrlb;
-#else
- CfbBits *addrlt, *addrlb;
-#endif
- register CfbBits *addrl;
- register int n;
- int nlwidth;
- RROP_DECLARE
- CfbBits startmask, endmask;
-#if PSZ == 24
- register int pidx;
-#endif /* PSZ == 24 */
-
-#if PSZ == 24
- cfbGetByteWidthAndPointer (pDraw, nlwidth, addrlt)
-#else
- cfbGetLongWidthAndPointer (pDraw, nlwidth, addrlt)
-#endif
-
- RROP_FETCH_GC(pGC);
- miFillArcSetup(arc, &info);
- miFillArcSliceSetup(arc, &slice, pGC);
- MIFILLARCSETUP();
- xorg += pDraw->x;
- yorg += pDraw->y;
- addrlb = addrlt;
- addrlt += nlwidth * (yorg - y);
- addrlb += nlwidth * (yorg + y + dy);
- slice.edge1.x += pDraw->x;
- slice.edge2.x += pDraw->x;
- while (y > 0)
- {
- addrlt += nlwidth;
- addrlb -= nlwidth;
- MIFILLARCSTEP(slw);
- MIARCSLICESTEP(slice.edge1);
- MIARCSLICESTEP(slice.edge2);
- if (miFillSliceUpper(slice))
- {
- MIARCSLICEUPPER(xl, xr, slice, slw);
- FILLSLICESPANS(slice.flip_top, addrlt);
- }
- if (miFillSliceLower(slice))
- {
- MIARCSLICELOWER(xl, xr, slice, slw);
- FILLSLICESPANS(slice.flip_bot, addrlb);
- }
- }
- RROP_UNDECLARE
-}
-
-void
-RROP_NAME(cfbPolyFillArcSolid) (pDraw, pGC, narcs, parcs)
- DrawablePtr pDraw;
- GCPtr pGC;
- int narcs;
- xArc *parcs;
-{
- register xArc *arc;
- register int i;
- int x2, y2;
- BoxRec box;
- RegionPtr cclip;
-
- cclip = cfbGetCompositeClip(pGC);
- for (arc = parcs, i = narcs; --i >= 0; arc++)
- {
- if (miFillArcEmpty(arc))
- continue;
- if (miCanFillArc(arc))
- {
- box.x1 = arc->x + pDraw->x;
- box.y1 = arc->y + pDraw->y;
- /*
- * Because box.x2 and box.y2 get truncated to 16 bits, and the
- * RECT_IN_REGION test treats the resulting number as a signed
- * integer, the RECT_IN_REGION test alone can go the wrong way.
- * This can result in a server crash because the rendering
- * routines in this file deal directly with cpu addresses
- * of pixels to be stored, and do not clip or otherwise check
- * that all such addresses are within their respective pixmaps.
- * So we only allow the RECT_IN_REGION test to be used for
- * values that can be expressed correctly in a signed short.
- */
- x2 = box.x1 + (int)arc->width + 1;
- box.x2 = x2;
- y2 = box.y1 + (int)arc->height + 1;
- box.y2 = y2;
- if ( (x2 <= SHRT_MAX) && (y2 <= SHRT_MAX) &&
- (RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN) )
- {
- if ((arc->angle2 >= FULLCIRCLE) ||
- (arc->angle2 <= -FULLCIRCLE))
- RROP_NAME(cfbFillEllipseSolid)(pDraw, pGC, arc);
- else
- RROP_NAME(cfbFillArcSliceSolid)(pDraw, pGC, arc);
- continue;
- }
- }
- miPolyFillArc(pDraw, pGC, 1, arc);
- }
-}
diff --git a/cfb/cfbfillrct.c b/cfb/cfbfillrct.c
deleted file mode 100644
index fc2d31bdc..000000000
--- a/cfb/cfbfillrct.c
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- * Fill rectangles.
- */
-
-/*
-
-Copyright 1989, 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.
-*/
-
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include "servermd.h"
-#include "gcstruct.h"
-#include "window.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-#include "windowstr.h"
-#include "mi.h"
-#include "cfb.h"
-#include "cfbmskbits.h"
-#include "mergerop.h"
-
-
-void
-cfbFillBoxTileOdd (pDrawable, n, rects, tile, xrot, yrot)
- DrawablePtr pDrawable;
- int n;
- BoxPtr rects;
- PixmapPtr tile;
- int xrot, yrot;
-{
-#if PSZ == 24
- if (tile->drawable.width & 3)
-#else
- if (tile->drawable.width & PIM)
-#endif
- cfbFillBoxTileOddCopy (pDrawable, n, rects, tile, xrot, yrot, GXcopy, ~0L);
- else
- cfbFillBoxTile32sCopy (pDrawable, n, rects, tile, xrot, yrot, GXcopy, ~0L);
-}
-
-void
-cfbFillRectTileOdd (pDrawable, pGC, nBox, pBox)
- DrawablePtr pDrawable;
- GCPtr pGC;
- int nBox;
- BoxPtr pBox;
-{
- int xrot, yrot;
- void (*fill)(DrawablePtr, int, BoxPtr, PixmapPtr, int, int, int, unsigned long);
-
- xrot = pDrawable->x + pGC->patOrg.x;
- yrot = pDrawable->y + pGC->patOrg.y;
-#if PSZ == 24
- if (pGC->tile.pixmap->drawable.width & 3)
-#else
- if (pGC->tile.pixmap->drawable.width & PIM)
-#endif
- {
- fill = cfbFillBoxTileOddGeneral;
- if ((pGC->planemask & PMSK) == PMSK)
- {
- if (pGC->alu == GXcopy)
- fill = cfbFillBoxTileOddCopy;
- }
- }
- else
- {
- fill = cfbFillBoxTile32sGeneral;
- if ((pGC->planemask & PMSK) == PMSK)
- {
- if (pGC->alu == GXcopy)
- fill = cfbFillBoxTile32sCopy;
- }
- }
- (*fill) (pDrawable, nBox, pBox, pGC->tile.pixmap, xrot, yrot, pGC->alu, pGC->planemask);
-}
-
-#define NUM_STACK_RECTS 1024
-
-void
-cfbPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
- DrawablePtr pDrawable;
- register GCPtr pGC;
- int nrectFill; /* number of rectangles to fill */
- xRectangle *prectInit; /* Pointer to first rectangle to fill */
-{
- xRectangle *prect;
- RegionPtr prgnClip;
- register BoxPtr pbox;
- register BoxPtr pboxClipped;
- BoxPtr pboxClippedBase;
- BoxPtr pextent;
- BoxRec stackRects[NUM_STACK_RECTS];
- cfbPrivGC *priv;
- int numRects;
- void (*BoxFill)(DrawablePtr, GCPtr, int, BoxPtr);
- int n;
- int xorg, yorg;
-
-#if PSZ != 8
- if ((pGC->fillStyle == FillStippled) ||
- (pGC->fillStyle == FillOpaqueStippled)) {
- miPolyFillRect(pDrawable, pGC, nrectFill, prectInit);
- return;
- }
-#endif
-
- priv = cfbGetGCPrivate(pGC);
- prgnClip = pGC->pCompositeClip;
-
- BoxFill = 0;
- switch (pGC->fillStyle)
- {
- case FillSolid:
- switch (priv->rop) {
- case GXcopy:
- BoxFill = cfbFillRectSolidCopy;
- break;
- case GXxor:
- BoxFill = cfbFillRectSolidXor;
- break;
- default:
- BoxFill = cfbFillRectSolidGeneral;
- break;
- }
- break;
- case FillTiled:
- if (!pGC->pRotatedPixmap)
- BoxFill = cfbFillRectTileOdd;
- else
- {
- if (pGC->alu == GXcopy && (pGC->planemask & PMSK) == PMSK)
- BoxFill = cfbFillRectTile32Copy;
- else
- BoxFill = cfbFillRectTile32General;
- }
- break;
-#if PSZ == 8
- case FillStippled:
- if (!pGC->pRotatedPixmap)
- BoxFill = cfb8FillRectStippledUnnatural;
- else
- BoxFill = cfb8FillRectTransparentStippled32;
- break;
- case FillOpaqueStippled:
- if (!pGC->pRotatedPixmap)
- BoxFill = cfb8FillRectStippledUnnatural;
- else
- BoxFill = cfb8FillRectOpaqueStippled32;
- break;
-#endif
- }
- prect = prectInit;
- xorg = pDrawable->x;
- yorg = pDrawable->y;
- if (xorg || yorg)
- {
- prect = prectInit;
- n = nrectFill;
- while(n--)
- {
- prect->x += xorg;
- prect->y += yorg;
- prect++;
- }
- }
-
- prect = prectInit;
-
- numRects = REGION_NUM_RECTS(prgnClip) * nrectFill;
- if (numRects > NUM_STACK_RECTS)
- {
- pboxClippedBase = (BoxPtr)xalloc(numRects * sizeof(BoxRec));
- if (!pboxClippedBase)
- return;
- }
- else
- pboxClippedBase = stackRects;
-
- pboxClipped = pboxClippedBase;
-
- if (REGION_NUM_RECTS(prgnClip) == 1)
- {
- int x1, y1, x2, y2, bx2, by2;
-
- pextent = REGION_RECTS(prgnClip);
- x1 = pextent->x1;
- y1 = pextent->y1;
- x2 = pextent->x2;
- y2 = pextent->y2;
- while (nrectFill--)
- {
- if ((pboxClipped->x1 = prect->x) < x1)
- pboxClipped->x1 = x1;
-
- if ((pboxClipped->y1 = prect->y) < y1)
- pboxClipped->y1 = y1;
-
- bx2 = (int) prect->x + (int) prect->width;
- if (bx2 > x2)
- bx2 = x2;
- pboxClipped->x2 = bx2;
-
- by2 = (int) prect->y + (int) prect->height;
- if (by2 > y2)
- by2 = y2;
- pboxClipped->y2 = by2;
-
- prect++;
- if ((pboxClipped->x1 < pboxClipped->x2) &&
- (pboxClipped->y1 < pboxClipped->y2))
- {
- pboxClipped++;
- }
- }
- }
- else
- {
- int x1, y1, x2, y2, bx2, by2;
-
- pextent = REGION_EXTENTS(pGC->pScreen, prgnClip);
- x1 = pextent->x1;
- y1 = pextent->y1;
- x2 = pextent->x2;
- y2 = pextent->y2;
- while (nrectFill--)
- {
- BoxRec box;
-
- if ((box.x1 = prect->x) < x1)
- box.x1 = x1;
-
- if ((box.y1 = prect->y) < y1)
- box.y1 = y1;
-
- bx2 = (int) prect->x + (int) prect->width;
- if (bx2 > x2)
- bx2 = x2;
- box.x2 = bx2;
-
- by2 = (int) prect->y + (int) prect->height;
- if (by2 > y2)
- by2 = y2;
- box.y2 = by2;
-
- prect++;
-
- if ((box.x1 >= box.x2) || (box.y1 >= box.y2))
- continue;
-
- n = REGION_NUM_RECTS (prgnClip);
- pbox = REGION_RECTS(prgnClip);
-
- /* clip the rectangle to each box in the clip region
- this is logically equivalent to calling Intersect()
- */
- while(n--)
- {
- pboxClipped->x1 = max(box.x1, pbox->x1);
- pboxClipped->y1 = max(box.y1, pbox->y1);
- pboxClipped->x2 = min(box.x2, pbox->x2);
- pboxClipped->y2 = min(box.y2, pbox->y2);
- pbox++;
-
- /* see if clipping left anything */
- if(pboxClipped->x1 < pboxClipped->x2 &&
- pboxClipped->y1 < pboxClipped->y2)
- {
- pboxClipped++;
- }
- }
- }
- }
- if (pboxClipped != pboxClippedBase)
- (*BoxFill) (pDrawable, pGC,
- pboxClipped-pboxClippedBase, pboxClippedBase);
- if (pboxClippedBase != stackRects)
- xfree(pboxClippedBase);
-}
diff --git a/cfb/cfbfillsp.c b/cfb/cfbfillsp.c
deleted file mode 100644
index 36710b612..000000000
--- a/cfb/cfbfillsp.c
+++ /dev/null
@@ -1,1004 +0,0 @@
-/************************************************************
-Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this
-software and its documentation for any purpose and without
-fee is hereby granted, provided that the above copyright no-
-tice appear in all copies and that both that copyright no-
-tice and this permission notice appear in supporting docu-
-mentation, and that the names of Sun or The Open Group
-not be used in advertising or publicity pertaining to
-distribution of the software without specific prior
-written permission. Sun and The Open Group make no
-representations about the suitability of this software for
-any purpose. It is provided "as is" without any express or
-implied warranty.
-
-SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
-NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
-ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
-PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
-OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
-THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-********************************************************/
-
-/***********************************************************
-
-Copyright 1987, 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.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include "servermd.h"
-#include "gcstruct.h"
-#include "window.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-#include "windowstr.h"
-
-#include "cfb.h"
-#include "cfbmskbits.h"
-
-#include "mergerop.h"
-
-#if PSZ == 8
-#include "cfb8bit.h"
-#endif
-
-#define MFB_CONSTS_ONLY
-#include "maskbits.h"
-
-#include "mi.h"
-#include "mispans.h"
-
-/* scanline filling for color frame buffer
- written by drewry, oct 1986 modified by smarks
- changes for compatibility with Little-endian systems Jul 1987; MIT:yba.
-
- these routines all clip. they assume that anything that has called
-them has already translated the points (i.e. pGC->miTranslate is
-non-zero, which is howit gets set in cfbCreateGC().)
-
- the number of new scnalines created by clipping ==
-MaxRectsPerBand * nSpans.
-
- FillSolid is overloaded to be used for OpaqueStipple as well,
-if fgPixel == bgPixel.
-Note that for solids, PrivGC.rop == PrivGC.ropOpStip
-
-
- FillTiled is overloaded to be used for OpaqueStipple, if
-fgPixel != bgPixel. based on the fill style, it uses
-{RotatedTile, gc.alu} or {RotatedStipple, PrivGC.ropOpStip}
-*/
-
-#ifdef notdef
-#include <stdio.h>
-static
-dumpspans(n, ppt, pwidth)
- int n;
- DDXPointPtr ppt;
- int *pwidth;
-{
- fprintf(stderr,"%d spans\n", n);
- while (n--) {
- fprintf(stderr, "[%d,%d] %d\n", ppt->x, ppt->y, *pwidth);
- ppt++;
- pwidth++;
- }
- fprintf(stderr, "\n");
-}
-#endif
-
-/* Fill spans with tiles that aren't 32 bits wide */
-void
-cfbUnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
-DrawablePtr pDrawable;
-GC *pGC;
-int nInit; /* number of spans to fill */
-DDXPointPtr pptInit; /* pointer to list of start points */
-int *pwidthInit; /* pointer to list of n widths */
-int fSorted;
-{
- int n; /* number of spans to fill */
- register DDXPointPtr ppt; /* pointer to list of start points */
- register int *pwidth; /* pointer to list of n widths */
- void (*fill)(DrawablePtr, int, DDXPointPtr, int *, PixmapPtr, int, int, int, unsigned long);
- int xrot, yrot;
-
- if (!(pGC->planemask))
- return;
-
-#if PSZ == 24
- if (pGC->tile.pixmap->drawable.width & 3)
-#else
- if (pGC->tile.pixmap->drawable.width & PIM)
-#endif
- {
- fill = cfbFillSpanTileOddGeneral;
- if ((pGC->planemask & PMSK) == PMSK)
- {
- if (pGC->alu == GXcopy)
- fill = cfbFillSpanTileOddCopy;
- }
- }
- else
- {
- fill = cfbFillSpanTile32sGeneral;
- if ((pGC->planemask & PMSK) == PMSK)
- {
- if (pGC->alu == GXcopy)
- fill = cfbFillSpanTile32sCopy;
- }
- }
- n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) );
- if ( n == 0 )
- return;
- pwidth = (int *)xalloc(n * sizeof(int));
- ppt = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
- if(!ppt || !pwidth)
- {
- if (ppt) xfree(ppt);
- if (pwidth) xfree(pwidth);
- return;
- }
- n = miClipSpans( cfbGetCompositeClip(pGC),
- pptInit, pwidthInit, nInit,
- ppt, pwidth, fSorted);
-
- xrot = pDrawable->x + pGC->patOrg.x;
- yrot = pDrawable->y + pGC->patOrg.y;
-
- (*fill) (pDrawable, n, ppt, pwidth, pGC->tile.pixmap, xrot, yrot, pGC->alu, pGC->planemask);
-
- xfree(ppt);
- xfree(pwidth);
-}
-
-#if PSZ == 8
-
-void
-cfbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
-DrawablePtr pDrawable;
-GC *pGC;
-int nInit; /* number of spans to fill */
-DDXPointPtr pptInit; /* pointer to list of start points */
-int *pwidthInit; /* pointer to list of n widths */
-int fSorted;
-{
- /* next three parameters are post-clip */
- int n; /* number of spans to fill */
- DDXPointPtr ppt; /* pointer to list of start points */
- int *pwidth; /* pointer to list of n widths */
- int *pwidthFree;/* copies of the pointers to free */
- DDXPointPtr pptFree;
- CfbBits *pdstBase; /* pointer to start of bitmap */
- int nlwDst; /* width in longwords of bitmap */
- register CfbBits *pdst; /* pointer to current word in bitmap */
- PixmapPtr pStipple; /* pointer to stipple we want to fill with */
- int nlw;
- int x, y, w, xrem, xSrc, ySrc;
- int stwidth, stippleWidth;
- int stippleHeight;
- register CfbBits bits, inputBits;
- register int partBitsLeft;
- int nextPartBits;
- int bitsLeft, bitsWhole;
- CfbBits *srcTemp, *srcStart;
- CfbBits *psrcBase;
- CfbBits startmask, endmask;
-
- if (pGC->fillStyle == FillStippled)
- cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask);
- else
- cfb8CheckOpaqueStipple (pGC->alu, pGC->fgPixel, pGC->bgPixel, pGC->planemask);
-
- if (cfb8StippleRRop == GXnoop)
- return;
-
- n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) );
- if ( n == 0 )
- return;
- pwidthFree = (int *)xalloc(n * sizeof(int));
- pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
- if(!pptFree || !pwidthFree)
- {
- if (pptFree) xfree(pptFree);
- if (pwidthFree) xfree(pwidthFree);
- return;
- }
-
- pwidth = pwidthFree;
- ppt = pptFree;
- n = miClipSpans( cfbGetCompositeClip(pGC),
- pptInit, pwidthInit, nInit,
- ppt, pwidth, fSorted);
-
- /*
- * OK, so what's going on here? We have two Drawables:
- *
- * The Stipple:
- * Depth = 1
- * Width = stippleWidth
- * Words per scanline = stwidth
- * Pointer to pixels = pStipple->devPrivate.ptr
- */
-
- pStipple = pGC->stipple;
-
- stwidth = pStipple->devKind >> PWSH;
- stippleWidth = pStipple->drawable.width;
- stippleHeight = pStipple->drawable.height;
- psrcBase = (CfbBits *) pStipple->devPrivate.ptr;
-
- /*
- * The Target:
- * Depth = PSZ
- * Width = determined from *pwidth
- * Words per scanline = nlwDst
- * Pointer to pixels = addrlBase
- */
-
- cfbGetLongWidthAndPointer (pDrawable, nlwDst, pdstBase)
-
- /* this replaces rotating the stipple. Instead we just adjust the offset
- * at which we start grabbing bits from the stipple.
- * Ensure that ppt->x - xSrc >= 0 and ppt->y - ySrc >= 0,
- * so that iline and xrem always stay within the stipple bounds.
- */
-
- modulus (pGC->patOrg.x, stippleWidth, xSrc);
- xSrc += pDrawable->x - stippleWidth;
- modulus (pGC->patOrg.y, stippleHeight, ySrc);
- ySrc += pDrawable->y - stippleHeight;
-
- bitsWhole = stippleWidth;
-
- while (n--)
- {
- x = ppt->x;
- y = ppt->y;
- ppt++;
- w = *pwidth++;
- pdst = pdstBase + y * nlwDst + (x >> PWSH);
- y = (y - ySrc) % stippleHeight;
- srcStart = psrcBase + y * stwidth;
- xrem = ((x & ~(PGSZB-1)) - xSrc) % stippleWidth;
- srcTemp = srcStart + (xrem >> MFB_PWSH);
- bitsLeft = stippleWidth - (xrem & ~MFB_PIM);
- xrem &= MFB_PIM;
- NextUnnaturalStippleWord
- if (partBitsLeft < xrem)
- FatalError ("cfbUnnaturalStippleFS bad partBitsLeft %d xrem %d",
- partBitsLeft, xrem);
- NextSomeBits (inputBits, xrem);
- partBitsLeft -= xrem;
- if (((x & PIM) + w) <= PPW)
- {
- maskpartialbits (x, w, startmask)
- NextUnnaturalStippleBits
- *pdst = MaskRRopPixels(*pdst,bits,startmask);
- }
- else
- {
- maskbits (x, w, startmask, endmask, nlw);
- nextPartBits = (x & (PGSZB-1)) + w;
- if (nextPartBits < partBitsLeft)
- {
- if (startmask)
- {
- MaskRRopBitGroup(pdst,GetBitGroup(inputBits),startmask)
- pdst++;
- NextBitGroup (inputBits);
- }
- while (nlw--)
- {
- RRopBitGroup (pdst, GetBitGroup (inputBits));
- pdst++;
- NextBitGroup (inputBits);
- }
- if (endmask)
- {
- MaskRRopBitGroup(pdst,GetBitGroup(inputBits),endmask)
- }
- }
- else if (bitsLeft != bitsWhole && nextPartBits < partBitsLeft + bitsLeft)
- {
- NextUnnaturalStippleBitsFast
- if (startmask)
- {
- *pdst = MaskRRopPixels(*pdst,bits,startmask);
- pdst++;
- NextUnnaturalStippleBitsFast
- }
- while (nlw--)
- {
- *pdst = RRopPixels(*pdst,bits);
- pdst++;
- NextUnnaturalStippleBitsFast
- }
- if (endmask)
- *pdst = MaskRRopPixels (*pdst,bits,endmask);
- }
- else
- {
- NextUnnaturalStippleBits
- if (startmask)
- {
- *pdst = MaskRRopPixels(*pdst,bits,startmask);
- pdst++;
- NextUnnaturalStippleBits
- }
- while (nlw--)
- {
- *pdst = RRopPixels(*pdst,bits);
- pdst++;
- NextUnnaturalStippleBits
- }
- if (endmask)
- *pdst = MaskRRopPixels(*pdst,bits,endmask);
- }
- }
- }
- xfree(pptFree);
- xfree(pwidthFree);
-}
-
-#else /* PSZ != 8 */
-
-/* Fill spans with stipples that aren't 32 bits wide */
-void
-cfbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
-DrawablePtr pDrawable;
-GC *pGC;
-int nInit; /* number of spans to fill */
-DDXPointPtr pptInit; /* pointer to list of start points */
-int *pwidthInit; /* pointer to list of n widths */
-int fSorted;
-{
- /* next three parameters are post-clip */
- int n; /* number of spans to fill */
- register DDXPointPtr ppt; /* pointer to list of start points */
- register int *pwidth; /* pointer to list of n widths */
- int iline; /* first line of tile to use */
- CfbBits *addrlBase; /* pointer to start of bitmap */
- int nlwidth; /* width in longwords of bitmap */
- register CfbBits *pdst; /* pointer to current word in bitmap */
- PixmapPtr pStipple; /* pointer to stipple we want to fill with */
- register int w;
- int width, x, xrem, xSrc, ySrc;
- CfbBits tmpSrc, tmpDst1, tmpDst2;
- int stwidth, stippleWidth;
- CfbBits *psrcS;
- int rop, stiprop = 0;
- int stippleHeight;
- int *pwidthFree; /* copies of the pointers to free */
- DDXPointPtr pptFree;
- CfbBits fgfill, bgfill;
-
- if (!(pGC->planemask))
- return;
-
- n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) );
- if ( n == 0 )
- return;
- pwidthFree = (int *)xalloc(n * sizeof(int));
- pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
- if(!pptFree || !pwidthFree)
- {
- if (pptFree) xfree(pptFree);
- if (pwidthFree) xfree(pwidthFree);
- return;
- }
- pwidth = pwidthFree;
- ppt = pptFree;
- n = miClipSpans( cfbGetCompositeClip(pGC),
- pptInit, pwidthInit, nInit,
- ppt, pwidth, fSorted);
- rop = pGC->alu;
- if (pGC->fillStyle == FillStippled) {
- switch (rop) {
- case GXand:
- case GXcopy:
- case GXnoop:
- case GXor:
- stiprop = rop;
- break;
- default:
- stiprop = rop;
- rop = GXcopy;
- }
- }
- fgfill = PFILL(pGC->fgPixel);
- bgfill = PFILL(pGC->bgPixel);
-
- /*
- * OK, so what's going on here? We have two Drawables:
- *
- * The Stipple:
- * Depth = 1
- * Width = stippleWidth
- * Words per scanline = stwidth
- * Pointer to pixels = pStipple->devPrivate.ptr
- */
- pStipple = pGC->stipple;
-
- stwidth = pStipple->devKind / PGSZB;
- stippleWidth = pStipple->drawable.width;
- stippleHeight = pStipple->drawable.height;
-
- /*
- * The Target:
- * Depth = PSZ
- * Width = determined from *pwidth
- * Words per scanline = nlwidth
- * Pointer to pixels = addrlBase
- */
-
- cfbGetLongWidthAndPointer (pDrawable, nlwidth, addrlBase)
-
- /* this replaces rotating the stipple. Instead we just adjust the offset
- * at which we start grabbing bits from the stipple.
- * Ensure that ppt->x - xSrc >= 0 and ppt->y - ySrc >= 0,
- * so that iline and xrem always stay within the stipple bounds.
- */
- modulus (pGC->patOrg.x, stippleWidth, xSrc);
- xSrc += pDrawable->x - stippleWidth;
- modulus (pGC->patOrg.y, stippleHeight, ySrc);
- ySrc += pDrawable->y - stippleHeight;
-
- while (n--)
- {
- iline = (ppt->y - ySrc) % stippleHeight;
- x = ppt->x;
- pdst = addrlBase + (ppt->y * nlwidth);
- psrcS = (CfbBits *) pStipple->devPrivate.ptr + (iline * stwidth);
-
- if (*pwidth)
- {
- width = *pwidth;
- while(width > 0)
- {
- int xtemp;
-#if PSZ != 32 || PPW != 1
- int tmpx;
-#endif
- register CfbBits *ptemp;
- register CfbBits *pdsttmp;
- /*
- * Do a stripe through the stipple & destination w pixels
- * wide. w is not more than:
- * - the width of the destination
- * - the width of the stipple
- * - the distance between x and the next word
- * boundary in the destination
- * - the distance between x and the next word
- * boundary in the stipple
- */
-
- /* width of dest/stipple */
- xrem = (x - xSrc) % stippleWidth;
-#if PSZ == 24
- w = 1;
-#else
- w = min((stippleWidth - xrem), width);
- /* dist to word bound in dest */
- w = min(w, PPW - (x & PIM));
- /* dist to word bound in stip */
- w = min(w, MFB_PPW - (x & MFB_PIM));
-#endif
-
- xtemp = (xrem & MFB_PIM);
- ptemp = (CfbBits *)(psrcS + (xrem >> MFB_PWSH));
-#if PSZ == 24
- tmpx = x & 3;
- pdsttmp = pdst + ((x * 3)>>2);
-#else
-#if PSZ != 32 || PPW != 1
- tmpx = x & PIM;
-#endif
- pdsttmp = pdst + (x>>PWSH);
-#endif
- switch ( pGC->fillStyle ) {
- case FillOpaqueStippled:
-#if PSZ == 24
- getstipplepixels24(ptemp, xtemp, 0, &bgfill, &tmpDst1, xrem);
- getstipplepixels24(ptemp, xtemp, 1, &fgfill, &tmpDst2, xrem);
-#else
- getstipplepixels(ptemp, xtemp, w, 0, &bgfill, &tmpDst1);
- getstipplepixels(ptemp, xtemp, w, 1, &fgfill, &tmpDst2);
-#endif
- break;
- case FillStippled:
- /* Fill tmpSrc with the source pixels */
-#if PSZ == 24
- getbits24(pdsttmp, tmpSrc, x);
- getstipplepixels24(ptemp, xtemp, 0, &tmpSrc, &tmpDst1, xrem);
-#else
- getbits(pdsttmp, tmpx, w, tmpSrc);
- getstipplepixels(ptemp, xtemp, w, 0, &tmpSrc, &tmpDst1);
-#endif
- if (rop != stiprop) {
-#if PSZ == 24
- putbitsrop24(fgfill, 0, &tmpSrc, pGC->planemask, stiprop);
-#else
- putbitsrop(fgfill, 0, w, &tmpSrc, pGC->planemask, stiprop);
-#endif
- } else {
- tmpSrc = fgfill;
- }
-#if PSZ == 24
- getstipplepixels24(ptemp, xtemp, 1, &tmpSrc, &tmpDst2, xrem);
-#else
- getstipplepixels(ptemp, xtemp, w, 1, &tmpSrc, &tmpDst2);
-#endif
- break;
- }
- tmpDst2 |= tmpDst1;
-#if PSZ == 24
- putbitsrop24(tmpDst2, tmpx, pdsttmp, pGC->planemask, rop);
-#else
- putbitsrop(tmpDst2, tmpx, w, pdsttmp, pGC->planemask, rop);
-#endif
- x += w;
- width -= w;
- }
- }
- ppt++;
- pwidth++;
- }
- xfree(pptFree);
- xfree(pwidthFree);
-}
-
-#endif /* PSZ == 8 */
-
-#if PSZ == 8
-
-void
-cfb8Stipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
- DrawablePtr pDrawable;
- GCPtr pGC;
- int nInit; /* number of spans to fill */
- DDXPointPtr pptInit; /* pointer to list of start points */
- int *pwidthInit; /* pointer to list of n widths */
- int fSorted;
-{
- /* next three parameters are post-clip */
- int n; /* number of spans to fill */
- DDXPointPtr ppt; /* pointer to list of start points */
- int *pwidth; /* pointer to list of n widths */
- CfbBits *src; /* pointer to bits in stipple, if needed */
- int stippleHeight; /* height of the stipple */
- PixmapPtr stipple;
-
- int nlwDst; /* width in longwords of the dest pixmap */
- int x,y,w; /* current span */
- CfbBits startmask;
- CfbBits endmask;
- register CfbBits *dst; /* pointer to bits we're writing */
- register int nlw;
- CfbBits *dstTmp;
- int nlwTmp;
-
- CfbBits *pbits; /* pointer to start of pixmap */
- register CfbBits xor;
- register CfbBits mask;
- register CfbBits bits; /* bits from stipple */
- int wEnd;
-
- int *pwidthFree; /* copies of the pointers to free */
- DDXPointPtr pptFree;
- cfbPrivGCPtr devPriv;
-
- devPriv = cfbGetGCPrivate(pGC);
- cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask);
- n = nInit * miFindMaxBand(pGC->pCompositeClip);
- if ( n == 0 )
- return;
- pwidthFree = (int *)xalloc(n * sizeof(int));
- pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
- if(!pptFree || !pwidthFree)
- {
- if (pptFree) xfree(pptFree);
- if (pwidthFree) xfree(pwidthFree);
- return;
- }
- pwidth = pwidthFree;
- ppt = pptFree;
- n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit,
- ppt, pwidth, fSorted);
-
- stipple = pGC->pRotatedPixmap;
- src = (CfbBits *)stipple->devPrivate.ptr;
- stippleHeight = stipple->drawable.height;
-
- cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits)
-
- while (n--)
- {
- w = *pwidth++;
- x = ppt->x;
- y = ppt->y;
- ppt++;
- dst = pbits + (y * nlwDst) + (x >> PWSH);
- if (((x & PIM) + w) <= PPW)
- {
- maskpartialbits(x, w, startmask);
- endmask = 0;
- nlw = 0;
- }
- else
- {
- maskbits (x, w, startmask, endmask, nlw);
- }
- bits = src[y % stippleHeight];
- RotBitsLeft (bits, (x & ((PGSZ-1) & ~PIM)));
-#if PPW == 4
- if (cfb8StippleRRop == GXcopy)
- {
- xor = devPriv->xor;
- if (w < (PGSZ*2))
- {
- if (startmask)
- {
- mask = cfb8PixelMasks[GetBitGroup(bits)];
- *dst = (*dst & ~(mask & startmask)) |
- (xor & (mask & startmask));
- dst++;
- RotBitsLeft (bits, PGSZB);
- }
- while (nlw--)
- {
- WriteBitGroup (dst,xor,GetBitGroup(bits))
- dst++;
- RotBitsLeft (bits, PGSZB);
- }
- if (endmask)
- {
- mask = cfb8PixelMasks[GetBitGroup(bits)];
- *dst = (*dst & ~(mask & endmask)) |
- (xor & (mask & endmask));
- }
- }
- else
- { /* XXX constants probably not OK here */
- wEnd = 7 - (nlw & 7);
- nlw = (nlw >> 3) + 1;
- dstTmp = dst;
- nlwTmp = nlw;
- if (startmask)
- {
- mask = cfb8PixelMasks[GetBitGroup(bits)];
- *dstTmp = (*dstTmp & ~(mask & startmask)) |
- (xor & (mask & startmask));
- dstTmp++;
- RotBitsLeft (bits, PGSZB);
- }
- w = 7 - wEnd;
- while (w--)
- {
- dst = dstTmp;
- dstTmp++;
- nlw = nlwTmp;
-#if defined(__GNUC__) && defined(mc68020)
- mask = cfb8PixelMasks[GetBitGroup(bits)];
- xor = xor & mask;
- mask = ~mask;
- while (nlw--)
- {
- *dst = (*dst & mask) | xor;
- dst += 8;
- }
- xor = devPriv->xor;
-#else
-#define SwitchBitsLoop(body) \
- while (nlw--) \
- { \
- body \
- dst += 8; \
- }
- SwitchBitGroup(dst, xor, GetBitGroup(bits));
-#undef SwitchBitsLoop
-#endif
- NextBitGroup (bits);
- }
- nlwTmp--;
- w = wEnd + 1;
- if (endmask)
- {
- mask = cfb8PixelMasks[GetBitGroup(bits)];
- dst = dstTmp + (nlwTmp << 3);
- *dst = (*dst & ~(mask & endmask)) |
- (xor & (mask & endmask));
- }
- while (w--)
- {
- nlw = nlwTmp;
- dst = dstTmp;
- dstTmp++;
-#if defined(__GNUC__) && defined(mc68020)
- mask = cfb8PixelMasks[GetBitGroup(bits)];
- xor = xor & mask;
- mask = ~mask;
- while (nlw--)
- {
- *dst = (*dst & mask) | xor;
- dst += 8;
- }
- xor = devPriv->xor;
-#else
-#define SwitchBitsLoop(body) \
- while (nlw--) \
- { \
- body \
- dst += 8; \
- }
- SwitchBitGroup(dst, xor, GetBitGroup(bits));
-#undef SwitchBitsLoop
-#endif
- NextBitGroup (bits);
- }
- }
- }
- else
-#endif /* PPW == 4 */
- {
- if (startmask)
- {
- xor = GetBitGroup(bits);
- *dst = MaskRRopPixels(*dst, xor, startmask);
- dst++;
- RotBitsLeft (bits, PGSZB);
- }
- while (nlw--)
- {
- RRopBitGroup(dst, GetBitGroup(bits));
- dst++;
- RotBitsLeft (bits, PGSZB);
- }
- if (endmask)
- {
- xor = GetBitGroup(bits);
- *dst = MaskRRopPixels(*dst, xor, endmask);
- }
- }
- }
- xfree(pptFree);
- xfree(pwidthFree);
-}
-
-void
-cfb8OpaqueStipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
- DrawablePtr pDrawable;
- GCPtr pGC;
- int nInit; /* number of spans to fill */
- DDXPointPtr pptInit; /* pointer to list of start points */
- int *pwidthInit; /* pointer to list of n widths */
- int fSorted;
-{
- /* next three parameters are post-clip */
- int n; /* number of spans to fill */
- DDXPointPtr ppt; /* pointer to list of start points */
- int *pwidth; /* pointer to list of n widths */
- CfbBits *src; /* pointer to bits in stipple, if needed */
- int stippleHeight; /* height of the stipple */
- PixmapPtr stipple;
-
- int nlwDst; /* width in longwords of the dest pixmap */
- int x,y,w; /* current span */
- CfbBits startmask;
- CfbBits endmask;
- register CfbBits *dst; /* pointer to bits we're writing */
- register int nlw;
- CfbBits *dstTmp;
- int nlwTmp;
-
- CfbBits *pbits; /* pointer to start of pixmap */
- register CfbBits xor;
- register CfbBits bits; /* bits from stipple */
- int wEnd;
-
- int *pwidthFree; /* copies of the pointers to free */
- DDXPointPtr pptFree;
- cfbPrivGCPtr devPriv;
-
- devPriv = cfbGetGCPrivate(pGC);
-
- cfb8CheckOpaqueStipple(pGC->alu, pGC->fgPixel, pGC->bgPixel, pGC->planemask);
-
- n = nInit * miFindMaxBand(pGC->pCompositeClip);
- if ( n == 0 )
- return;
- pwidthFree = (int *)xalloc(n * sizeof(int));
- pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
- if(!pptFree || !pwidthFree)
- {
- if (pptFree) xfree(pptFree);
- if (pwidthFree) xfree(pwidthFree);
- return;
- }
- pwidth = pwidthFree;
- ppt = pptFree;
- n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit,
- ppt, pwidth, fSorted);
-
- stipple = pGC->pRotatedPixmap;
- src = (CfbBits *)stipple->devPrivate.ptr;
- stippleHeight = stipple->drawable.height;
-
- cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits)
-
- while (n--)
- {
- w = *pwidth++;
- x = ppt->x;
- y = ppt->y;
- ppt++;
- dst = pbits + (y * nlwDst) + (x >> PWSH);
- if (((x & PIM) + w) <= PPW)
- {
- maskpartialbits(x, w, startmask);
- endmask = 0;
- nlw = 0;
- }
- else
- {
- maskbits (x, w, startmask, endmask, nlw);
- }
- bits = src[y % stippleHeight];
- RotBitsLeft (bits, (x & ((PGSZ-1) & ~PIM)));
-#if PPW == 4
- if (cfb8StippleRRop == GXcopy)
- {
- xor = devPriv->xor;
- if (w < PGSZ*2)
- {
- if (startmask)
- {
- *dst = (*dst & ~startmask) |
- (GetPixelGroup (bits) & startmask);
- dst++;
- RotBitsLeft (bits, PGSZB);
- }
- while (nlw--)
- {
- *dst++ = GetPixelGroup(bits);
- RotBitsLeft (bits, PGSZB);
- }
- if (endmask)
- {
- *dst = (*dst & ~endmask) |
- (GetPixelGroup (bits) & endmask);
- }
- }
- else
- { /* XXX consts probably not OK here */
- wEnd = 7 - (nlw & 7);
- nlw = (nlw >> 3) + 1;
- dstTmp = dst;
- nlwTmp = nlw;
- if (startmask)
- {
- *dstTmp = (*dstTmp & ~startmask) |
- (GetPixelGroup (bits) & startmask);
- dstTmp++;
- RotBitsLeft (bits, PGSZB);
- }
- w = 7 - wEnd;
- while (w--)
- {
- nlw = nlwTmp;
- dst = dstTmp;
- dstTmp++;
- xor = GetPixelGroup (bits);
- while (nlw--)
- {
- *dst = xor;
- dst += 8;
- }
- NextBitGroup (bits);
- }
- nlwTmp--;
- w = wEnd + 1;
- if (endmask)
- {
- dst = dstTmp + (nlwTmp << 3);
- *dst = (*dst & ~endmask) |
- (GetPixelGroup (bits) & endmask);
- }
- while (w--)
- {
- nlw = nlwTmp;
- dst = dstTmp;
- dstTmp++;
- xor = GetPixelGroup (bits);
- while (nlw--)
- {
- *dst = xor;
- dst += 8;
- }
- NextBitGroup (bits);
- }
- }
- }
- else
-#endif /* PPW == 4 */
- {
- if (startmask)
- {
- xor = GetBitGroup(bits);
- *dst = MaskRRopPixels(*dst, xor, startmask);
- dst++;
- RotBitsLeft (bits, PGSZB);
- }
- while (nlw--)
- {
- RRopBitGroup(dst, GetBitGroup(bits));
- dst++;
- RotBitsLeft (bits, PGSZB);
- }
- if (endmask)
- {
- xor = GetBitGroup(bits);
- *dst = MaskRRopPixels(*dst, xor, endmask);
- }
- }
- }
- xfree(pptFree);
- xfree(pwidthFree);
-}
-
-#endif /* PSZ == 8 */
diff --git a/cfb/cfbgc.c b/cfb/cfbgc.c
deleted file mode 100644
index a74c28c15..000000000
--- a/cfb/cfbgc.c
+++ /dev/null
@@ -1,799 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 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.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <X11/Xproto.h>
-#include "cfb.h"
-#include <X11/fonts/fontstruct.h>
-#include "dixfontstr.h"
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-#include "region.h"
-
-#include "mistruct.h"
-#include "mibstore.h"
-#include "migc.h"
-
-#include "cfbmskbits.h"
-#include "cfb8bit.h"
-
-#if PSZ == 8
-# define useTEGlyphBlt cfbTEGlyphBlt8
-#else
-# ifdef WriteBitGroup
-# define useTEGlyphBlt cfbImageGlyphBlt8
-# else
-# define useTEGlyphBlt cfbTEGlyphBlt
-# endif
-#endif
-
-#ifdef WriteBitGroup
-# define useImageGlyphBlt cfbImageGlyphBlt8
-# define usePolyGlyphBlt cfbPolyGlyphBlt8
-#else
-# define useImageGlyphBlt miImageGlyphBlt
-# define usePolyGlyphBlt miPolyGlyphBlt
-#endif
-
-static void cfbUnPushPixels (GCPtr, PixmapPtr, DrawablePtr, int, int, int, int);
-
-#ifdef FOUR_BIT_CODE
-# define usePushPixels cfbPushPixels8
-#else
-# define usePushPixels cfbUnPushPixels
-#endif
-
-#ifdef PIXEL_ADDR
-# define ZeroPolyArc cfbZeroPolyArcSS8Copy
-#else
-# define ZeroPolyArc miZeroPolyArc
-#endif
-
-GCFuncs cfbGCFuncs = {
- cfbValidateGC,
- miChangeGC,
- miCopyGC,
- miDestroyGC,
- miChangeClip,
- miDestroyClip,
- miCopyClip,
-};
-
-GCOps cfbTEOps1Rect = {
- cfbSolidSpansCopy,
- cfbSetSpans,
- cfbPutImage,
- cfbCopyArea,
- cfbCopyPlane,
- cfbPolyPoint,
-#ifdef PIXEL_ADDR
- cfb8LineSS1Rect,
- cfb8SegmentSS1Rect,
-#else
- cfbLineSS,
- cfbSegmentSS,
-#endif
- miPolyRectangle,
- ZeroPolyArc,
- cfbFillPoly1RectCopy,
- cfbPolyFillRect,
- cfbPolyFillArcSolidCopy,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- useTEGlyphBlt,
- usePolyGlyphBlt,
- usePushPixels
-};
-
-GCOps cfbNonTEOps1Rect = {
- cfbSolidSpansCopy,
- cfbSetSpans,
- cfbPutImage,
- cfbCopyArea,
- cfbCopyPlane,
- cfbPolyPoint,
-#ifdef PIXEL_ADDR
- cfb8LineSS1Rect,
- cfb8SegmentSS1Rect,
-#else
- cfbLineSS,
- cfbSegmentSS,
-#endif
- miPolyRectangle,
- ZeroPolyArc,
- cfbFillPoly1RectCopy,
- cfbPolyFillRect,
- cfbPolyFillArcSolidCopy,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- useImageGlyphBlt,
- usePolyGlyphBlt,
- usePushPixels
-};
-
-GCOps cfbTEOps = {
- cfbSolidSpansCopy,
- cfbSetSpans,
- cfbPutImage,
- cfbCopyArea,
- cfbCopyPlane,
- cfbPolyPoint,
- cfbLineSS,
- cfbSegmentSS,
- miPolyRectangle,
- ZeroPolyArc,
- miFillPolygon,
- cfbPolyFillRect,
- cfbPolyFillArcSolidCopy,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- useTEGlyphBlt,
- usePolyGlyphBlt,
- usePushPixels
-};
-
-GCOps cfbNonTEOps = {
- cfbSolidSpansCopy,
- cfbSetSpans,
- cfbPutImage,
- cfbCopyArea,
- cfbCopyPlane,
- cfbPolyPoint,
- cfbLineSS,
- cfbSegmentSS,
- miPolyRectangle,
-#ifdef PIXEL_ADDR
- cfbZeroPolyArcSS8Copy,
-#else
- miZeroPolyArc,
-#endif
- miFillPolygon,
- cfbPolyFillRect,
- cfbPolyFillArcSolidCopy,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- useImageGlyphBlt,
- usePolyGlyphBlt,
- usePushPixels
-};
-
-GCOps *
-cfbMatchCommon (pGC, devPriv)
- GCPtr pGC;
- cfbPrivGCPtr devPriv;
-{
- if (pGC->lineWidth != 0)
- return 0;
- if (pGC->lineStyle != LineSolid)
- return 0;
- if (pGC->fillStyle != FillSolid)
- return 0;
- if (devPriv->rop != GXcopy)
- return 0;
- if (pGC->font &&
- FONTMAXBOUNDS(pGC->font,rightSideBearing) -
- FONTMINBOUNDS(pGC->font,leftSideBearing) <= 32 &&
- FONTMINBOUNDS(pGC->font,characterWidth) >= 0)
- {
- if (TERMINALFONT(pGC->font)
-#ifdef FOUR_BIT_CODE
- && FONTMAXBOUNDS(pGC->font,characterWidth) >= PGSZB
-#endif
- )
-#ifdef NO_ONE_RECT
- return &cfbTEOps1Rect;
-#else
- if (devPriv->oneRect)
- return &cfbTEOps1Rect;
- else
- return &cfbTEOps;
-#endif
- else
-#ifdef NO_ONE_RECT
- return &cfbNonTEOps1Rect;
-#else
- if (devPriv->oneRect)
- return &cfbNonTEOps1Rect;
- else
- return &cfbNonTEOps;
-#endif
- }
- return 0;
-}
-
-Bool
-cfbCreateGC(pGC)
- register GCPtr pGC;
-{
- cfbPrivGC *pPriv;
-
- if (PixmapWidthPaddingInfo[pGC->depth].padPixelsLog2 == LOG2_BITMAP_PAD)
- return (mfbCreateGC(pGC));
- pGC->clientClip = NULL;
- pGC->clientClipType = CT_NONE;
-
- if (cfbNonTEOps.PushPixels == cfbUnPushPixels)
- {
- cfbTEOps1Rect.PushPixels = mfbPushPixelsWeak();
- cfbNonTEOps1Rect.PushPixels = mfbPushPixelsWeak();
- cfbTEOps.PushPixels = mfbPushPixelsWeak();
- cfbNonTEOps.PushPixels = mfbPushPixelsWeak();
- }
-
- /*
- * some of the output primitives aren't really necessary, since they
- * will be filled in ValidateGC because of dix/CreateGC() setting all
- * the change bits. Others are necessary because although they depend
- * on being a color frame buffer, they don't change
- */
-
- pGC->ops = &cfbNonTEOps;
- pGC->funcs = &cfbGCFuncs;
-
- /* cfb wants to translate before scan conversion */
- pGC->miTranslate = 1;
-
- pPriv = cfbGetGCPrivate(pGC);
- pPriv->rop = pGC->alu;
- pPriv->oneRect = FALSE;
- pGC->fExpose = TRUE;
- pGC->freeCompClip = FALSE;
- pGC->pRotatedPixmap = (PixmapPtr) NULL;
- return TRUE;
-}
-
-/* Clipping conventions
- if the drawable is a window
- CT_REGION ==> pCompositeClip really is the composite
- CT_other ==> pCompositeClip is the window clip region
- if the drawable is a pixmap
- CT_REGION ==> pCompositeClip is the translated client region
- clipped to the pixmap boundary
- CT_other ==> pCompositeClip is the pixmap bounding box
-*/
-
-void
-cfbValidateGC(pGC, changes, pDrawable)
- register GCPtr pGC;
- unsigned long changes;
- DrawablePtr pDrawable;
-{
- int mask; /* stateChanges */
- int index; /* used for stepping through bitfields */
- int new_rrop;
- int new_line, new_text, new_fillspans, new_fillarea;
- int new_rotate;
- int xrot, yrot;
- /* flags for changing the proc vector */
- cfbPrivGCPtr devPriv;
- int oneRect;
-
- new_rotate = pGC->lastWinOrg.x != pDrawable->x ||
- pGC->lastWinOrg.y != pDrawable->y;
-
- pGC->lastWinOrg.x = pDrawable->x;
- pGC->lastWinOrg.y = pDrawable->y;
- devPriv = cfbGetGCPrivate(pGC);
-
- new_rrop = FALSE;
- new_line = FALSE;
- new_text = FALSE;
- new_fillspans = FALSE;
- new_fillarea = FALSE;
-
- /*
- * if the client clip is different or moved OR the subwindowMode has
- * changed OR the window's clip has changed since the last validation
- * we need to recompute the composite clip
- */
-
- if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) ||
- (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS))
- )
- {
- miComputeCompositeClip (pGC, pDrawable);
-#ifdef NO_ONE_RECT
- devPriv->oneRect = FALSE;
-#else
- oneRect = REGION_NUM_RECTS(pGC->pCompositeClip) == 1;
- if (oneRect != devPriv->oneRect)
- new_line = TRUE;
- devPriv->oneRect = oneRect;
-#endif
- }
-
- mask = changes;
- while (mask) {
- index = lowbit (mask);
- mask &= ~index;
-
- /*
- * this switch acculmulates a list of which procedures might have
- * to change due to changes in the GC. in some cases (e.g.
- * changing one 16 bit tile for another) we might not really need
- * a change, but the code is being paranoid. this sort of batching
- * wins if, for example, the alu and the font have been changed,
- * or any other pair of items that both change the same thing.
- */
- switch (index) {
- case GCFunction:
- case GCForeground:
- new_rrop = TRUE;
- break;
- case GCPlaneMask:
- new_rrop = TRUE;
- new_text = TRUE;
- break;
- case GCBackground:
- break;
- case GCLineStyle:
- case GCLineWidth:
- new_line = TRUE;
- break;
- case GCJoinStyle:
- case GCCapStyle:
- break;
- case GCFillStyle:
- new_text = TRUE;
- new_fillspans = TRUE;
- new_line = TRUE;
- new_fillarea = TRUE;
- break;
- case GCFillRule:
- break;
- case GCTile:
- new_fillspans = TRUE;
- new_fillarea = TRUE;
- break;
-
- case GCStipple:
- if (pGC->stipple)
- {
- int width = pGC->stipple->drawable.width;
- PixmapPtr nstipple;
-
- if ((width <= PGSZ) && !(width & (width - 1)) &&
- (nstipple = cfbCopyPixmap(pGC->stipple)))
- {
- cfbPadPixmap(nstipple);
- (*pGC->pScreen->DestroyPixmap)(pGC->stipple);
- pGC->stipple = nstipple;
- }
- }
- new_fillspans = TRUE;
- new_fillarea = TRUE;
- break;
-
- case GCTileStipXOrigin:
- new_rotate = TRUE;
- break;
-
- case GCTileStipYOrigin:
- new_rotate = TRUE;
- break;
-
- case GCFont:
- new_text = TRUE;
- break;
- case GCSubwindowMode:
- break;
- case GCGraphicsExposures:
- break;
- case GCClipXOrigin:
- break;
- case GCClipYOrigin:
- break;
- case GCClipMask:
- break;
- case GCDashOffset:
- break;
- case GCDashList:
- break;
- case GCArcMode:
- break;
- default:
- break;
- }
- }
-
- /*
- * If the drawable has changed, ensure suitable
- * entries are in the proc vector.
- */
- if (pDrawable->serialNumber != (pGC->serialNumber & (DRAWABLE_SERIAL_BITS))) {
- new_fillspans = TRUE; /* deal with FillSpans later */
- }
-
- if (new_rotate || new_fillspans)
- {
- Bool new_pix = FALSE;
-
- xrot = pGC->patOrg.x + pDrawable->x;
- yrot = pGC->patOrg.y + pDrawable->y;
-
- switch (pGC->fillStyle)
- {
- case FillTiled:
- if (!pGC->tileIsPixel)
- {
- int width = pGC->tile.pixmap->drawable.width * PSZ;
-
- if ((width <= PGSZ) && !(width & (width - 1)))
- {
- cfbCopyRotatePixmap(pGC->tile.pixmap, &pGC->pRotatedPixmap,
- xrot, yrot);
- new_pix = TRUE;
- }
- }
- break;
-#ifdef FOUR_BIT_CODE
- case FillStippled:
- case FillOpaqueStippled:
- {
- int width = pGC->stipple->drawable.width;
-
- if ((width <= PGSZ) && !(width & (width - 1)))
- {
- mfbCopyRotatePixmap(pGC->stipple, &pGC->pRotatedPixmap,
- xrot, yrot);
- new_pix = TRUE;
- }
- }
- break;
-#endif
- }
- if (!new_pix && pGC->pRotatedPixmap)
- {
- (*pGC->pScreen->DestroyPixmap)(pGC->pRotatedPixmap);
- pGC->pRotatedPixmap = (PixmapPtr) NULL;
- }
- }
-
- if (new_rrop)
- {
- int old_rrop;
-
- old_rrop = devPriv->rop;
- devPriv->rop = cfbReduceRasterOp (pGC->alu, pGC->fgPixel,
- pGC->planemask,
- &devPriv->and, &devPriv->xor);
- if (old_rrop == devPriv->rop)
- new_rrop = FALSE;
- else
- {
-#ifdef PIXEL_ADDR
- new_line = TRUE;
-#endif
-#ifdef WriteBitGroup
- new_text = TRUE;
-#endif
- new_fillspans = TRUE;
- new_fillarea = TRUE;
- }
- }
-
- if (new_rrop || new_fillspans || new_text || new_fillarea || new_line)
- {
- GCOps *newops;
-
- if ((newops = cfbMatchCommon (pGC, devPriv)))
- {
- if (pGC->ops->devPrivate.val)
- miDestroyGCOps (pGC->ops);
- pGC->ops = newops;
- new_rrop = new_line = new_fillspans = new_text = new_fillarea = 0;
- }
- else
- {
- if (!pGC->ops->devPrivate.val)
- {
- pGC->ops = miCreateGCOps (pGC->ops);
- pGC->ops->devPrivate.val = 1;
- }
- }
- }
-
- /* deal with the changes we've collected */
- if (new_line)
- {
- pGC->ops->FillPolygon = miFillPolygon;
-#ifdef NO_ONE_RECT
- if (pGC->fillStyle == FillSolid)
- {
- switch (devPriv->rop) {
- case GXcopy:
- pGC->ops->FillPolygon = cfbFillPoly1RectCopy;
- break;
- default:
- pGC->ops->FillPolygon = cfbFillPoly1RectGeneral;
- break;
- }
- }
-#else
- if (devPriv->oneRect && pGC->fillStyle == FillSolid)
- {
- switch (devPriv->rop) {
- case GXcopy:
- pGC->ops->FillPolygon = cfbFillPoly1RectCopy;
- break;
- default:
- pGC->ops->FillPolygon = cfbFillPoly1RectGeneral;
- break;
- }
- }
-#endif
- if (pGC->lineWidth == 0)
- {
-#ifdef PIXEL_ADDR
- if ((pGC->lineStyle == LineSolid) && (pGC->fillStyle == FillSolid))
- {
- switch (devPriv->rop)
- {
- case GXxor:
- pGC->ops->PolyArc = cfbZeroPolyArcSS8Xor;
- break;
- case GXcopy:
- pGC->ops->PolyArc = cfbZeroPolyArcSS8Copy;
- break;
- default:
- pGC->ops->PolyArc = cfbZeroPolyArcSS8General;
- break;
- }
- }
- else
-#endif
- pGC->ops->PolyArc = miZeroPolyArc;
- }
- else
- pGC->ops->PolyArc = miPolyArc;
- pGC->ops->PolySegment = miPolySegment;
- switch (pGC->lineStyle)
- {
- case LineSolid:
- if(pGC->lineWidth == 0)
- {
- if (pGC->fillStyle == FillSolid)
- {
-#if defined(PIXEL_ADDR) && !defined(NO_ONE_RECT)
- if (devPriv->oneRect &&
- ((pDrawable->x >= pGC->pScreen->width - 32768) &&
- (pDrawable->y >= pGC->pScreen->height - 32768)))
- {
- pGC->ops->Polylines = cfb8LineSS1Rect;
- pGC->ops->PolySegment = cfb8SegmentSS1Rect;
- } else
-#endif
-#ifdef NO_ONE_RECT
- {
- pGC->ops->Polylines = cfb8LineSS1Rect;
- pGC->ops->PolySegment = cfb8SegmentSS1Rect;
- }
-#else
- {
- pGC->ops->Polylines = cfbLineSS;
- pGC->ops->PolySegment = cfbSegmentSS;
- }
-#endif
- }
- else
- pGC->ops->Polylines = miZeroLine;
- }
- else
- pGC->ops->Polylines = miWideLine;
- break;
- case LineOnOffDash:
- case LineDoubleDash:
- if (pGC->lineWidth == 0 && pGC->fillStyle == FillSolid)
- {
- pGC->ops->Polylines = cfbLineSD;
- pGC->ops->PolySegment = cfbSegmentSD;
- } else
- pGC->ops->Polylines = miWideDash;
- break;
- }
- }
-
- if (new_text && (pGC->font))
- {
- if (FONTMAXBOUNDS(pGC->font,rightSideBearing) -
- FONTMINBOUNDS(pGC->font,leftSideBearing) > 32 ||
- FONTMINBOUNDS(pGC->font,characterWidth) < 0)
- {
- pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
- pGC->ops->ImageGlyphBlt = miImageGlyphBlt;
- }
- else
- {
-#ifdef WriteBitGroup
- if (pGC->fillStyle == FillSolid)
- {
- if (devPriv->rop == GXcopy)
- pGC->ops->PolyGlyphBlt = cfbPolyGlyphBlt8;
- else
-#ifdef FOUR_BIT_CODE
- pGC->ops->PolyGlyphBlt = cfbPolyGlyphRop8;
-#else
- pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
-#endif
- }
- else
-#endif
- pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
- /* special case ImageGlyphBlt for terminal emulator fonts */
-#if !defined(WriteBitGroup) || PSZ == 8
- if (TERMINALFONT(pGC->font) &&
- (pGC->planemask & PMSK) == PMSK
-#ifdef FOUR_BIT_CODE
- && FONTMAXBOUNDS(pGC->font,characterWidth) >= PGSZB
-#endif
- )
- {
- pGC->ops->ImageGlyphBlt = useTEGlyphBlt;
- }
- else
-#endif
- {
-#ifdef WriteBitGroup
- if (devPriv->rop == GXcopy &&
- pGC->fillStyle == FillSolid &&
- (pGC->planemask & PMSK) == PMSK)
- pGC->ops->ImageGlyphBlt = cfbImageGlyphBlt8;
- else
-#endif
- pGC->ops->ImageGlyphBlt = miImageGlyphBlt;
- }
- }
- }
-
-
- if (new_fillspans) {
- switch (pGC->fillStyle) {
- case FillSolid:
- switch (devPriv->rop) {
- case GXcopy:
- pGC->ops->FillSpans = cfbSolidSpansCopy;
- break;
- case GXxor:
- pGC->ops->FillSpans = cfbSolidSpansXor;
- break;
- default:
- pGC->ops->FillSpans = cfbSolidSpansGeneral;
- break;
- }
- break;
- case FillTiled:
- if (pGC->pRotatedPixmap)
- {
- if (pGC->alu == GXcopy && (pGC->planemask & PMSK) == PMSK)
- pGC->ops->FillSpans = cfbTile32FSCopy;
- else
- pGC->ops->FillSpans = cfbTile32FSGeneral;
- }
- else
- pGC->ops->FillSpans = cfbUnnaturalTileFS;
- break;
- case FillStippled:
-#ifdef FOUR_BIT_CODE
- if (pGC->pRotatedPixmap)
- pGC->ops->FillSpans = cfb8Stipple32FS;
- else
-#endif
- pGC->ops->FillSpans = cfbUnnaturalStippleFS;
- break;
- case FillOpaqueStippled:
-#ifdef FOUR_BIT_CODE
- if (pGC->pRotatedPixmap)
- pGC->ops->FillSpans = cfb8OpaqueStipple32FS;
- else
-#endif
- pGC->ops->FillSpans = cfbUnnaturalStippleFS;
- break;
- default:
- FatalError("cfbValidateGC: illegal fillStyle\n");
- }
- } /* end of new_fillspans */
-
- if (new_fillarea) {
-#ifndef FOUR_BIT_CODE
- pGC->ops->PolyFillRect = miPolyFillRect;
- if (pGC->fillStyle == FillSolid || pGC->fillStyle == FillTiled)
- {
- pGC->ops->PolyFillRect = cfbPolyFillRect;
- }
-#endif
-#ifdef FOUR_BIT_CODE
- pGC->ops->PushPixels = mfbPushPixelsWeak();
- if (pGC->fillStyle == FillSolid && devPriv->rop == GXcopy)
- pGC->ops->PushPixels = cfbPushPixels8;
-#endif
- pGC->ops->PolyFillArc = miPolyFillArc;
- if (pGC->fillStyle == FillSolid)
- {
- switch (devPriv->rop)
- {
- case GXcopy:
- pGC->ops->PolyFillArc = cfbPolyFillArcSolidCopy;
- break;
- default:
- pGC->ops->PolyFillArc = cfbPolyFillArcSolidGeneral;
- break;
- }
- }
- }
-}
-
-/*
- * this is never called, it just exists to have its address
- * taken in mfbCreateGC.
- */
-static void
-cfbUnPushPixels (pGC, pBitmap, pDrawable, dx, dy, xOrg, yOrg)
- GCPtr pGC;
- PixmapPtr pBitmap;
- DrawablePtr pDrawable;
- int dx, dy, xOrg, yOrg;
-{
- return;
-}
diff --git a/cfb/cfbgetsp.c b/cfb/cfbgetsp.c
deleted file mode 100644
index 672196a6c..000000000
--- a/cfb/cfbgetsp.c
+++ /dev/null
@@ -1,213 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 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.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include "servermd.h"
-
-#include "misc.h"
-#include "region.h"
-#include "gc.h"
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-
-#include "cfb.h"
-#include "cfbmskbits.h"
-
-/* GetSpans -- for each span, gets bits from drawable starting at ppt[i]
- * and continuing for pwidth[i] bits
- * Each scanline returned will be server scanline padded, i.e., it will come
- * out to an integral number of words.
- */
-void
-cfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart)
- DrawablePtr pDrawable; /* drawable from which to get bits */
- int wMax; /* largest value of all *pwidths */
- register DDXPointPtr ppt; /* points to start copying from */
- int *pwidth; /* list of number of bits to copy */
- int nspans; /* number of scanlines to copy */
- char *pchardstStart; /* where to put the bits */
-{
- PixelGroup *pdstStart = (PixelGroup *)pchardstStart;
- register PixelGroup *pdst; /* where to put the bits */
- register PixelGroup *psrc; /* where to get the bits */
- register PixelGroup tmpSrc; /* scratch buffer for bits */
- PixelGroup *psrcBase; /* start of src bitmap */
- int widthSrc; /* width of pixmap in bytes */
- register DDXPointPtr pptLast; /* one past last point to get */
- int xEnd; /* last pixel to copy from */
- int nl, srcBit;
- int w;
- PixelGroup *pdstNext;
-#if PSZ == 24
- register char *psrcb, *pdstb;
- register int xIndex = 0;
-#else
- register int nstart;
-#if PSZ != 32 || PPW != 1
- int nend;
-#endif
- PixelGroup startmask, endmask;
- int nlMiddle;
-#endif
-
- switch (pDrawable->bitsPerPixel) {
- case 1:
- mfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart);
- return;
- case PSZ:
- break;
- default:
- FatalError("cfbGetSpans: invalid depth\n");
- }
-
- /*
- * XFree86 DDX empties the root borderClip when the VT is
- * switched away; this checks for that case
- */
- if (!cfbDrawableEnabled(pDrawable))
- return;
-
- cfbGetLongWidthAndPointer (pDrawable, widthSrc, psrcBase)
-
-#ifdef PIXEL_ADDR
-# if PSZ != 24
- if ((nspans == 1) && (*pwidth == 1))
- {
- tmpSrc = *((PixelType *)(psrcBase + (ppt->y * widthSrc))
- + ppt->x);
-#if BITMAP_BIT_ORDER == MSBFirst
- tmpSrc <<= (sizeof (CfbBits) - sizeof (PixelType)) * 8;
-#endif
- *pdstStart = tmpSrc;
- return;
- }
-# endif /* PSZ != 24 */
-#endif
- pdst = pdstStart;
- pptLast = ppt + nspans;
- while(ppt < pptLast)
- {
-#if PSZ == 24
- xEnd = min(ppt->x + *pwidth, widthSrc * sizeof(CfbBits) / 3);
- w = xEnd - ppt->x;
- psrc = psrcBase + ppt->y * widthSrc;
- srcBit = ppt->x;
- psrcb = (char *)psrc + (ppt->x * 3);
- xIndex = 0;
- pdstb = (char *)pdst;
- pdstNext = pdst + ((w * 3 + 3) >> 2);
-#else
- xEnd = min(ppt->x + *pwidth, widthSrc << PWSH);
- w = xEnd - ppt->x;
- psrc = psrcBase + ppt->y * widthSrc + (ppt->x >> PWSH);
- srcBit = ppt->x & PIM;
- pdstNext = pdst + ((w + PPW - 1) >> PWSH);
-#endif
-
-#if PSZ == 24
- if (w < 0)
- FatalError("cfb24GetSpans: Internal error (w < 0)\n");
- nl = w;
- while (nl--){
- psrc = (PixelGroup *)((unsigned long)psrcb & ~0x03);
- getbits24(psrc, tmpSrc, srcBit);
- pdst = (PixelGroup *)((unsigned long)pdstb & ~0x03);
- putbits24(tmpSrc, PPW, pdst, ~((CfbBits)0), xIndex);
- srcBit++;
- psrcb += 3;
- xIndex++;
- pdstb += 3;
- }
- pdst = pdstNext;
-#else /* PSZ == 24 */
- if (srcBit + w <= PPW)
- {
- getbits(psrc, srcBit, w, tmpSrc);
- putbits(tmpSrc, 0, w, pdst, ~((CfbBits)0));
- pdst++;
- }
- else
- {
- maskbits(ppt->x, w, startmask, endmask, nlMiddle);
- nstart = 0;
- if (startmask)
- {
- nstart = PPW - srcBit;
- getbits(psrc, srcBit, nstart, tmpSrc);
- putbits(tmpSrc, 0, nstart, pdst, ~((CfbBits)0));
- if(srcBit + nstart >= PPW)
- psrc++;
- }
- nl = nlMiddle;
- while (nl--)
- {
- tmpSrc = *psrc;
- putbits(tmpSrc, nstart, PPW, pdst, ~((CfbBits)0));
- psrc++;
- pdst++;
- }
- if (endmask)
- {
-#if PSZ != 32 || PPW != 1
- nend = xEnd & PIM;
-#endif
- getbits(psrc, 0, nend, tmpSrc);
- putbits(tmpSrc, nstart, nend, pdst, ~((CfbBits)0));
- }
- pdst = pdstNext;
- }
-#endif /* PSZ == 24 */
- ppt++;
- pwidth++;
- }
-}
diff --git a/cfb/cfbglblt8.c b/cfb/cfbglblt8.c
deleted file mode 100644
index 4d964b35d..000000000
--- a/cfb/cfbglblt8.c
+++ /dev/null
@@ -1,477 +0,0 @@
-/*
-
-Copyright 1989, 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.
-*/
-
-/*
- * Poly glyph blt. Accepts an arbitrary font <= 32 bits wide, in Copy mode
- * only.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <X11/Xproto.h>
-#include "cfb.h"
-#include <X11/fonts/fontstruct.h>
-#include "dixfontstr.h"
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "regionstr.h"
-#include "cfbmskbits.h"
-#include "cfb8bit.h"
-
-#define BOX_OVERLAP(box1, box2, xoffset, yoffset) \
- ((box1)->x1 <= ((int) (box2)->x2 + (xoffset)) && \
- ((int) (box2)->x1 + (xoffset)) <= (box1)->x2 && \
- (box1)->y1 <= ((int) (box2)->y2 + (yoffset)) && \
- ((int) (box2)->y1 + (yoffset)) <= (box1)->y2)
-
-#define BOX_CONTAINS(box1, box2, xoffset, yoffset) \
- ((box1)->x1 <= ((int) (box2)->x1 + (xoffset)) && \
- ((int) (box2)->x2 + (xoffset)) <= (box1)->x2 && \
- (box1)->y1 <= ((int) (box2)->y1 + (yoffset)) && \
- ((int) (box2)->y2 + (yoffset)) <= (box1)->y2)
-
-#if defined(FOUR_BIT_CODE) || defined(WriteBitGroup) && !defined(GLYPHROP)
-
-#if GLYPHPADBYTES != 4
-#define USE_LEFTBITS
-#endif
-
-#ifdef USE_LEFTBITS
-typedef unsigned char *glyphPointer;
-
-#define GlyphBits(bits,width,dst) getleftbits(bits,width,dst); \
- (dst) &= widthMask; \
- (bits) += widthGlyph;
-#define GlyphBitsS(bits,width,dst,off) GlyphBits(bits,width,dst); \
- dst = BitRight (dst, off);
-#else
-typedef CARD32 *glyphPointer;
-
-#define GlyphBits(bits,width,dst) dst = *bits++;
-#define GlyphBitsS(bits,width,dst,off) dst = BitRight(*bits++, off);
-#endif
-
-#ifdef GLYPHROP
-#define cfbPolyGlyphBlt8 cfbPolyGlyphRop8
-#define cfbPolyGlyphBlt8Clipped cfbPolyGlyphRop8Clipped
-
-#undef WriteBitGroup
-#define WriteBitGroup(dst,pixel,bits) RRopBitGroup(dst,bits)
-
-#endif
-
-static void cfbPolyGlyphBlt8Clipped(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nglyph,
- CharInfoPtr *ppci, /* array of character info */
- unsigned char *pglyphBase); /* start of array of glyphs */
-
-#if defined(HAS_STIPPLE_CODE) && !defined(GLYPHROP) && !defined(USE_LEFTBITS)
-#define USE_STIPPLE_CODE
-#endif
-
-#if defined(__GNUC__) && !defined(GLYPHROP) && (defined(mc68020) || defined(mc68000) || defined(__mc68000__)) && PSZ == 8 && !defined(USE_LEFTBITS)
-#ifdef USE_STIPPLE_CODE
-#undef USE_STIPPLE_CODE
-#endif
-#include "stip68kgnu.h"
-#endif
-
-#if PSZ == 24
-#define DST_INC 3
-#else
-#define DST_INC (PGSZB >> PWSH)
-#endif
-
-/* cfbStippleStack/cfbStippleStackTE are coded in assembly language.
- * They are only provided on some architecures.
- */
-#ifdef USE_STIPPLE_CODE
-extern void cfbStippleStack (), cfbStippleStackTE ();
-#endif
-
-void
-cfbPolyGlyphBlt8 (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
- DrawablePtr pDrawable;
- GCPtr pGC;
- int x, y;
- unsigned int nglyph;
- CharInfoPtr *ppci; /* array of character info */
- pointer pglyphBase; /* start of array of glyphs */
-{
-#ifndef GLYPHROP
- register CfbBits pixel;
-#endif
-#if !defined(STIPPLE) && !defined(USE_STIPPLE_CODE)
- register CfbBits c;
- register CfbBits *dst;
-#endif
- register glyphPointer glyphBits;
- register int xoff;
-
- FontPtr pfont = pGC->font;
- CharInfoPtr pci;
- CfbBits *dstLine;
- CfbBits *pdstBase;
- int hTmp;
- int bwidthDst;
- int widthDst;
- int h;
- BoxRec bbox; /* for clipping */
- int w;
- RegionPtr clip;
- BoxPtr extents;
-#ifdef USE_LEFTBITS
- int widthGlyph;
- CfbBits widthMask;
-#endif
-#ifndef STIPPLE
-#ifdef USE_STIPPLE_CODE
- void (*stipple)();
-
- stipple = cfbStippleStack;
- if (FONTCONSTMETRICS(pfont))
- stipple = cfbStippleStackTE;
-#endif
-#endif
-
- x += pDrawable->x;
- y += pDrawable->y;
-
- /* compute an approximate (but covering) bounding box */
- bbox.x1 = 0;
- if ((ppci[0]->metrics.leftSideBearing < 0))
- bbox.x1 = ppci[0]->metrics.leftSideBearing;
- h = nglyph - 1;
- w = ppci[h]->metrics.rightSideBearing;
- while (--h >= 0)
- w += ppci[h]->metrics.characterWidth;
- bbox.x2 = w;
- bbox.y1 = -FONTMAXBOUNDS(pfont,ascent);
- bbox.y2 = FONTMAXBOUNDS(pfont,descent);
-
- clip = cfbGetCompositeClip(pGC);
- extents = &clip->extents;
-
- if (!clip->data)
- {
- if (!BOX_CONTAINS(extents, &bbox, x, y))
- {
- if (BOX_OVERLAP (extents, &bbox, x, y))
- cfbPolyGlyphBlt8Clipped(pDrawable, pGC, x, y,
- nglyph, ppci, pglyphBase);
- return;
- }
- }
- else
- {
- /* check to make sure some of the text appears on the screen */
- if (!BOX_OVERLAP (extents, &bbox, x, y))
- return;
-
- bbox.x1 += x;
- bbox.x2 += x;
- bbox.y1 += y;
- bbox.y2 += y;
-
- switch (RECT_IN_REGION(pGC->pScreen, clip, &bbox))
- {
- case rgnPART:
- cfbPolyGlyphBlt8Clipped(pDrawable, pGC, x, y,
- nglyph, ppci, pglyphBase);
- case rgnOUT:
- return;
- }
- }
-
-#ifdef GLYPHROP
- cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask);
-#else
- pixel = cfbGetGCPrivate(pGC)->xor;
-#endif
-
- cfbGetTypedWidthAndPointer (pDrawable, bwidthDst, pdstBase, char, CfbBits)
-
- widthDst = bwidthDst / PGSZB;
- while (nglyph--)
- {
- pci = *ppci++;
- glyphBits = (glyphPointer) FONTGLYPHBITS(pglyphBase,pci);
- xoff = x + pci->metrics.leftSideBearing;
-#if PSZ == 24
- dstLine = pdstBase + (y - pci->metrics.ascent) * widthDst +((xoff>> 2)*3);
-#else
- dstLine = pdstBase +
- (y - pci->metrics.ascent) * widthDst + (xoff >> PWSH);
-#endif
- x += pci->metrics.characterWidth;
- if ((hTmp = pci->metrics.descent + pci->metrics.ascent))
- {
-#if PSZ == 24
- xoff &= 0x03;
-#else
- xoff &= PIM;
-#endif /* PSZ == 24 */
-#ifdef STIPPLE
- STIPPLE(dstLine,glyphBits,pixel,bwidthDst,hTmp,xoff);
-#else
-#ifdef USE_STIPPLE_CODE
- (*stipple)(dstLine,glyphBits,pixel,bwidthDst,hTmp,xoff);
-#else
-#ifdef USE_LEFTBITS
- w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing;
- widthGlyph = PADGLYPHWIDTHBYTES(w);
- widthMask = mfbGetendtab(w);
-#endif
- do {
- dst = dstLine;
- dstLine = (CfbBits *) (((char *) dstLine) + bwidthDst);
- GlyphBits(glyphBits, w, c)
- WriteBitGroup(dst, pixel, GetBitGroup(BitRight(c,xoff)));
- dst += DST_INC;
- c = BitLeft(c,PGSZB - xoff);
- while (c)
- {
- WriteBitGroup(dst, pixel, GetBitGroup(c));
- NextBitGroup(c);
- dst += DST_INC;
- }
- } while (--hTmp);
-#endif /* USE_STIPPLE_CODE else */
-#endif /* STIPPLE else */
- }
- }
-}
-
-static void
-cfbPolyGlyphBlt8Clipped(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nglyph,
- CharInfoPtr *ppci, /* array of character info */
- unsigned char *pglyphBase) /* start of array of glyphs */
-{
-#ifndef GLYPHROP
- register CfbBits pixel;
-#endif
-#if !defined(STIPPLE) && !defined(USE_STIPPLE_CODE)
- register CfbBits c;
-#endif
- register glyphPointer glyphBits;
- register int xoff;
-#if defined(USE_LEFTBITS) || (!defined(STIPPLE) && !defined(USE_STIPPLE_CODE))
- register CfbBits *dst;
-#endif
-
- CharInfoPtr pci;
- FontPtr pfont = pGC->font;
- CfbBits *dstLine;
- CfbBits *pdstBase;
-#ifdef USE_LEFTBITS
- CARD32 *cTmp;
-#endif
- CARD32 *clips;
- int maxAscent, maxDescent;
- int minLeftBearing;
- int hTmp;
- int widthDst;
- int bwidthDst;
- int xG, yG;
- BoxPtr pBox;
- int numRects;
- int w;
- RegionPtr pRegion;
- int yBand;
-#ifdef GLYPHROP
- CfbBits bits;
-#endif
-#ifdef USE_LEFTBITS
- int widthGlyph;
- CfbBits widthMask;
-#endif
-
-#ifdef GLYPHROP
- cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask);
-#else
- pixel = cfbGetGCPrivate(pGC)->xor;
-#endif
-
- cfbGetTypedWidthAndPointer (pDrawable, bwidthDst, pdstBase, char, CfbBits)
-
- widthDst = bwidthDst / PGSZB;
- maxAscent = FONTMAXBOUNDS(pfont,ascent);
- maxDescent = FONTMAXBOUNDS(pfont,descent);
- minLeftBearing = FONTMINBOUNDS(pfont,leftSideBearing);
-
- pRegion = cfbGetCompositeClip(pGC);
-
- pBox = REGION_RECTS(pRegion);
- numRects = REGION_NUM_RECTS (pRegion);
- while (numRects && pBox->y2 <= y - maxAscent)
- {
- ++pBox;
- --numRects;
- }
- if (!numRects || pBox->y1 >= y + maxDescent)
- return;
- yBand = pBox->y1;
- while (numRects && pBox->y1 == yBand && pBox->x2 <= x + minLeftBearing)
- {
- ++pBox;
- --numRects;
- }
- if (!numRects)
- return;
- clips = (CARD32 *)xalloc ((maxAscent + maxDescent) *
- sizeof (CARD32));
- while (nglyph--)
- {
- pci = *ppci++;
- glyphBits = (glyphPointer) FONTGLYPHBITS(pglyphBase,pci);
- w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing;
- xG = x + pci->metrics.leftSideBearing;
- yG = y - pci->metrics.ascent;
- x += pci->metrics.characterWidth;
- if ((hTmp = pci->metrics.descent + pci->metrics.ascent))
- {
-#if PSZ == 24
- dstLine = pdstBase + yG * widthDst + ((xG>> 2)*3);
- /* never use (xG*3)>>2 */
-#else
- dstLine = pdstBase + yG * widthDst + (xG >> PWSH);
-#endif
-#if PSZ == 24
- xoff = xG & 3;
-#else
- xoff = xG & PIM;
-#endif
-#ifdef USE_LEFTBITS
- w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing;
- widthGlyph = PADGLYPHWIDTHBYTES(w);
- widthMask = mfbGetendtab(w);
-#endif
- switch (cfb8ComputeClipMasks32 (pBox, numRects, xG, yG, w, hTmp, clips))
- {
- case rgnPART:
-#ifdef USE_LEFTBITS
- cTmp = clips;
- do {
- dst = dstLine;
- dstLine = (CfbBits *) (((char *) dstLine) + bwidthDst);
- GlyphBits(glyphBits, w, c)
- c &= *cTmp++;
- if (c)
- {
- WriteBitGroup(dst, pixel, GetBitGroup(BitRight(c,xoff)));
- c = BitLeft(c,PGSZB - xoff);
- dst += DST_INC;
- while (c)
- {
- WriteBitGroup(dst, pixel, GetBitGroup(c));
- NextBitGroup(c);
- dst += DST_INC;
- }
- }
- } while (--hTmp);
- break;
-#else /* !USE_LEFTBITS */
- {
- int h;
-
- h = hTmp;
- do
- {
- --h;
- clips[h] = clips[h] & glyphBits[h];
- } while (h);
- }
- glyphBits = clips;
- /* fall through */
-#endif /* USE_LEFTBITS */
- case rgnIN:
-#ifdef STIPPLE
- STIPPLE(dstLine,glyphBits,pixel,bwidthDst,hTmp,xoff);
-#else
-#ifdef USE_STIPPLE_CODE
- cfbStippleStackTE(dstLine,glyphBits,pixel,bwidthDst,hTmp,xoff);
-#else
- do {
- dst = dstLine;
- dstLine = (CfbBits *) (((char *) dstLine) + bwidthDst);
- GlyphBits(glyphBits, w, c)
- if (c)
- {
- /* This code originally could read memory locations
- * that were not mapped. Hence we have to check the
- * trailing bits to see whether they are zero and if
- * then skip them correctly. This is no problem for
- * the GXcopy case, since there only the pixels that
- * are non-zero are written ...
- */
-#ifndef GLYPHROP
- WriteBitGroup(dst, pixel, GetBitGroup(BitRight(c,xoff)));
- c = BitLeft(c,PGSZB - xoff);
- dst += DST_INC;
-#else /* GLYPHROP */
- if ((bits = GetBitGroup(BitRight(c,xoff))))
- WriteBitGroup(dst, pixel, bits);
- c = BitLeft(c,PGSZB - xoff);
- dst += DST_INC;
-
- while (c && ((bits = GetBitGroup(c)) == 0))
- {
- NextBitGroup(c);
- dst += DST_INC;
- }
-#endif /* GLYPHROP */
- while (c)
- {
- WriteBitGroup(dst, pixel, GetBitGroup(c));
- NextBitGroup(c);
- dst += DST_INC;
- }
- }
- } while (--hTmp);
-#endif /* USE_STIPPLE_CODE else */
-#endif /* STIPPLE else */
- break;
- }
- }
- }
- xfree (clips);
-}
-
-#endif /* FOUR_BIT_CODE */
diff --git a/cfb/cfbhrzvert.c b/cfb/cfbhrzvert.c
deleted file mode 100644
index a6a793055..000000000
--- a/cfb/cfbhrzvert.c
+++ /dev/null
@@ -1,554 +0,0 @@
-/***********************************************************
-
-Copyright 1987,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.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-
-#include "gc.h"
-#include "window.h"
-#include "pixmap.h"
-#include "region.h"
-
-#include "cfb.h"
-#include "cfbmskbits.h"
-
-/* horizontal solid line
- abs(len) > 1
-*/
-void
-cfbHorzS(rop, and, xor, addrl, nlwidth, x1, y1, len)
-register int rop;
-register CfbBits and;
-register CfbBits xor;
-register CfbBits *addrl; /* pointer to base of bitmap */
-int nlwidth; /* width in longwords of bitmap */
-int x1; /* initial point */
-int y1;
-int len; /* length of line */
-{
- register int nlmiddle;
-
-#if PSZ == 24
-
- int leftIndex, rightIndex;
- CfbBits piQxelAnd[3], piQxelXor[3];
- piQxelAnd[0] = (and & 0xFFFFFF) | ((and<<24) & 0xFF000000);
- piQxelAnd[1] = ((and>>8) & 0xFFFF)| ((and<<16) & 0xFFFF0000);
- piQxelAnd[2] = ((and<<8) & 0xFFFFFF00) | ((and>>16) & 0xFF);
-
- piQxelXor[0] = (xor & 0xFFFFFF) | ((xor<<24) & 0xFF000000);
- piQxelXor[1] = ((xor>>8) & 0xFFFF)| ((xor<<16) & 0xFFFF0000);
- piQxelXor[2] = ((xor<<8) & 0xFFFFFF00) | ((xor>>16) & 0xFF);
-
- leftIndex = x1 & 3;
- rightIndex = ((x1 + len) < 5)?0:(x1 + len)&3;
- nlmiddle = len;
- if(leftIndex){
- nlmiddle -= (4 - leftIndex);
- }
- if(rightIndex){
- nlmiddle -= rightIndex;
- }
- if (nlmiddle < 0)
- nlmiddle = 0;
-
- nlmiddle >>= 2;
-
- addrl += (y1 * nlwidth) + (x1 >> 2)*3 + (leftIndex?leftIndex-1:0);
-
- switch(leftIndex+len){
- case 4:
- switch(leftIndex){
- case 0:
- *addrl = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]);
- addrl++;
- *addrl = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]);
- addrl++;
- *addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]);
- break;
- case 1:
- *addrl = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFF000000);
- addrl++;
- *addrl = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]);
- addrl++;
- *addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]);
- break;
- case 2:
- *addrl = DoMaskRRop (*addrl, piQxelAnd[1], piQxelXor[1], 0xFFFF0000);
- addrl++;
- *addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]);
- break;
- case 3:
- *addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFFFFFF00);
- break;
- }
- break;
- case 3:
- switch(leftIndex){
- case 0:
- *addrl = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]);
- addrl++;
- *addrl = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]);
- addrl++;
- *addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFF);
- break;
- case 1:
- *addrl = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFF000000);
- addrl++;
- *addrl = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]);
- addrl++;
- *addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFF);
- break;
- case 2:
- *addrl = DoMaskRRop (*addrl, piQxelAnd[1], piQxelXor[1], 0xFFFF0000);
- addrl++;
- *addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFF);
- break;
- }
- break;
- case 2:
- if(leftIndex){
- *addrl = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFF000000);
- addrl++;
- }
- else{
- *addrl = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]);
- addrl++;
- }
- *addrl = DoMaskRRop (*addrl, piQxelAnd[1], piQxelXor[1], 0xFFFF);
- break;
- case 1: /*only if leftIndex = 0 and w = 1*/
- *addrl = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFFFFFF);
- break;
- case 0: /*never*/
- break;
- default:
- {
- if (rop == GXcopy){
- switch(leftIndex){
- case 0:
- break;
- case 1:
- *addrl = ((*addrl) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
- addrl++;
- *addrl++ = piQxelXor[1];
- *addrl++ = piQxelXor[2];
- break;
- case 2:
- *addrl = ((*addrl) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000);
- addrl++;
- *addrl++ = piQxelXor[2];
- break;
- case 3:
- *addrl = ((*addrl) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00);
- addrl++;
- break;
- }
- while(nlmiddle--){
- *addrl++ = piQxelXor[0];
- *addrl++ = piQxelXor[1];
- *addrl++ = piQxelXor[2];
- }
- switch(rightIndex){
- case 0:
- break;
- case 1:
- *addrl = ((*addrl) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF);
- break;
- case 2:
- *addrl++ = piQxelXor[0];
- *addrl = ((*addrl) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF);
- break;
- case 3:
- *addrl++ = piQxelXor[0];
- *addrl++ = piQxelXor[1];
- *addrl = ((*addrl) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
- break;
- }
- }
- else{
- if(rop == GXxor){
- switch(leftIndex){
- case 0:
- break;
- case 1:
- *addrl++ ^= (piQxelXor[0]&0xFF000000);
- *addrl++ ^= piQxelXor[1];
- *addrl++ ^= piQxelXor[2];
- break;
- case 2:
- *addrl++ ^= (piQxelXor[1]& 0xFFFF0000);
- *addrl++ ^= piQxelXor[2];
- break;
- case 3:
- *addrl++ ^= (piQxelXor[2]& 0xFFFFFF00);
- break;
- }
- while(nlmiddle--){
- *addrl++ ^= piQxelXor[0];
- *addrl++ ^= piQxelXor[1];
- *addrl++ ^= piQxelXor[2];
- }
- switch(rightIndex){
- case 0:
- break;
- case 1:
- *addrl ^= (piQxelXor[0]& 0xFFFFFF);
- break;
- case 2:
- *addrl++ ^= piQxelXor[0];
- *addrl ^= (piQxelXor[1]&0xFFFF);
- break;
- case 3:
- *addrl++ ^= piQxelXor[0];
- *addrl++ ^= piQxelXor[1];
- *addrl ^= (piQxelXor[2]&0xFF);
- break;
- }
- }
- else{
- switch(leftIndex){
- case 0:
- break;
- case 1:
- *addrl = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFF000000);
- addrl++;
- *addrl = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]);
- addrl++;
- *addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]);
- addrl++;
- break;
- case 2:
- *addrl = DoMaskRRop (*addrl, piQxelAnd[1], piQxelXor[1], 0xFFFF0000);
- addrl++;
- *addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]);
- addrl++;
- break;
- case 3:
- *addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFFFFFF00);
- addrl++;
- break;
- }
- while(nlmiddle--){
- *addrl = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]);
- addrl++;
- *addrl = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]);
- addrl++;
- *addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]);
- addrl++;
- }
- switch(rightIndex){
- case 0:
- break;
- case 1:
- *addrl = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFFFFFF);
- addrl++;
- break;
- case 2:
- *addrl = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]);
- addrl++;
- *addrl = DoMaskRRop (*addrl, piQxelAnd[1], piQxelXor[1], 0xFFFF);
- break;
- case 3:
- *addrl = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]);
- addrl++;
- *addrl = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]);
- addrl++;
- *addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFF);
- break;
- }
-
- }
- }
- }
- }
-#else
- register CfbBits startmask;
- register CfbBits endmask;
-
- addrl = addrl + (y1 * nlwidth) + (x1 >> PWSH);
-
- /* all bits inside same longword */
- if ( ((x1 & PIM) + len) < PPW)
- {
- maskpartialbits(x1, len, startmask);
- *addrl = DoMaskRRop (*addrl, and, xor, startmask);
- }
- else
- {
- maskbits(x1, len, startmask, endmask, nlmiddle);
- if (rop == GXcopy)
- {
- if (startmask)
- {
- *addrl = (*addrl & ~startmask) | (xor & startmask);
- addrl++;
- }
- while (nlmiddle--)
- *addrl++ = xor;
- if (endmask)
- *addrl = (*addrl & ~endmask) | (xor & endmask);
- }
- else
- {
- if (startmask)
- {
- *addrl = DoMaskRRop (*addrl, and, xor, startmask);
- addrl++;
- }
- if (rop == GXxor)
- {
- while (nlmiddle--)
- *addrl++ ^= xor;
- }
- else
- {
- while (nlmiddle--)
- {
- *addrl = DoRRop (*addrl, and, xor);
- addrl++;
- }
- }
- if (endmask)
- *addrl = DoMaskRRop (*addrl, and, xor, endmask);
- }
- }
-#endif
-}
-
-/* vertical solid line */
-
-void
-cfbVertS(rop, and, xor, addrl, nlwidth, x1, y1, len)
-int rop;
-register CfbBits and, xor;
-register CfbBits *addrl; /* pointer to base of bitmap */
-register int nlwidth; /* width in longwords of bitmap */
-int x1, y1; /* initial point */
-register int len; /* length of line */
-{
-#if PSZ == 24
- int xIdx;
- CfbBits and2 = 0, xor2 = 0, mask = 0, mask2;
-#endif
-#ifdef PIXEL_ADDR
- register PixelType *bits = (PixelType *) addrl;
-
-#if PSZ == 24
- nlwidth <<= PWSH;
- xIdx = x1 & 3;
- bits = (PixelType *)(addrl + (y1 * nlwidth) + ((x1*3) >> 2));
-#else
- nlwidth <<= PWSH;
- bits = bits + (y1 * nlwidth) + x1;
-#endif
-#if PSZ == 24
- mask2 = 0;
- switch(xIdx){
- case 0:
- mask = 0xFF000000;
- xor &= 0xFFFFFF;
- and |= 0xFF000000;
- break;
- case 3:
- mask = 0xFF;
- xor &= 0xFFFFFF;
- xor <<= 8;
- and <<= 8;
- and |= 0xFF;
- break;
- case 1:
- mask = 0xFFFFFF;
- mask2 = 0xFFFF0000;
- xor2 = (xor>>8) & 0xFFFF;
- xor &= 0xFF;
- xor <<= 24;
- and2 = (and >> 8 ) | 0xFFFF0000;
- and <<= 24;
- and |= 0xFFFFFF;
- break;
- case 2:
- mask = 0x0000FFFF;
- mask2 = 0xFFFFFF00;
- xor2 = (xor >> 16) & 0xFF;
- xor <<= 16;
- xor &= 0xFFFF0000;
- and2 = (and >> 16) | 0xFFFFFF00;
- and <<= 16;
- and |= 0xFFFF;
- break;
- }
-#endif
-
- /*
- * special case copy and xor to avoid a test per pixel
- */
- if (rop == GXcopy)
- {
-#if PSZ == 24
- switch(xIdx){
- case 0:
- case 3:
- while (len--){
- *bits = (*bits & mask)| xor;
- bits += nlwidth;
- }
- break;
- case 1:
- case 2:
- while (len--){
- *bits = (*bits & mask)| xor;
- bits++;
- *bits = (*bits & mask2)| xor2;
- bits--;
- bits += nlwidth;
- }
- break;
- }
-#else
- while (len--)
- {
- *bits = xor;
- bits += nlwidth;
- }
-#endif
- }
- else if (rop == GXxor)
- {
-#if PSZ == 24
- switch(xIdx){
- case 0:
- case 3:
- while (len--){
- *bits ^= xor;
- bits += nlwidth;
- }
- break;
- case 1:
- case 2:
- while (len--){
- *bits ^= xor;
- bits++;
- *bits ^= xor2;
- bits--;
- bits += nlwidth;
- }
- break;
- }
-#else
- while (len--)
- {
- *bits ^= xor;
- bits += nlwidth;
- }
-#endif
- }
- else
- {
-#if PSZ == 24
- switch(xIdx){
- case 0:
- while (len--){
- *bits = DoMaskRRop(*bits, and, xor, 0x00FFFFFF);
- bits += nlwidth;
- }
- break;
- case 3:
- while (len--){
- *bits = DoMaskRRop(*bits, and, xor, 0xFFFFFF00);
- bits += nlwidth;
- }
- break;
- case 1:
- while (len--){
- *bits = DoMaskRRop(*bits, and, xor, 0xFF000000);
- bits++;
- *bits = DoMaskRRop(*bits, and2, xor2, 0x0000FFFF);
- bits--;
- bits += nlwidth;
- }
- break;
- case 2:
- while (len--){
- *bits = DoMaskRRop(*bits, and, xor, 0xFFFF0000);
- bits++;
- *bits = DoMaskRRop(*bits, and2, xor2, 0x000000FF);
- bits--;
- bits += nlwidth;
- }
- break;
- }
-#else
- while (len--)
- {
- *bits = DoRRop(*bits, and, xor);
- bits += nlwidth;
- }
-#endif
- }
-#else /* !PIXEL_ADDR */
-#if PSZ == 24
- addrl = addrl + (y1 * nlwidth) + ((x1*3) >>2);
-
- and |= ~cfbmask[(x1 & 3)<<1];
- xor &= cfbmask[(x1 & 3)<<1];
-#else
- addrl = addrl + (y1 * nlwidth) + (x1 >> PWSH);
-
- and |= ~cfbmask[x1 & PIM];
- xor &= cfbmask[x1 & PIM];
-#endif
-
- while (len--)
- {
- *addrl = DoRRop (*addrl, and, xor);
- addrl += nlwidth;
- }
-#endif
-}
diff --git a/cfb/cfbigblt8.c b/cfb/cfbigblt8.c
deleted file mode 100644
index 1f1ce6f37..000000000
--- a/cfb/cfbigblt8.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- *
-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
- */
-
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <X11/Xproto.h>
-#include "mi.h"
-#include "cfb.h"
-#include <X11/fonts/fontstruct.h>
-#include "dixfontstr.h"
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "regionstr.h"
-#include "cfbmskbits.h"
-#include "cfb8bit.h"
-
-void
-cfbImageGlyphBlt8 (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
- DrawablePtr pDrawable;
- GCPtr pGC;
- int x, y;
- unsigned int nglyph;
- CharInfoPtr *ppci;
- pointer pglyphBase;
-{
- ExtentInfoRec info; /* used by QueryGlyphExtents() */
- xRectangle backrect;
- int fgPixel;
- cfbPrivGC *priv;
-
- /*
- * We can't avoid GC validations if calling mi functions.
- */
- if ((pGC->ops->PolyFillRect == miPolyFillRect) ||
- (pGC->ops->PolyGlyphBlt == miPolyGlyphBlt))
- {
- miImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
- return;
- }
-
- QueryGlyphExtents(pGC->font, ppci, (unsigned long)nglyph, &info);
-
- if (info.overallWidth >= 0)
- {
- backrect.x = x;
- backrect.width = info.overallWidth;
- }
- else
- {
- backrect.x = x + info.overallWidth;
- backrect.width = -info.overallWidth;
- }
- backrect.y = y - FONTASCENT(pGC->font);
- backrect.height = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);
-
- priv = cfbGetGCPrivate(pGC);
-
- /* this code cheats by knowing that ValidateGC isn't
- * necessary for PolyFillRect
- */
-
- fgPixel = pGC->fgPixel;
-
- pGC->fgPixel = pGC->bgPixel;
- priv->xor = PFILL(pGC->bgPixel);
-
- (*pGC->ops->PolyFillRect) (pDrawable, pGC, 1, &backrect);
-
- pGC->fgPixel = fgPixel;
-
- priv->xor = PFILL(pGC->fgPixel);
-
- (*pGC->ops->PolyGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
-
-}
diff --git a/cfb/cfbimage.c b/cfb/cfbimage.c
deleted file mode 100644
index 396e1fcb2..000000000
--- a/cfb/cfbimage.c
+++ /dev/null
@@ -1,206 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 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.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <string.h>
-
-#include <X11/X.h>
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-#include "gcstruct.h"
-#include "cfb.h"
-#include "cfbmskbits.h"
-#include "servermd.h"
-#include "mi.h"
-
-void
-cfbPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage)
- DrawablePtr pDraw;
- GCPtr pGC;
- int depth, x, y, w, h;
- int leftPad;
- int format;
- char *pImage;
-{
- PixmapPtr pPixmap;
-
- if ((w == 0) || (h == 0))
- return;
-
- if (format != XYPixmap)
- {
- pPixmap = GetScratchPixmapHeader(pDraw->pScreen, w+leftPad, h, depth,
- BitsPerPixel(depth), PixmapBytePad(w+leftPad, depth),
- (pointer)pImage);
- if (!pPixmap)
- return;
-
- pGC->fExpose = FALSE;
- if (format == ZPixmap)
- (void)(*pGC->ops->CopyArea)((DrawablePtr)pPixmap, pDraw, pGC,
- leftPad, 0, w, h, x, y);
- else
- (void)(*pGC->ops->CopyPlane)((DrawablePtr)pPixmap, pDraw, pGC,
- leftPad, 0, w, h, x, y, 1);
- pGC->fExpose = TRUE;
- FreeScratchPixmapHeader(pPixmap);
- }
- else
- {
- CfbBits oldFg, oldBg;
- XID gcv[3];
- CfbBits oldPlanemask;
- unsigned long i;
- long bytesPer;
-
- depth = pGC->depth;
- oldPlanemask = pGC->planemask;
- oldFg = pGC->fgPixel;
- oldBg = pGC->bgPixel;
- gcv[0] = ~0L;
- gcv[1] = 0;
- DoChangeGC(pGC, GCForeground | GCBackground, gcv, 0);
- bytesPer = (long)h * BitmapBytePad(w + leftPad);
-
- for (i = 1 << (depth-1); i != 0; i >>= 1, pImage += bytesPer)
- {
- if (i & oldPlanemask)
- {
- gcv[0] = i;
- DoChangeGC(pGC, GCPlaneMask, gcv, 0);
- ValidateGC(pDraw, pGC);
- (*pGC->ops->PutImage)(pDraw, pGC, 1, x, y, w, h, leftPad,
- XYBitmap, pImage);
- }
- }
- gcv[0] = oldPlanemask;
- gcv[1] = oldFg;
- gcv[2] = oldBg;
- DoChangeGC(pGC, GCPlaneMask | GCForeground | GCBackground, gcv, 0);
- ValidateGC(pDraw, pGC);
- }
-}
-
-void
-cfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine)
- DrawablePtr pDrawable;
- int sx, sy, w, h;
- unsigned int format;
- unsigned long planeMask;
- char *pdstLine;
-{
- BoxRec box;
- DDXPointRec ptSrc;
- RegionRec rgnDst;
- ScreenPtr pScreen;
- PixmapPtr pPixmap;
-
- if ((w == 0) || (h == 0))
- return;
- if (pDrawable->bitsPerPixel == 1)
- {
- mfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
- return;
- }
- pScreen = pDrawable->pScreen;
- /*
- * XFree86 DDX empties the root borderClip when the VT is
- * switched away; this checks for that case
- */
- if (!cfbDrawableEnabled (pDrawable))
- return;
- if (format == ZPixmap)
- {
- pPixmap = GetScratchPixmapHeader(pScreen, w, h,
- pDrawable->depth, pDrawable->bitsPerPixel,
- PixmapBytePad(w,pDrawable->depth), (pointer)pdstLine);
- if (!pPixmap)
- return;
- if ((planeMask & PMSK) != PMSK)
- bzero((char *)pdstLine, pPixmap->devKind * h);
- ptSrc.x = sx + pDrawable->x;
- ptSrc.y = sy + pDrawable->y;
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = w;
- box.y2 = h;
- REGION_INIT(pScreen, &rgnDst, &box, 1);
- cfbDoBitblt(pDrawable, (DrawablePtr)pPixmap, GXcopy, &rgnDst,
- &ptSrc, planeMask);
- REGION_UNINIT(pScreen, &rgnDst);
- FreeScratchPixmapHeader(pPixmap);
- }
- else
- {
-
-#if IMAGE_BYTE_ORDER == LSBFirst
-
- pPixmap = GetScratchPixmapHeader(pScreen, w, h, /*depth*/ 1,
- /*bpp*/ 1, BitmapBytePad(w), (pointer)pdstLine);
- if (!pPixmap)
- return;
-
- ptSrc.x = sx + pDrawable->x;
- ptSrc.y = sy + pDrawable->y;
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = w;
- box.y2 = h;
- REGION_INIT(pScreen, &rgnDst, &box, 1);
- cfbCopyImagePlane (pDrawable, (DrawablePtr)pPixmap, GXcopy, &rgnDst,
- &ptSrc, planeMask);
- REGION_UNINIT(pScreen, &rgnDst);
- FreeScratchPixmapHeader(pPixmap);
-#else
- miGetImage (pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
-#endif
- }
-}
diff --git a/cfb/cfbline.c b/cfb/cfbline.c
deleted file mode 100644
index 84c089a73..000000000
--- a/cfb/cfbline.c
+++ /dev/null
@@ -1,756 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 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.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stdlib.h>
-#include <X11/X.h>
-
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "regionstr.h"
-#include "scrnintstr.h"
-#include "mistruct.h"
-
-#include "cfb.h"
-#include "cfbmskbits.h"
-#include "miline.h"
-
-/* single-pixel lines on a color frame buffer
-
- NON-SLOPED LINES
- horizontal lines are always drawn left to right; we have to
-move the endpoints right by one after they're swapped.
- horizontal lines will be confined to a single band of a
-region. the code finds that band (giving up if the lower
-bound of the band is above the line we're drawing); then it
-finds the first box in that band that contains part of the
-line. we clip the line to subsequent boxes in that band.
- vertical lines are always drawn top to bottom (y-increasing.)
-this requires adding one to the y-coordinate of each endpoint
-after swapping.
-
- SLOPED LINES
- when clipping a sloped line, we bring the second point inside
-the clipping box, rather than one beyond it, and then add 1 to
-the length of the line before drawing it. this lets us use
-the same box for finding the outcodes for both endpoints. since
-the equation for clipping the second endpoint to an edge gives us
-1 beyond the edge, we then have to move the point towards the
-first point by one step on the major axis.
- eventually, there will be a diagram here to explain what's going
-on. the method uses Cohen-Sutherland outcodes to determine
-outsideness, and a method similar to Pike's layers for doing the
-actual clipping.
-
-*/
-
-void
-#ifdef POLYSEGMENT
-cfbSegmentSS (pDrawable, pGC, nseg, pSeg)
- DrawablePtr pDrawable;
- GCPtr pGC;
- int nseg;
- register xSegment *pSeg;
-#else
-cfbLineSS (pDrawable, pGC, mode, npt, pptInit)
- DrawablePtr pDrawable;
- GCPtr pGC;
- int mode; /* Origin or Previous */
- int npt; /* number of points */
- DDXPointPtr pptInit;
-#endif
-{
- int nboxInit;
- register int nbox;
- BoxPtr pboxInit;
- register BoxPtr pbox;
-#ifndef POLYSEGMENT
- register DDXPointPtr ppt; /* pointer to list of translated points */
-#endif
-
- unsigned int oc1; /* outcode of point 1 */
- unsigned int oc2; /* outcode of point 2 */
-
- CfbBits *addrl; /* address of destination pixmap */
- int nlwidth; /* width in longwords of destination pixmap */
- int xorg, yorg; /* origin of window */
-
- int adx; /* abs values of dx and dy */
- int ady;
- int signdx; /* sign of dx and dy */
- int signdy;
- int e, e1, e2; /* bresenham error and increments */
- int len; /* length of segment */
- int axis; /* major axis */
- int octant;
- unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
-
- /* a bunch of temporaries */
- int tmp;
- register int y1, y2;
- register int x1, x2;
- RegionPtr cclip;
- cfbPrivGCPtr devPriv;
- CfbBits xor, and;
- int alu;
-
- devPriv = cfbGetGCPrivate(pGC);
- cclip = pGC->pCompositeClip;
- pboxInit = REGION_RECTS(cclip);
- nboxInit = REGION_NUM_RECTS(cclip);
-
- cfbGetLongWidthAndPointer (pDrawable, nlwidth, addrl)
-
- alu = devPriv->rop;
- xor = devPriv->xor;
- and = devPriv->and;
- xorg = pDrawable->x;
- yorg = pDrawable->y;
-#ifdef POLYSEGMENT
- while (nseg--)
-#else
- ppt = pptInit;
- x2 = ppt->x + xorg;
- y2 = ppt->y + yorg;
- while(--npt)
-#endif
- {
- nbox = nboxInit;
- pbox = pboxInit;
-
-#ifdef POLYSEGMENT
- x1 = pSeg->x1 + xorg;
- y1 = pSeg->y1 + yorg;
- x2 = pSeg->x2 + xorg;
- y2 = pSeg->y2 + yorg;
- pSeg++;
-#else
- x1 = x2;
- y1 = y2;
- ++ppt;
- if (mode == CoordModePrevious)
- {
- xorg = x1;
- yorg = y1;
- }
- x2 = ppt->x + xorg;
- y2 = ppt->y + yorg;
-#endif
-
- if (x1 == x2) /* vertical line */
- {
- /* make the line go top to bottom of screen, keeping
- endpoint semantics
- */
- if (y1 > y2)
- {
- register int tmp;
-
- tmp = y2;
- y2 = y1 + 1;
- y1 = tmp + 1;
-#ifdef POLYSEGMENT
- if (pGC->capStyle != CapNotLast)
- y1--;
-#endif
- }
-#ifdef POLYSEGMENT
- else if (pGC->capStyle != CapNotLast)
- y2++;
-#endif
- /* get to first band that might contain part of line */
- while ((nbox) && (pbox->y2 <= y1))
- {
- pbox++;
- nbox--;
- }
-
- if (nbox)
- {
- /* stop when lower edge of box is beyond end of line */
- while((nbox) && (y2 >= pbox->y1))
- {
- if ((x1 >= pbox->x1) && (x1 < pbox->x2))
- {
- int y1t, y2t;
- /* this box has part of the line in it */
- y1t = max(y1, pbox->y1);
- y2t = min(y2, pbox->y2);
- if (y1t != y2t)
- {
- cfbVertS (alu, and, xor,
- addrl, nlwidth,
- x1, y1t, y2t-y1t);
- }
- }
- nbox--;
- pbox++;
- }
- }
-#ifndef POLYSEGMENT
- y2 = ppt->y + yorg;
-#endif
- }
- else if (y1 == y2) /* horizontal line */
- {
- /* force line from left to right, keeping
- endpoint semantics
- */
- if (x1 > x2)
- {
- register int tmp;
-
- tmp = x2;
- x2 = x1 + 1;
- x1 = tmp + 1;
-#ifdef POLYSEGMENT
- if (pGC->capStyle != CapNotLast)
- x1--;
-#endif
- }
-#ifdef POLYSEGMENT
- else if (pGC->capStyle != CapNotLast)
- x2++;
-#endif
-
- /* find the correct band */
- while( (nbox) && (pbox->y2 <= y1))
- {
- pbox++;
- nbox--;
- }
-
- /* try to draw the line, if we haven't gone beyond it */
- if ((nbox) && (pbox->y1 <= y1))
- {
- /* when we leave this band, we're done */
- tmp = pbox->y1;
- while((nbox) && (pbox->y1 == tmp))
- {
- int x1t, x2t;
-
- if (pbox->x2 <= x1)
- {
- /* skip boxes until one might contain start point */
- nbox--;
- pbox++;
- continue;
- }
-
- /* stop if left of box is beyond right of line */
- if (pbox->x1 >= x2)
- {
- nbox = 0;
- break;
- }
-
- x1t = max(x1, pbox->x1);
- x2t = min(x2, pbox->x2);
- if (x1t != x2t)
- {
- cfbHorzS (alu, and, xor,
- addrl, nlwidth,
- x1t, y1, x2t-x1t);
- }
- nbox--;
- pbox++;
- }
- }
-#ifndef POLYSEGMENT
- x2 = ppt->x + xorg;
-#endif
- }
- else /* sloped line */
- {
- CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy,
- 1, 1, octant);
-
- if (adx > ady)
- {
- axis = X_AXIS;
- e1 = ady << 1;
- e2 = e1 - (adx << 1);
- e = e1 - adx;
- }
- else
- {
- axis = Y_AXIS;
- e1 = adx << 1;
- e2 = e1 - (ady << 1);
- e = e1 - ady;
- SetYMajorOctant(octant);
- }
-
- FIXUP_ERROR(e, octant, bias);
-
- /* we have bresenham parameters and two points.
- all we have to do now is clip and draw.
- */
-
- while(nbox--)
- {
- oc1 = 0;
- oc2 = 0;
- OUTCODES(oc1, x1, y1, pbox);
- OUTCODES(oc2, x2, y2, pbox);
- if ((oc1 | oc2) == 0)
- {
- if (axis == X_AXIS)
- len = adx;
- else
- len = ady;
-#ifdef POLYSEGMENT
- if (pGC->capStyle != CapNotLast)
- len++;
-#endif
- cfbBresS (alu, and, xor,
- addrl, nlwidth,
- signdx, signdy, axis, x1, y1,
- e, e1, e2, len);
- break;
- }
- else if (oc1 & oc2)
- {
- pbox++;
- }
- else
- {
- int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2;
- int clip1 = 0, clip2 = 0;
- int clipdx, clipdy;
- int err;
-
- if (miZeroClipLine(pbox->x1, pbox->y1, pbox->x2-1,
- pbox->y2-1,
- &new_x1, &new_y1, &new_x2, &new_y2,
- adx, ady, &clip1, &clip2,
- octant, bias, oc1, oc2) == -1)
- {
- pbox++;
- continue;
- }
-
- if (axis == X_AXIS)
- len = abs(new_x2 - new_x1);
- else
- len = abs(new_y2 - new_y1);
-#ifdef POLYSEGMENT
- if (clip2 != 0 || pGC->capStyle != CapNotLast)
- len++;
-#else
- len += (clip2 != 0);
-#endif
- if (len)
- {
- /* unwind bresenham error term to first point */
- if (clip1)
- {
- clipdx = abs(new_x1 - x1);
- clipdy = abs(new_y1 - y1);
- if (axis == X_AXIS)
- err = e+((clipdy*e2) + ((clipdx-clipdy)*e1));
- else
- err = e+((clipdx*e2) + ((clipdy-clipdx)*e1));
- }
- else
- err = e;
- cfbBresS(alu, and, xor,
- addrl, nlwidth,
- signdx, signdy, axis, new_x1, new_y1,
- err, e1, e2, len);
- }
- pbox++;
- }
- } /* while (nbox--) */
- } /* sloped line */
- } /* while (nline--) */
-
-#ifndef POLYSEGMENT
- /* paint the last point if the end style isn't CapNotLast.
- (Assume that a projecting, butt, or round cap that is one
- pixel wide is the same as the single pixel of the endpoint.)
- */
-
- if ((pGC->capStyle != CapNotLast) &&
- ((ppt->x + xorg != pptInit->x + pDrawable->x) ||
- (ppt->y + yorg != pptInit->y + pDrawable->y) ||
- (ppt == pptInit + 1)))
- {
- nbox = nboxInit;
- pbox = pboxInit;
- while (nbox--)
- {
- if ((x2 >= pbox->x1) &&
- (y2 >= pbox->y1) &&
- (x2 < pbox->x2) &&
- (y2 < pbox->y2))
- {
- CfbBits mask;
- CfbBits scrbits;
-
-#if PSZ == 24
- mask = cfbmask[(x2 & 3)<<1];
- addrl += (y2 * nlwidth) + ((x2*3) >> 2);
-#else
- mask = cfbmask[x2 & PIM];
- addrl += (y2 * nlwidth) + (x2 >> PWSH);
-#endif
- scrbits = *addrl;
- *addrl = (scrbits & ~mask) |
- (DoRRop (scrbits, and, xor) & mask);
- break;
- }
- else
- pbox++;
- }
- }
-#endif
-}
-
-/*
- * Draw dashed 1-pixel lines.
- */
-
-void
-#ifdef POLYSEGMENT
-cfbSegmentSD (pDrawable, pGC, nseg, pSeg)
- DrawablePtr pDrawable;
- register GCPtr pGC;
- int nseg;
- register xSegment *pSeg;
-#else
-cfbLineSD( pDrawable, pGC, mode, npt, pptInit)
- DrawablePtr pDrawable;
- register GCPtr pGC;
- int mode; /* Origin or Previous */
- int npt; /* number of points */
- DDXPointPtr pptInit;
-#endif
-{
- int nboxInit;
- register int nbox;
- BoxPtr pboxInit;
- register BoxPtr pbox;
-#ifndef POLYSEGMENT
- register DDXPointPtr ppt; /* pointer to list of translated points */
-#endif
-
- register unsigned int oc1; /* outcode of point 1 */
- register unsigned int oc2; /* outcode of point 2 */
-
- CfbBits *addrl; /* address of destination pixmap */
- int nlwidth; /* width in longwords of destination pixmap */
- int xorg, yorg; /* origin of window */
-
- int adx; /* abs values of dx and dy */
- int ady;
- int signdx; /* sign of dx and dy */
- int signdy;
- int e, e1, e2; /* bresenham error and increments */
- int len; /* length of segment */
- int axis; /* major axis */
- int octant;
- unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
- int x1, x2, y1, y2;
- RegionPtr cclip;
- cfbRRopRec rrops[2];
- unsigned char *pDash;
- int dashOffset;
- int numInDashList;
- int dashIndex;
- int isDoubleDash;
- int dashIndexTmp, dashOffsetTmp;
- int unclippedlen;
- cfbPrivGCPtr devPriv;
-
- devPriv = cfbGetGCPrivate(pGC);
- cclip = pGC->pCompositeClip;
- rrops[0].rop = devPriv->rop;
- rrops[0].and = devPriv->and;
- rrops[0].xor = devPriv->xor;
- if (pGC->alu == GXcopy)
- {
- rrops[1].rop = GXcopy;
- rrops[1].and = 0;
- rrops[1].xor = PFILL (pGC->bgPixel);
- }
- else
- {
- rrops[1].rop = cfbReduceRasterOp (pGC->alu,
- pGC->bgPixel, pGC->planemask,
- &rrops[1].and, &rrops[1].xor);
- }
- pboxInit = REGION_RECTS(cclip);
- nboxInit = REGION_NUM_RECTS(cclip);
-
- cfbGetLongWidthAndPointer (pDrawable, nlwidth, addrl)
-
- /* compute initial dash values */
-
- pDash = (unsigned char *) pGC->dash;
- numInDashList = pGC->numInDashList;
- isDoubleDash = (pGC->lineStyle == LineDoubleDash);
- dashIndex = 0;
- dashOffset = 0;
- miStepDash ((int)pGC->dashOffset, &dashIndex, pDash,
- numInDashList, &dashOffset);
-
- xorg = pDrawable->x;
- yorg = pDrawable->y;
-#ifdef POLYSEGMENT
- while (nseg--)
-#else
- ppt = pptInit;
- x2 = ppt->x + xorg;
- y2 = ppt->y + yorg;
- while(--npt)
-#endif
- {
- nbox = nboxInit;
- pbox = pboxInit;
-
-#ifdef POLYSEGMENT
- x1 = pSeg->x1 + xorg;
- y1 = pSeg->y1 + yorg;
- x2 = pSeg->x2 + xorg;
- y2 = pSeg->y2 + yorg;
- pSeg++;
-#else
- x1 = x2;
- y1 = y2;
- ++ppt;
- if (mode == CoordModePrevious)
- {
- xorg = x1;
- yorg = y1;
- }
- x2 = ppt->x + xorg;
- y2 = ppt->y + yorg;
-#endif
-
- CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy, 1, 1, octant);
-
- if (adx > ady)
- {
- axis = X_AXIS;
- e1 = ady << 1;
- e2 = e1 - (adx << 1);
- e = e1 - adx;
- unclippedlen = adx;
- }
- else
- {
- axis = Y_AXIS;
- e1 = adx << 1;
- e2 = e1 - (ady << 1);
- e = e1 - ady;
- unclippedlen = ady;
- SetYMajorOctant(octant);
- }
-
- FIXUP_ERROR(e, octant, bias);
-
- /* we have bresenham parameters and two points.
- all we have to do now is clip and draw.
- */
-
- while(nbox--)
- {
- oc1 = 0;
- oc2 = 0;
- OUTCODES(oc1, x1, y1, pbox);
- OUTCODES(oc2, x2, y2, pbox);
- if ((oc1 | oc2) == 0)
- {
-#ifdef POLYSEGMENT
- if (pGC->capStyle != CapNotLast)
- unclippedlen++;
- dashIndexTmp = dashIndex;
- dashOffsetTmp = dashOffset;
- cfbBresD (rrops,
- &dashIndexTmp, pDash, numInDashList,
- &dashOffsetTmp, isDoubleDash,
- addrl, nlwidth,
- signdx, signdy, axis, x1, y1,
- e, e1, e2, unclippedlen);
- break;
-#else
- cfbBresD (rrops,
- &dashIndex, pDash, numInDashList,
- &dashOffset, isDoubleDash,
- addrl, nlwidth,
- signdx, signdy, axis, x1, y1,
- e, e1, e2, unclippedlen);
- goto dontStep;
-#endif
- }
- else if (oc1 & oc2)
- {
- pbox++;
- }
- else /* have to clip */
- {
- int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2;
- int clip1 = 0, clip2 = 0;
- int clipdx, clipdy;
- int err;
-
- if (miZeroClipLine(pbox->x1, pbox->y1, pbox->x2-1,
- pbox->y2-1,
- &new_x1, &new_y1, &new_x2, &new_y2,
- adx, ady, &clip1, &clip2,
- octant, bias, oc1, oc2) == -1)
- {
- pbox++;
- continue;
- }
-
- dashIndexTmp = dashIndex;
- dashOffsetTmp = dashOffset;
-
- if (clip1)
- {
- int dlen;
-
- if (axis == X_AXIS)
- dlen = abs(new_x1 - x1);
- else
- dlen = abs(new_y1 - y1);
- miStepDash (dlen, &dashIndexTmp, pDash,
- numInDashList, &dashOffsetTmp);
- }
-
- if (axis == X_AXIS)
- len = abs(new_x2 - new_x1);
- else
- len = abs(new_y2 - new_y1);
-#ifdef POLYSEGMENT
- if (clip2 != 0 || pGC->capStyle != CapNotLast)
- len++;
-#else
- len += (clip2 != 0);
-#endif
- if (len)
- {
- /* unwind bresenham error term to first point */
- if (clip1)
- {
- clipdx = abs(new_x1 - x1);
- clipdy = abs(new_y1 - y1);
- if (axis == X_AXIS)
- err = e+((clipdy*e2) + ((clipdx-clipdy)*e1));
- else
- err = e+((clipdx*e2) + ((clipdy-clipdx)*e1));
- }
- else
- err = e;
- cfbBresD (rrops,
- &dashIndexTmp, pDash, numInDashList,
- &dashOffsetTmp, isDoubleDash,
- addrl, nlwidth,
- signdx, signdy, axis, new_x1, new_y1,
- err, e1, e2, len);
- }
- pbox++;
- }
- } /* while (nbox--) */
-#ifndef POLYSEGMENT
- /*
- * walk the dash list around to the next line
- */
- miStepDash (unclippedlen, &dashIndex, pDash,
- numInDashList, &dashOffset);
-dontStep: ;
-#endif
- } /* while (nline--) */
-
-#ifndef POLYSEGMENT
- /* paint the last point if the end style isn't CapNotLast.
- (Assume that a projecting, butt, or round cap that is one
- pixel wide is the same as the single pixel of the endpoint.)
- */
-
- if ((pGC->capStyle != CapNotLast) &&
- ((dashIndex & 1) == 0 || isDoubleDash) &&
- ((ppt->x + xorg != pptInit->x + pDrawable->x) ||
- (ppt->y + yorg != pptInit->y + pDrawable->y) ||
- (ppt == pptInit + 1)))
- {
- nbox = nboxInit;
- pbox = pboxInit;
- while (nbox--)
- {
- if ((x2 >= pbox->x1) &&
- (y2 >= pbox->y1) &&
- (x2 < pbox->x2) &&
- (y2 < pbox->y2))
- {
- CfbBits mask;
- int pix;
-
- pix = 0;
- if (dashIndex & 1)
- pix = 1;
-#if PSZ == 24
- mask = cfbmask[(x2 & 3)<<1];
- addrl += (y2 * nlwidth) + ((x2 *3)>> 2);
-#else
- mask = cfbmask[x2 & PIM];
- addrl += (y2 * nlwidth) + (x2 >> PWSH);
-#endif
- *addrl = DoMaskRRop (*addrl, rrops[pix].and, rrops[pix].xor, mask);
- break;
- }
- else
- pbox++;
- }
- }
-#endif
-}
diff --git a/cfb/cfbmap.h b/cfb/cfbmap.h
deleted file mode 100644
index 16e4afc3c..000000000
--- a/cfb/cfbmap.h
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- *
-Copyright 1991, 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
- */
-
-
-/*
- * Map names around so that multiple depths can be supported simultaneously
- */
-
-/* a losing vendor cpp dumps core if we define CFBNAME in terms of CATNAME */
-
-#if PSZ != 8
-
-#if PSZ == 32
-#if !defined(UNIXCPP) || defined(ANSICPP)
-#define CFBNAME(subname) cfb32##subname
-#else
-#define CFBNAME(subname) cfb32/**/subname
-#endif
-#endif
-
-#if PSZ == 24
-#if !defined(UNIXCPP) || defined(ANSICPP)
-#define CFBNAME(subname) cfb24##subname
-#else
-#define CFBNAME(subname) cfb24/**/subname
-#endif
-#endif
-
-#if PSZ == 16
-#if !defined(UNIXCPP) || defined(ANSICPP)
-#define CFBNAME(subname) cfb16##subname
-#else
-#define CFBNAME(subname) cfb16/**/subname
-#endif
-#endif
-
-#if PSZ == 4
-#if !defined(UNIXCPP) || defined(ANSICPP)
-#define CFBNAME(subname) cfb4##subname
-#else
-#define CFBNAME(subname) cfb4/**/subname
-#endif
-#endif
-
-#ifndef CFBNAME
-cfb can not hack PSZ yet
-#endif
-
-#undef CATNAME
-
-#if !defined(UNIXCPP) || defined(ANSICPP)
-#define CATNAME(prefix,subname) prefix##subname
-#else
-#define CATNAME(prefix,subname) prefix/**/subname
-#endif
-
-#define QuartetBitsTable CFBNAME(QuartetBitsTable)
-#define QuartetPixelMaskTable CFBNAME(QuartetPixelMaskTable)
-#define cfb8ClippedLineCopy CFBNAME(ClippedLineCopy)
-#define cfb8ClippedLineGeneral CFBNAME(ClippedLineGeneral )
-#define cfb8ClippedLineXor CFBNAME(ClippedLineXor)
-#define cfb8LineSS1Rect CFBNAME(LineSS1Rect)
-#define cfb8LineSS1RectCopy CFBNAME(LineSS1RectCopy)
-#define cfb8LineSS1RectGeneral CFBNAME(LineSS1RectGeneral )
-#define cfb8LineSS1RectPreviousCopy CFBNAME(LineSS1RectPreviousCopy)
-#define cfb8LineSS1RectXor CFBNAME(LineSS1RectXor)
-#define cfb8SegmentSS1Rect CFBNAME(SegmentSS1Rect)
-#define cfb8SegmentSS1RectCopy CFBNAME(SegmentSS1RectCopy)
-#define cfb8SegmentSS1RectGeneral CFBNAME(SegmentSS1RectGeneral )
-#define cfb8SegmentSS1RectShiftCopy CFBNAME(SegmentSS1RectShiftCopy)
-#define cfb8SegmentSS1RectXor CFBNAME(SegmentSS1RectXor)
-#define cfbAllocatePrivates CFBNAME(AllocatePrivates)
-#define cfbBSFuncRec CFBNAME(BSFuncRec)
-#define cfbBitBlt CFBNAME(BitBlt)
-#define cfbBresD CFBNAME(BresD)
-#define cfbBresS CFBNAME(BresS)
-#define cfbChangeWindowAttributes CFBNAME(ChangeWindowAttributes)
-#define cfbClearVisualTypes CFBNAME(cfbClearVisualTypes)
-#define cfbCloseScreen CFBNAME(CloseScreen)
-#define cfbCreateDefColormap CFBNAME (cfbCreateDefColormap)
-#define cfbCopyArea CFBNAME(CopyArea)
-#define cfbCopyImagePlane CFBNAME(CopyImagePlane)
-#define cfbCopyPixmap CFBNAME(CopyPixmap)
-#define cfbCopyPlane CFBNAME(CopyPlane)
-#define cfbCopyPlaneReduce CFBNAME(CopyPlaneReduce)
-#define cfbCopyRotatePixmap CFBNAME(CopyRotatePixmap)
-#define cfbCopyWindow CFBNAME(CopyWindow)
-#define cfbCreateGC CFBNAME(CreateGC)
-#define cfbCreatePixmap CFBNAME(CreatePixmap)
-#define cfbCreateScreenResources CFBNAME(CreateScreenResources)
-#define cfbCreateWindow CFBNAME(CreateWindow)
-#define cfbDestroyPixmap CFBNAME(DestroyPixmap)
-#define cfbDestroyWindow CFBNAME(DestroyWindow)
-#define cfbDoBitblt CFBNAME(DoBitblt)
-#define cfbDoBitbltCopy CFBNAME(DoBitbltCopy)
-#define cfbDoBitbltGeneral CFBNAME(DoBitbltGeneral)
-#define cfbDoBitbltOr CFBNAME(DoBitbltOr)
-#define cfbDoBitbltXor CFBNAME(DoBitbltXor)
-#define cfbExpandDirectColors CFBNAME(cfbExpandDirectColors)
-#define cfbFillBoxTile32sCopy CFBNAME(FillBoxTile32sCopy)
-#define cfbFillBoxTile32sGeneral CFBNAME(FillBoxTile32sGeneral)
-#define cfbFillBoxTileOdd CFBNAME(FillBoxTileOdd)
-#define cfbFillBoxTileOddCopy CFBNAME(FillBoxTileOddCopy)
-#define cfbFillBoxTileOddGeneral CFBNAME(FillBoxTileOddGeneral)
-#define cfbFillPoly1RectCopy CFBNAME(FillPoly1RectCopy)
-#define cfbFillPoly1RectGeneral CFBNAME(FillPoly1RectGeneral)
-#define cfbFillRectSolidCopy CFBNAME(FillRectSolidCopy)
-#define cfbFillRectSolidGeneral CFBNAME(FillRectSolidGeneral)
-#define cfbFillRectSolidXor CFBNAME(FillRectSolidXor)
-#define cfbFillRectTile32Copy CFBNAME(FillRectTile32Copy)
-#define cfbFillRectTile32General CFBNAME(FillRectTile32General)
-#define cfbFillRectTileOdd CFBNAME(FillRectTileOdd)
-#define cfbFillSpanTile32sCopy CFBNAME(FillSpanTile32sCopy)
-#define cfbFillSpanTile32sGeneral CFBNAME(FillSpanTile32sGeneral)
-#define cfbFillSpanTileOddCopy CFBNAME(FillSpanTileOddCopy)
-#define cfbFillSpanTileOddGeneral CFBNAME(FillSpanTileOddGeneral)
-#define cfbFinishScreenInit CFBNAME(FinishScreenInit)
-#define cfbGCFuncs CFBNAME(GCFuncs)
-#define cfbGCPrivateKey CFBNAME(GCPrivateKey)
-#define cfbGetImage CFBNAME(GetImage)
-#define cfbGetScreenPixmap CFBNAME(GetScreenPixmap)
-#define cfbGetSpans CFBNAME(GetSpans)
-#define cfbHorzS CFBNAME(HorzS)
-#define cfbImageGlyphBlt8 CFBNAME(ImageGlyphBlt8)
-#define cfbInitializeColormap CFBNAME(InitializeColormap)
-#define cfbInitVisuals CFBNAME(cfbInitVisuals)
-#define cfbInstallColormap CFBNAME(InstallColormap)
-#define cfbLineSD CFBNAME(LineSD)
-#define cfbLineSS CFBNAME(LineSS)
-#define cfbListInstalledColormaps CFBNAME(ListInstalledColormaps)
-#define cfbMapWindow CFBNAME(MapWindow)
-#define cfbMatchCommon CFBNAME(MatchCommon)
-#define cfbNonTEOps CFBNAME(NonTEOps)
-#define cfbNonTEOps1Rect CFBNAME(NonTEOps1Rect)
-#define cfbPadPixmap CFBNAME(PadPixmap)
-#define cfbPolyFillArcSolidCopy CFBNAME(PolyFillArcSolidCopy)
-#define cfbPolyFillArcSolidGeneral CFBNAME(PolyFillArcSolidGeneral)
-#define cfbPolyFillRect CFBNAME(PolyFillRect)
-#define cfbPolyGlyphBlt8 CFBNAME(PolyGlyphBlt8)
-#define cfbPolyGlyphRop8 CFBNAME(PolyGlyphRop8)
-#define cfbPolyPoint CFBNAME(PolyPoint)
-#define cfbPositionWindow CFBNAME(PositionWindow)
-#define cfbPutImage CFBNAME(PutImage)
-#define cfbReduceRasterOp CFBNAME(ReduceRasterOp)
-#define cfbResolveColor CFBNAME(ResolveColor)
-#define cfbRestoreAreas CFBNAME(RestoreAreas)
-#define cfbSaveAreas CFBNAME(SaveAreas)
-#define cfbScreenInit CFBNAME(ScreenInit)
-#define cfbScreenPrivateKey CFBNAME(ScreenPrivateKey)
-#define cfbSegmentSD CFBNAME(SegmentSD)
-#define cfbSegmentSS CFBNAME(SegmentSS)
-#define cfbSetScanline CFBNAME(SetScanline)
-#define cfbSetScreenPixmap CFBNAME(SetScreenPixmap)
-#define cfbSetSpans CFBNAME(SetSpans)
-#define cfbSetVisualTypes CFBNAME(cfbSetVisualTypes)
-#define cfbSetupScreen CFBNAME(SetupScreen)
-#define cfbSolidSpansCopy CFBNAME(SolidSpansCopy)
-#define cfbSolidSpansGeneral CFBNAME(SolidSpansGeneral)
-#define cfbSolidSpansXor CFBNAME(SolidSpansXor)
-#define cfbStippleStack CFBNAME(StippleStack)
-#define cfbStippleStackTE CFBNAME(StippleStackTE)
-#define cfbTEGlyphBlt CFBNAME(TEGlyphBlt)
-#define cfbTEOps CFBNAME(TEOps)
-#define cfbTEOps1Rect CFBNAME(TEOps1Rect)
-#define cfbTile32FSCopy CFBNAME(Tile32FSCopy)
-#define cfbTile32FSGeneral CFBNAME(Tile32FSGeneral)
-#define cfbUninstallColormap CFBNAME(UninstallColormap)
-#define cfbUnmapWindow CFBNAME(UnmapWindow)
-#define cfbUnnaturalStippleFS CFBNAME(UnnaturalStippleFS)
-#define cfbUnnaturalTileFS CFBNAME(UnnaturalTileFS)
-#define cfbValidateGC CFBNAME(ValidateGC)
-#define cfbVertS CFBNAME(VertS)
-#define cfbWindowPrivateKey CFBNAME(WindowPrivateKey)
-#define cfbXRotatePixmap CFBNAME(XRotatePixmap)
-#define cfbYRotatePixmap CFBNAME(YRotatePixmap)
-#define cfbZeroPolyArcSS8Copy CFBNAME(ZeroPolyArcSSCopy)
-#define cfbZeroPolyArcSS8General CFBNAME(ZeroPolyArcSSGeneral)
-#define cfbZeroPolyArcSS8Xor CFBNAME(ZeroPolyArcSSXor)
-#define cfbendpartial CFBNAME(endpartial)
-#define cfbendtab CFBNAME(endtab)
-#define cfbmask CFBNAME(mask)
-#define cfbrmask CFBNAME(rmask)
-#define cfbstartpartial CFBNAME(startpartial)
-#define cfbstarttab CFBNAME(starttab)
-
-#endif /* PSZ != 8 */
diff --git a/cfb/cfbmskbits.c b/cfb/cfbmskbits.c
deleted file mode 100644
index 915ea35c1..000000000
--- a/cfb/cfbmskbits.c
+++ /dev/null
@@ -1,1400 +0,0 @@
-/************************************************************
-Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this
-software and its documentation for any purpose and without
-fee is hereby granted, provided that the above copyright no-
-tice appear in all copies and that both that copyright no-
-tice and this permission notice appear in supporting docu-
-mentation, and that the names of Sun or The Open Group
-not be used in advertising or publicity pertaining to
-distribution of the software without specific prior
-written permission. Sun and The Open Group make no
-representations about the suitability of this software for
-any purpose. It is provided "as is" without any express or
-implied warranty.
-
-SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
-NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
-ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
-PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
-OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
-THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-********************************************************/
-
-
-/*
- * ==========================================================================
- * Converted to Color Frame Buffer by smarks@sun, April-May 1987. The "bit
- * numbering" in the doc below really means "byte numbering" now.
- * ==========================================================================
- */
-
-/*
- these tables are used by several macros in the cfb code.
-
- the vax numbers everything left to right, so bit indices on the
-screen match bit indices in longwords. the pc-rt and Sun number
-bits on the screen the way they would be written on paper,
-(i.e. msb to the left), and so a bit index n on the screen is
-bit index 32-n in a longword
-
- see also cfbmskbits.h
-*/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <servermd.h>
-#include "cfb.h"
-#include "cfbmskbits.h"
-
-#define _cfbBits(a) (PixelGroup)(a)
-
-#if (BITMAP_BIT_ORDER == MSBFirst)
-#define cfbBits(v) _cfbBits(v)
-#else /* BITMAP_BIT_ORDER == LSBFirst */
-#define cfbFlip2(a) ((((a) & 0x1) << 1) | (((a) & 0x2) >> 1))
-#define cfbFlip4(a) ((cfbFlip2(a) << 2) | cfbFlip2(a >> 2))
-#define cfbFlip8(a) ((cfbFlip4(a) << 4) | cfbFlip4(a >> 4))
-#define cfbFlip16(a) ((cfbFlip8(a) << 8) | cfbFlip8(a >> 8))
-#define cfbFlip32(a) ((cfbFlip16(a) << 16) | cfbFlip16(a >> 16))
-#if PGSZ == 32
-#define cfbBits(a) cfbFlip32(_cfbBits(a))
-#else /* PGSZ == 64 */
-#define cfbFlip64(a) ((cfbFlip32(a) << 32) | cfbFlip32(a >> 32))
-#define cfbBits(a) cfbFlip64(_cfbBits(a))
-#endif /* PGSZ */
-#endif /* BITMAP_BIT_ORDER */
-
-/* NOTE:
-the first element in starttab could be 0xffffffff. making it 0
-lets us deal with a full first word in the middle loop, rather
-than having to do the multiple reads and masks that we'd
-have to do if we thought it was partial.
-*/
-#if PSZ == 4
-#if PGSZ == 32
-PixelGroup cfbstarttab[] =
- {
- cfbBits(0x00000000),
- cfbBits(0x0FFFFFFF),
- cfbBits(0x00FFFFFF),
- cfbBits(0x000FFFFF),
- cfbBits(0x0000FFFF),
- cfbBits(0x00000FFF),
- cfbBits(0x000000FF),
- cfbBits(0x0000000F)
- };
-PixelGroup cfbendtab[] =
- {
- cfbBits(0x00000000),
- cfbBits(0xF0000000),
- cfbBits(0xFF000000),
- cfbBits(0xFFF00000),
- cfbBits(0xFFFF0000),
- cfbBits(0xFFFFF000),
- cfbBits(0xFFFFFF00),
- cfbBits(0xFFFFFFF0)
- };
-#else /* PGSZ == 64 */
-PixelGroup cfbstarttab[] =
- {
- cfbBits(0x0000000000000000),
- cfbBits(0x0FFFFFFFFFFFFFFF),
- cfbBits(0x00FFFFFFFFFFFFFF),
- cfbBits(0x000FFFFFFFFFFFFF),
- cfbBits(0x0000FFFFFFFFFFFF),
- cfbBits(0x00000FFFFFFFFFFF),
- cfbBits(0x000000FFFFFFFFFF),
- cfbBits(0x0000000FFFFFFFFF),
- cfbBits(0x00000000FFFFFFFF),
- cfbBits(0x000000000FFFFFFF),
- cfbBits(0x0000000000FFFFFF),
- cfbBits(0x00000000000FFFFF),
- cfbBits(0x000000000000FFFF),
- cfbBits(0x0000000000000FFF),
- cfbBits(0x00000000000000FF),
- cfbBits(0x000000000000000F),
- };
-PixelGroup cfbendtab[] =
- {
- cfbBits(0x0000000000000000),
- cfbBits(0xF000000000000000),
- cfbBits(0xFF00000000000000),
- cfbBits(0xFFF0000000000000),
- cfbBits(0xFFFF000000000000),
- cfbBits(0xFFFFF00000000000),
- cfbBits(0xFFFFFF0000000000),
- cfbBits(0xFFFFFFF000000000),
- cfbBits(0xFFFFFFFF00000000),
- cfbBits(0xFFFFFFFFF0000000),
- cfbBits(0xFFFFFFFFFF000000),
- cfbBits(0xFFFFFFFFFFF00000),
- cfbBits(0xFFFFFFFFFFFF0000),
- cfbBits(0xFFFFFFFFFFFFF000),
- cfbBits(0xFFFFFFFFFFFFFF00),
- cfbBits(0xFFFFFFFFFFFFFFF0),
- };
-#endif /* PGSZ */
-#endif /* PSZ == 4 */
-
-#if PSZ == 8
-#if PGSZ == 32
-PixelGroup cfbstarttab[] =
- {
- cfbBits(0x00000000),
- cfbBits(0x00FFFFFF),
- cfbBits(0x0000FFFF),
- cfbBits(0x000000FF)
- };
-PixelGroup cfbendtab[] =
- {
- cfbBits(0x00000000),
- cfbBits(0xFF000000),
- cfbBits(0xFFFF0000),
- cfbBits(0xFFFFFF00)
- };
-#else /* PGSZ == 64 */
-PixelGroup cfbstarttab[] =
- {
- cfbBits(0x0000000000000000),
- cfbBits(0x00FFFFFFFFFFFFFF),
- cfbBits(0x0000FFFFFFFFFFFF),
- cfbBits(0x000000FFFFFFFFFF),
- cfbBits(0x00000000FFFFFFFF),
- cfbBits(0x0000000000FFFFFF),
- cfbBits(0x000000000000FFFF),
- cfbBits(0x00000000000000FF)
- };
-PixelGroup cfbendtab[] =
- {
- cfbBits(0x0000000000000000),
- cfbBits(0xFF00000000000000),
- cfbBits(0xFFFF000000000000),
- cfbBits(0xFFFFFF0000000000),
- cfbBits(0xFFFFFFFF00000000),
- cfbBits(0xFFFFFFFFFF000000),
- cfbBits(0xFFFFFFFFFFFF0000),
- cfbBits(0xFFFFFFFFFFFFFF00)
- };
-#endif /* PGSZ */
-#endif /* PSZ == 8 */
-
-#if PSZ == 16
-#if PGSZ == 32
-PixelGroup cfbstarttab[] =
- {
- cfbBits(0x00000000),
- cfbBits(0x0000FFFF),
- };
-PixelGroup cfbendtab[] =
- {
- cfbBits(0x00000000),
- cfbBits(0xFFFF0000),
- };
-#else /* PGSZ == 64 */
-PixelGroup cfbstarttab[] =
- {
- cfbBits(0x0000000000000000),
- cfbBits(0x0000FFFFFFFFFFFF),
- cfbBits(0x00000000FFFFFFFF),
- cfbBits(0x000000000000FFFF),
- };
-PixelGroup cfbendtab[] =
- {
- cfbBits(0x0000000000000000),
- cfbBits(0xFFFF000000000000),
- cfbBits(0xFFFFFFFF00000000),
- cfbBits(0xFFFFFFFFFFFF0000),
- };
-#endif /* PGSZ */
-#endif
-
-#if PSZ == 24
-#if PGSZ == 32
-PixelGroup cfbstarttab[] =
- {
- cfbBits(0x00000000),
- cfbBits(0x000000FF),
- cfbBits(0x0000FFFF),
- cfbBits(0x00FFFFFF),
- };
-PixelGroup cfbendtab[] =
- {
- cfbBits(0x00000000),
- cfbBits(0xFFFFFF00),
- cfbBits(0xFFFF0000),
- cfbBits(0xFF000000),
- };
-#else /* PGSZ == 64 */
-PixelGroup cfbstarttab[] =
- {
- cfbBits(0x0000000000000000),
- cfbBits(0x000000FFFFFFFFFF),
- cfbBits(0x000000000000FFFF),
- };
-PixelGroup cfbendtab[] =
- {
- cfbBits(0x0000000000000000),
- cfbBits(0xFFFFFFFFFF000000),
- cfbBits(0xFFFF000000000000),
- };
-#endif /* PGSZ */
-#endif /* PSZ == 24 */
-
-#if PSZ == 32
-#if PGSZ == 32
-PixelGroup cfbstarttab[] =
- {
- cfbBits(0x00000000),
- };
-PixelGroup cfbendtab[] =
- {
- cfbBits(0x00000000),
- };
-#else /* PGSZ == 64 */
-PixelGroup cfbstarttab[] =
- {
- cfbBits(0x0000000000000000),
- cfbBits(0x00000000FFFFFFFF),
- };
-PixelGroup cfbendtab[] =
- {
- cfbBits(0x0000000000000000),
- cfbBits(0xFFFFFFFF00000000),
- };
-#endif /* PGSZ */
-#endif /* PSZ == 32 */
-
-/* a hack, for now, since the entries for 0 need to be all
- 1 bits, not all zeros.
- this means the code DOES NOT WORK for segments of length
- 0 (which is only a problem in the horizontal line code.)
-*/
-#if PSZ == 4
-#if PGSZ == 32
-PixelGroup cfbstartpartial[] =
- {
- cfbBits(0xFFFFFFFF),
- cfbBits(0x0FFFFFFF),
- cfbBits(0x00FFFFFF),
- cfbBits(0x000FFFFF),
- cfbBits(0x0000FFFF),
- cfbBits(0x00000FFF),
- cfbBits(0x000000FF),
- cfbBits(0x0000000F)
- };
-
-PixelGroup cfbendpartial[] =
- {
- cfbBits(0xFFFFFFFF),
- cfbBits(0xF0000000),
- cfbBits(0xFF000000),
- cfbBits(0xFFF00000),
- cfbBits(0xFFFF0000),
- cfbBits(0xFFFFF000),
- cfbBits(0xFFFFFF00),
- cfbBits(0xFFFFFFF0)
- };
-#else /* PGSZ == 64 */
-PixelGroup cfbstartpartial[] =
- {
- cfbBits(0xFFFFFFFFFFFFFFFF),
- cfbBits(0x0FFFFFFFFFFFFFFF),
- cfbBits(0x00FFFFFFFFFFFFFF),
- cfbBits(0x000FFFFFFFFFFFFF),
- cfbBits(0x0000FFFFFFFFFFFF),
- cfbBits(0x00000FFFFFFFFFFF),
- cfbBits(0x000000FFFFFFFFFF),
- cfbBits(0x0000000FFFFFFFFF),
- cfbBits(0x00000000FFFFFFFF),
- cfbBits(0x000000000FFFFFFF),
- cfbBits(0x0000000000FFFFFF),
- cfbBits(0x00000000000FFFFF),
- cfbBits(0x000000000000FFFF),
- cfbBits(0x0000000000000FFF),
- cfbBits(0x00000000000000FF),
- cfbBits(0x000000000000000F),
- };
-
-PixelGroup cfbendpartial[] =
- {
- cfbBits(0xFFFFFFFFFFFFFFFF),
- cfbBits(0xF000000000000000),
- cfbBits(0xFF00000000000000),
- cfbBits(0xFFF0000000000000),
- cfbBits(0xFFFF000000000000),
- cfbBits(0xFFFFF00000000000),
- cfbBits(0xFFFFFF0000000000),
- cfbBits(0xFFFFFFF000000000),
- cfbBits(0xFFFFFFFF00000000),
- cfbBits(0xFFFFFFFFF0000000),
- cfbBits(0xFFFFFFFFFF000000),
- cfbBits(0xFFFFFFFFFFF00000),
- cfbBits(0xFFFFFFFFFFFF0000),
- cfbBits(0xFFFFFFFFFFFFF000),
- cfbBits(0xFFFFFFFFFFFFFF00),
- cfbBits(0xFFFFFFFFFFFFFFF0),
- };
-#endif /* PGSZ */
-#endif /* PSZ == 4 */
-
-#if PSZ == 8
-#if PGSZ == 32
-PixelGroup cfbstartpartial[] =
- {
- cfbBits(0xFFFFFFFF),
- cfbBits(0x00FFFFFF),
- cfbBits(0x0000FFFF),
- cfbBits(0x000000FF)
- };
-
-PixelGroup cfbendpartial[] =
- {
- cfbBits(0xFFFFFFFF),
- cfbBits(0xFF000000),
- cfbBits(0xFFFF0000),
- cfbBits(0xFFFFFF00)
- };
-#else /* PGSZ == 64 */
-PixelGroup cfbstartpartial[] =
- {
- cfbBits(0xFFFFFFFFFFFFFFFF),
- cfbBits(0x00FFFFFFFFFFFFFF),
- cfbBits(0x0000FFFFFFFFFFFF),
- cfbBits(0x000000FFFFFFFFFF),
- cfbBits(0x00000000FFFFFFFF),
- cfbBits(0x0000000000FFFFFF),
- cfbBits(0x000000000000FFFF),
- cfbBits(0x00000000000000FF),
- };
-
-PixelGroup cfbendpartial[] =
- {
- cfbBits(0xFFFFFFFFFFFFFFFF),
- cfbBits(0xFF00000000000000),
- cfbBits(0xFFFF000000000000),
- cfbBits(0xFFFFFF0000000000),
- cfbBits(0xFFFFFFFF00000000),
- cfbBits(0xFFFFFFFFFF000000),
- cfbBits(0xFFFFFFFFFFFF0000),
- cfbBits(0xFFFFFFFFFFFFFF00),
- };
-#endif /* PGSZ */
-#endif /* PSZ == 8 */
-
-#if PSZ == 16
-#if PGSZ == 32
-PixelGroup cfbstartpartial[] =
- {
- cfbBits(0xFFFFFFFF),
- cfbBits(0x0000FFFF),
- };
-
-PixelGroup cfbendpartial[] =
- {
- cfbBits(0xFFFFFFFF),
- cfbBits(0xFFFF0000),
- };
-#else /* PGSZ == 64 */
-PixelGroup cfbstartpartial[] =
- {
- cfbBits(0xFFFFFFFFFFFFFFFF),
- cfbBits(0x0000FFFFFFFFFFFF),
- cfbBits(0x00000000FFFFFFFF),
- cfbBits(0x000000000000FFFF),
- };
-
-PixelGroup cfbendpartial[] =
- {
- cfbBits(0xFFFFFFFFFFFFFFFF),
- cfbBits(0xFFFF000000000000),
- cfbBits(0xFFFFFFFF00000000),
- cfbBits(0xFFFFFFFFFFFF0000),
- };
-#endif /* PGSZ */
-#endif /* PSZ == 16 */
-
-#if PSZ == 24
-#if PGSZ == 32
-PixelGroup cfbstartpartial[] =
- {
- cfbBits(0xFFFFFFFF),
- cfbBits(0x000000FF),
- cfbBits(0x0000FFFF),
- cfbBits(0x00FFFFFF),
- };
-
-PixelGroup cfbendpartial[] =
- {
- cfbBits(0xFFFFFFFF),
- cfbBits(0xFFFFFF00),
- cfbBits(0xFFFF0000),
- cfbBits(0xFF000000),
- };
-#else /* PGSZ == 64 */
-PixelGroup cfbstartpartial[] =
- {
- cfbBits(0xFFFFFFFFFFFFFFFF),
- cfbBits(0x0000FFFFFFFFFFFF),
- cfbBits(0x000000FFFFFFFFFF),
- cfbBits(0x00000000FFFFFFFF),
- cfbBits(0x0000000000FFFFFF),
- cfbBits(0x000000000000FFFF),
- cfbBits(0x00000000000000FF),
- };
-
-PixelGroup cfbendpartial[] =
- {
- cfbBits(0xFFFFFFFFFFFFFFFF),
- cfbBits(0xFFFFFFFFFFFF0000),
- cfbBits(0xFFFFFFFFFF000000),
- cfbBits(0xFFFFFFFF00000000),
- cfbBits(0xFFFFFF0000000000),
- cfbBits(0xFFFF000000000000),
- cfbBits(0xFF00000000000000),
- };
-#endif /* PGSZ */
-#endif /* PSZ == 24 */
-
-#if PSZ == 32
-#if PGSZ == 32
-PixelGroup cfbstartpartial[] =
- {
- cfbBits(0xFFFFFFFF),
- };
-
-PixelGroup cfbendpartial[] =
- {
- cfbBits(0xFFFFFFFF),
- };
-#else /* PGSZ == 64 */
-PixelGroup cfbstartpartial[] =
- {
- cfbBits(0xFFFFFFFFFFFFFFFF),
- cfbBits(0x00000000FFFFFFFF),
- };
-
-PixelGroup cfbendpartial[] =
- {
- cfbBits(0xFFFFFFFFFFFFFFFF),
- cfbBits(0xFFFFFFFF00000000),
- };
-#endif /* PGSZ */
-#endif /* PSZ == 32 */
-
-/* used for masking bits in bresenham lines
- mask[n] is used to mask out all but bit n in a longword (n is a
-screen position).
- rmask[n] is used to mask out the single bit at position n (n
-is a screen posiotion.)
-*/
-
-#if PSZ == 4
-#if PGSZ == 32
-PixelGroup cfbmask[] =
- {
- cfbBits(0xF0000000),
- cfbBits(0x0F000000),
- cfbBits(0x00F00000),
- cfbBits(0x000F0000),
- cfbBits(0x0000F000),
- cfbBits(0x00000F00),
- cfbBits(0x000000F0),
- cfbBits(0x0000000F)
- };
-PixelGroup cfbrmask[] =
- {
- cfbBits(0x0FFFFFFF),
- cfbBits(0xF0FFFFFF),
- cfbBits(0xFF0FFFFF),
- cfbBits(0xFFF0FFFF),
- cfbBits(0xFFFF0FFF),
- cfbBits(0xFFFFF0FF),
- cfbBits(0xFFFFFF0F),
- cfbBits(0xFFFFFFF0)
- };
-#else /* PGSZ == 64 */
-PixelGroup cfbmask[] =
- {
- cfbBits(0xF000000000000000),
- cfbBits(0x0F00000000000000),
- cfbBits(0x00F0000000000000),
- cfbBits(0x000F000000000000),
- cfbBits(0x0000F00000000000),
- cfbBits(0x00000F0000000000),
- cfbBits(0x000000F000000000),
- cfbBits(0x0000000F00000000),
- cfbBits(0x00000000F0000000),
- cfbBits(0x000000000F000000),
- cfbBits(0x0000000000F00000),
- cfbBits(0x00000000000F0000),
- cfbBits(0x000000000000F000),
- cfbBits(0x0000000000000F00),
- cfbBits(0x00000000000000F0),
- cfbBits(0x000000000000000F),
- };
-PixelGroup cfbrmask[] =
- {
- cfbBits(0x0FFFFFFFFFFFFFFF),
- cfbBits(0xF0FFFFFFFFFFFFFF),
- cfbBits(0xFF0FFFFFFFFFFFFF),
- cfbBits(0xFFF0FFFFFFFFFFFF),
- cfbBits(0xFFFF0FFFFFFFFFFF),
- cfbBits(0xFFFFF0FFFFFFFFFF),
- cfbBits(0xFFFFFF0FFFFFFFFF),
- cfbBits(0xFFFFFFF0FFFFFFFF),
- cfbBits(0xFFFFFFFF0FFFFFFF),
- cfbBits(0xFFFFFFFFF0FFFFFF),
- cfbBits(0xFFFFFFFFFF0FFFFF),
- cfbBits(0xFFFFFFFFFFF0FFFF),
- cfbBits(0xFFFFFFFFFFFF0FFF),
- cfbBits(0xFFFFFFFFFFFFF0FF),
- cfbBits(0xFFFFFFFFFFFFFF0F),
- cfbBits(0xFFFFFFFFFFFFFFF0),
- };
-#endif /* PGSZ */
-#endif /* PSZ == 4 */
-
-#if PSZ == 8
-#if PGSZ == 32
-PixelGroup cfbmask[] =
- {
- cfbBits(0xFF000000),
- cfbBits(0x00FF0000),
- cfbBits(0x0000FF00),
- cfbBits(0x000000FF)
- };
-PixelGroup cfbrmask[] =
- {
- cfbBits(0x00FFFFFF),
- cfbBits(0xFF00FFFF),
- cfbBits(0xFFFF00FF),
- cfbBits(0xFFFFFF00)
- };
-#else /* PGSZ == 64 */
-PixelGroup cfbmask[] =
- {
- cfbBits(0xFF00000000000000),
- cfbBits(0x00FF000000000000),
- cfbBits(0x0000FF0000000000),
- cfbBits(0x000000FF00000000),
- cfbBits(0x00000000FF000000),
- cfbBits(0x0000000000FF0000),
- cfbBits(0x000000000000FF00),
- cfbBits(0x00000000000000FF),
- };
-PixelGroup cfbrmask[] =
- {
- cfbBits(0x00FFFFFFFFFFFFFF),
- cfbBits(0xFF00FFFFFFFFFFFF),
- cfbBits(0xFFFF00FFFFFFFFFF),
- cfbBits(0xFFFFFF00FFFFFFFF),
- cfbBits(0xFFFFFFFF00FFFFFF),
- cfbBits(0xFFFFFFFFFF00FFFF),
- cfbBits(0xFFFFFFFFFFFF00FF),
- cfbBits(0xFFFFFFFFFFFFFF00),
- };
-#endif /* PGSZ */
-#endif /* PSZ == 8 */
-
-#if PSZ == 16
-#if PGSZ == 32
-PixelGroup cfbmask[] =
- {
- cfbBits(0xFFFF0000),
- cfbBits(0x0000FFFF),
- };
-PixelGroup cfbrmask[] =
- {
- cfbBits(0x0000FFFF),
- cfbBits(0xFFFF0000),
- };
-#else /* PGSZ == 64 */
-PixelGroup cfbmask[] =
- {
- cfbBits(0xFFFF000000000000),
- cfbBits(0x0000FFFF00000000),
- cfbBits(0x00000000FFFF0000),
- cfbBits(0x000000000000FFFF),
- };
-PixelGroup cfbrmask[] =
- {
- cfbBits(0x0000FFFFFFFFFFFF),
- cfbBits(0xFFFF0000FFFFFFFF),
- cfbBits(0xFFFFFFFF0000FFFF),
- cfbBits(0xFFFFFFFFFFFF0000),
- };
-#endif /* PGSZ */
-#endif /* PSZ == 16 */
-
-#if PSZ == 24
-#if PGSZ == 32
-PixelGroup cfbmask[] =
- {
- cfbBits(0xFFFFFF00),
- cfbBits(0x00000000),
- cfbBits(0x000000FF),
- cfbBits(0xFFFF0000),
- cfbBits(0x0000FFFF),
- cfbBits(0xFF000000),
- cfbBits(0x00FFFFFF),
- cfbBits(0x00000000),
- };
-PixelGroup cfbrmask[] =
- {
- cfbBits(0x000000FF),
- cfbBits(0xFFFFFFFF),
- cfbBits(0xFFFFFF00),
- cfbBits(0x0000FFFF),
- cfbBits(0xFFFF0000),
- cfbBits(0x00FFFFFF),
- cfbBits(0xFF000000),
- cfbBits(0xFFFFFFFF),
- };
-#else /* PGSZ == 64 */
-PixelGroup cfbmask[] =
- {
- cfbBits(0xFFFFFF0000000000),
- cfbBits(0x000000FFFFFF0000),
- cfbBits(0x000000000000FFFF),
- };
-PixelGroup cfbmask2[] =
- {
- cfbBits(0x0000000000000000),
- cfbBits(0x0000000000000000),
- cfbBits(0xFF00000000000000),
- };
-PixelGroup cfbrmask[] =
- {
- cfbBits(0x000000FFFFFFFFFF),
- cfbBits(0xFFFFFF000000FFFF),
- cfbBits(0xFFFFFFFFFFFF0000),
- };
-PixelGroup cfbrmask2[] =
- {
- cfbBits(0x0000000000000000),
- cfbBits(0x0000000000000000),
- cfbBits(0x00FFFFFFFFFFFFFF),
- };
-#endif /* PGSZ */
-#endif /* PSZ == 24 */
-
-#if PSZ == 32
-#if PGSZ == 32
-PixelGroup cfbmask[] =
- {
- cfbBits(0xFFFFFFFF),
- };
-PixelGroup cfbrmask[] =
- {
- cfbBits(0xFFFFFFFF),
- };
-#else /* PGSZ == 64 */
-PixelGroup cfbmask[] =
- {
- cfbBits(0xFFFFFFFF00000000),
- cfbBits(0x00000000FFFFFFFF),
- };
-PixelGroup cfbrmask[] =
- {
- cfbBits(0x00000000FFFFFFFF),
- cfbBits(0xFFFFFFFF00000000),
- };
-#endif /* PGSZ */
-#endif /* PSZ == 32 */
-
-/*
- * QuartetBitsTable contains PPW+1 masks whose binary values are masks in the
- * low order quartet that contain the number of bits specified in the
- * index. This table is used by getstipplepixels.
- */
-#if PSZ == 4
-PixelGroup QuartetBitsTable[] = {
-#if PGSZ == 32
-#if (BITMAP_BIT_ORDER == MSBFirst)
- 0x00000000, /* 0 - 00000000 */
- 0x00000080, /* 1 - 10000000 */
- 0x000000C0, /* 2 - 11000000 */
- 0x000000E0, /* 3 - 11100000 */
- 0x000000F0, /* 4 - 11110000 */
- 0x000000F8, /* 5 - 11111000 */
- 0x000000FC, /* 6 - 11111100 */
- 0x000000FE, /* 7 - 11111110 */
- 0x000000FF /* 8 - 11111111 */
-#else /* (BITMAP_BIT_ORDER == LSBFirst */
- 0x00000000, /* 0 - 00000000 */
- 0x00000001, /* 1 - 00000001 */
- 0x00000003, /* 2 - 00000011 */
- 0x00000007, /* 3 - 00000111 */
- 0x0000000F, /* 4 - 00001111 */
- 0x0000001F, /* 5 - 00011111 */
- 0x0000003F, /* 6 - 00111111 */
- 0x0000007F, /* 7 - 01111111 */
- 0x000000FF /* 8 - 11111111 */
-#endif /* (BITMAP_BIT_ORDER == MSBFirst) */
-#else /* PGSZ == 64 */
-#if (BITMAP_BIT_ORDER == MSBFirst)
- 0x00000000, /* 0 - 0000000000000000 */
- 0x00008000, /* 1 - 1000000000000000 */
- 0x0000C000, /* 2 - 1100000000000000 */
- 0x0000E000, /* 3 - 1110000000000000 */
- 0x0000F000, /* 4 - 1111000000000000 */
- 0x0000F800, /* 5 - 1111100000000000 */
- 0x0000FC00, /* 6 - 1111110000000000 */
- 0x0000FE00, /* 7 - 1111111000000000 */
- 0x0000FF00, /* 8 - 1111111100000000 */
- 0x0000FF80, /* 9 - 1111111110000000 */
- 0x0000FFC0, /* 10- 1111111111000000 */
- 0x0000FFE0, /* 11- 1111111111100000 */
- 0x0000FFF0, /* 12- 1111111111110000 */
- 0x0000FFF8, /* 13- 1111111111111000 */
- 0x0000FFFC, /* 14- 1111111111111100 */
- 0x0000FFFE, /* 15- 1111111111111110 */
- 0x0000FFFF, /* 16- 1111111111111111 */
-#else /* (BITMAP_BIT_ORDER == LSBFirst */
- 0x00000000, /* 0 - 0000000000000000 */
- 0x00000001, /* 1 - 0000000000000001 */
- 0x00000003, /* 2 - 0000000000000011 */
- 0x00000007, /* 3 - 0000000000000111 */
- 0x0000000F, /* 4 - 0000000000001111 */
- 0x0000001F, /* 5 - 0000000000011111 */
- 0x0000003F, /* 6 - 0000000000111111 */
- 0x0000007F, /* 7 - 0000000001111111 */
- 0x000000FF, /* 8 - 0000000011111111 */
- 0x000001FF, /* 9 - 0000000111111111 */
- 0x000003FF, /* 10- 0000001111111111 */
- 0x000007FF, /* 11- 0000011111111111 */
- 0x00000FFF, /* 12- 0000111111111111 */
- 0x00001FFF, /* 13- 0001111111111111 */
- 0x00003FFF, /* 14- 0011111111111111 */
- 0x00007FFF, /* 15- 0111111111111111 */
- 0x0000FFFF, /* 16- 1111111111111111 */
-#endif /* (BITMAP_BIT_ORDER == MSBFirst) */
-#endif /* PGSZ */
-};
-#endif /* PSZ == 4 */
-
-#if PSZ == 8
-PixelGroup QuartetBitsTable[] = {
-#if PGSZ == 32
-#if (BITMAP_BIT_ORDER == MSBFirst)
- 0x00000000, /* 0 - 0000 */
- 0x00000008, /* 1 - 1000 */
- 0x0000000C, /* 2 - 1100 */
- 0x0000000E, /* 3 - 1110 */
- 0x0000000F /* 4 - 1111 */
-#else /* (BITMAP_BIT_ORDER == LSBFirst */
- 0x00000000, /* 0 - 0000 */
- 0x00000001, /* 1 - 0001 */
- 0x00000003, /* 2 - 0011 */
- 0x00000007, /* 3 - 0111 */
- 0x0000000F /* 4 - 1111 */
-#endif /* (BITMAP_BIT_ORDER == MSBFirst) */
-#else /* PGSZ == 64 */
-#if (BITMAP_BIT_ORDER == MSBFirst)
- 0x00000000, /* 0 - 00000000 */
- 0x00000080, /* 1 - 10000000 */
- 0x000000C0, /* 2 - 11000000 */
- 0x000000E0, /* 3 - 11100000 */
- 0x000000F0, /* 4 - 11110000 */
- 0x000000F8, /* 5 - 11111000 */
- 0x000000FC, /* 6 - 11111100 */
- 0x000000FE, /* 7 - 11111110 */
- 0x000000FF /* 8 - 11111111 */
-#else /* (BITMAP_BIT_ORDER == LSBFirst */
- 0x00000000, /* 0 - 00000000 */
- 0x00000001, /* 1 - 00000001 */
- 0x00000003, /* 2 - 00000011 */
- 0x00000007, /* 3 - 00000111 */
- 0x0000000F, /* 4 - 10000111 */
- 0x0000001F, /* 5 - 00011111 */
- 0x0000003F, /* 6 - 00111111 */
- 0x0000007F, /* 7 - 01111111 */
- 0x000000FF /* 8 - 11111111 */
-#endif /* (BITMAP_BIT_ORDER == MSBFirst) */
-#endif /* PGSZ */
-};
-#endif /* PSZ == 8 */
-
-#if PSZ == 16
-PixelGroup QuartetBitsTable[] = {
-#if PGSZ == 32
-#if (BITMAP_BIT_ORDER == MSBFirst)
- 0x00000000, /* 0 - 00 */
- 0x00000002, /* 1 - 10 */
- 0x00000003, /* 2 - 11 */
-#else /* (BITMAP_BIT_ORDER == LSBFirst */
- 0x00000000, /* 0 - 00 */
- 0x00000001, /* 1 - 01 */
- 0x00000003, /* 2 - 11 */
-#endif /* (BITMAP_BIT_ORDER == MSBFirst) */
-#else /* PGSZ == 64 */
-#if (BITMAP_BIT_ORDER == MSBFirst)
- 0x00000000, /* 0 - 0000 */
- 0x00000008, /* 1 - 1000 */
- 0x0000000C, /* 2 - 1100 */
- 0x0000000E, /* 3 - 1110 */
- 0x0000000F, /* 4 - 1111 */
-#else /* (BITMAP_BIT_ORDER == LSBFirst */
- 0x00000000, /* 0 - 0000 */
- 0x00000001, /* 1 - 0001 */
- 0x00000003, /* 2 - 0011 */
- 0x00000007, /* 3 - 0111 */
- 0x0000000F, /* 4 - 1111 */
-#endif /* (BITMAP_BIT_ORDER == MSBFirst) */
-#endif /* PGSZ */
-};
-#endif /* PSZ == 16 */
-
-#if PSZ == 24
-PixelGroup QuartetBitsTable[] = {
-#if PGSZ == 32
-#if (BITMAP_BIT_ORDER == MSBFirst)
- 0x00000000, /* 0 - 0 */
- 0x00000001, /* 1 - 1 */
-#else /* (BITMAP_BIT_ORDER == LSBFirst */
- 0x00000000, /* 0 - 0 */
- 0x00000001, /* 1 - 1 */
-#endif /* (BITMAP_BIT_ORDER == MSBFirst) */
-#else /* PGSZ == 64 */
-#if (BITMAP_BIT_ORDER == MSBFirst)
- 0x00000000, /* 0 - 00 */
- 0x00000002, /* 1 - 10 */
- 0x00000003, /* 2 - 11*/
-#else /* (BITMAP_BIT_ORDER == LSBFirst */
- 0x00000000, /* 0 - 00 */
- 0x00000001, /* 1 - 01 */
- 0x00000003, /* 2 - 11 */
-#endif /* (BITMAP_BIT_ORDER == MSBFirst) */
-#endif /* PGSZ */
-};
-#endif /* PSZ == 24 */
-
-#if PSZ == 32
-PixelGroup QuartetBitsTable[] = {
-#if PGSZ == 32
-#if (BITMAP_BIT_ORDER == MSBFirst)
- 0x00000000, /* 0 - 0 */
- 0x00000001, /* 1 - 1 */
-#else /* (BITMAP_BIT_ORDER == LSBFirst */
- 0x00000000, /* 0 - 0 */
- 0x00000001, /* 1 - 1 */
-#endif /* (BITMAP_BIT_ORDER == MSBFirst) */
-#else /* PGSZ == 64 */
-#if (BITMAP_BIT_ORDER == MSBFirst)
- 0x00000000, /* 0 - 00 */
- 0x00000002, /* 1 - 10 */
- 0x00000003, /* 2 - 11*/
-#else /* (BITMAP_BIT_ORDER == LSBFirst */
- 0x00000000, /* 0 - 00 */
- 0x00000001, /* 1 - 01 */
- 0x00000003, /* 2 - 11 */
-#endif /* (BITMAP_BIT_ORDER == MSBFirst) */
-#endif /* PGSZ */
-};
-#endif /* PSZ == 32 */
-
-/*
- * QuartetPixelMaskTable is used by getstipplepixels to get a pixel mask
- * corresponding to a quartet of bits. Note: the bit/byte order dependency
- * is handled by QuartetBitsTable above.
- */
-#if PSZ == 4
-#if PGSZ == 32
-PixelGroup QuartetPixelMaskTable[] = {
- 0x00000000,
- 0x0000000F,
- 0x000000F0,
- 0x000000FF,
- 0x00000F00,
- 0x00000F0F,
- 0x00000FF0,
- 0x00000FFF,
- 0x0000F000,
- 0x0000F00F,
- 0x0000F0F0,
- 0x0000F0FF,
- 0x0000FF00,
- 0x0000FF0F,
- 0x0000FFF0,
- 0x0000FFFF,
- 0x000F0000,
- 0x000F000F,
- 0x000F00F0,
- 0x000F00FF,
- 0x000F0F00,
- 0x000F0F0F,
- 0x000F0FF0,
- 0x000F0FFF,
- 0x000FF000,
- 0x000FF00F,
- 0x000FF0F0,
- 0x000FF0FF,
- 0x000FFF00,
- 0x000FFF0F,
- 0x000FFFF0,
- 0x000FFFFF,
- 0x00F00000,
- 0x00F0000F,
- 0x00F000F0,
- 0x00F000FF,
- 0x00F00F00,
- 0x00F00F0F,
- 0x00F00FF0,
- 0x00F00FFF,
- 0x00F0F000,
- 0x00F0F00F,
- 0x00F0F0F0,
- 0x00F0F0FF,
- 0x00F0FF00,
- 0x00F0FF0F,
- 0x00F0FFF0,
- 0x00F0FFFF,
- 0x00FF0000,
- 0x00FF000F,
- 0x00FF00F0,
- 0x00FF00FF,
- 0x00FF0F00,
- 0x00FF0F0F,
- 0x00FF0FF0,
- 0x00FF0FFF,
- 0x00FFF000,
- 0x00FFF00F,
- 0x00FFF0F0,
- 0x00FFF0FF,
- 0x00FFFF00,
- 0x00FFFF0F,
- 0x00FFFFF0,
- 0x00FFFFFF,
- 0x0F000000,
- 0x0F00000F,
- 0x0F0000F0,
- 0x0F0000FF,
- 0x0F000F00,
- 0x0F000F0F,
- 0x0F000FF0,
- 0x0F000FFF,
- 0x0F00F000,
- 0x0F00F00F,
- 0x0F00F0F0,
- 0x0F00F0FF,
- 0x0F00FF00,
- 0x0F00FF0F,
- 0x0F00FFF0,
- 0x0F00FFFF,
- 0x0F0F0000,
- 0x0F0F000F,
- 0x0F0F00F0,
- 0x0F0F00FF,
- 0x0F0F0F00,
- 0x0F0F0F0F,
- 0x0F0F0FF0,
- 0x0F0F0FFF,
- 0x0F0FF000,
- 0x0F0FF00F,
- 0x0F0FF0F0,
- 0x0F0FF0FF,
- 0x0F0FFF00,
- 0x0F0FFF0F,
- 0x0F0FFFF0,
- 0x0F0FFFFF,
- 0x0FF00000,
- 0x0FF0000F,
- 0x0FF000F0,
- 0x0FF000FF,
- 0x0FF00F00,
- 0x0FF00F0F,
- 0x0FF00FF0,
- 0x0FF00FFF,
- 0x0FF0F000,
- 0x0FF0F00F,
- 0x0FF0F0F0,
- 0x0FF0F0FF,
- 0x0FF0FF00,
- 0x0FF0FF0F,
- 0x0FF0FFF0,
- 0x0FF0FFFF,
- 0x0FFF0000,
- 0x0FFF000F,
- 0x0FFF00F0,
- 0x0FFF00FF,
- 0x0FFF0F00,
- 0x0FFF0F0F,
- 0x0FFF0FF0,
- 0x0FFF0FFF,
- 0x0FFFF000,
- 0x0FFFF00F,
- 0x0FFFF0F0,
- 0x0FFFF0FF,
- 0x0FFFFF00,
- 0x0FFFFF0F,
- 0x0FFFFFF0,
- 0x0FFFFFFF,
- 0xF0000000,
- 0xF000000F,
- 0xF00000F0,
- 0xF00000FF,
- 0xF0000F00,
- 0xF0000F0F,
- 0xF0000FF0,
- 0xF0000FFF,
- 0xF000F000,
- 0xF000F00F,
- 0xF000F0F0,
- 0xF000F0FF,
- 0xF000FF00,
- 0xF000FF0F,
- 0xF000FFF0,
- 0xF000FFFF,
- 0xF00F0000,
- 0xF00F000F,
- 0xF00F00F0,
- 0xF00F00FF,
- 0xF00F0F00,
- 0xF00F0F0F,
- 0xF00F0FF0,
- 0xF00F0FFF,
- 0xF00FF000,
- 0xF00FF00F,
- 0xF00FF0F0,
- 0xF00FF0FF,
- 0xF00FFF00,
- 0xF00FFF0F,
- 0xF00FFFF0,
- 0xF00FFFFF,
- 0xF0F00000,
- 0xF0F0000F,
- 0xF0F000F0,
- 0xF0F000FF,
- 0xF0F00F00,
- 0xF0F00F0F,
- 0xF0F00FF0,
- 0xF0F00FFF,
- 0xF0F0F000,
- 0xF0F0F00F,
- 0xF0F0F0F0,
- 0xF0F0F0FF,
- 0xF0F0FF00,
- 0xF0F0FF0F,
- 0xF0F0FFF0,
- 0xF0F0FFFF,
- 0xF0FF0000,
- 0xF0FF000F,
- 0xF0FF00F0,
- 0xF0FF00FF,
- 0xF0FF0F00,
- 0xF0FF0F0F,
- 0xF0FF0FF0,
- 0xF0FF0FFF,
- 0xF0FFF000,
- 0xF0FFF00F,
- 0xF0FFF0F0,
- 0xF0FFF0FF,
- 0xF0FFFF00,
- 0xF0FFFF0F,
- 0xF0FFFFF0,
- 0xF0FFFFFF,
- 0xFF000000,
- 0xFF00000F,
- 0xFF0000F0,
- 0xFF0000FF,
- 0xFF000F00,
- 0xFF000F0F,
- 0xFF000FF0,
- 0xFF000FFF,
- 0xFF00F000,
- 0xFF00F00F,
- 0xFF00F0F0,
- 0xFF00F0FF,
- 0xFF00FF00,
- 0xFF00FF0F,
- 0xFF00FFF0,
- 0xFF00FFFF,
- 0xFF0F0000,
- 0xFF0F000F,
- 0xFF0F00F0,
- 0xFF0F00FF,
- 0xFF0F0F00,
- 0xFF0F0F0F,
- 0xFF0F0FF0,
- 0xFF0F0FFF,
- 0xFF0FF000,
- 0xFF0FF00F,
- 0xFF0FF0F0,
- 0xFF0FF0FF,
- 0xFF0FFF00,
- 0xFF0FFF0F,
- 0xFF0FFFF0,
- 0xFF0FFFFF,
- 0xFFF00000,
- 0xFFF0000F,
- 0xFFF000F0,
- 0xFFF000FF,
- 0xFFF00F00,
- 0xFFF00F0F,
- 0xFFF00FF0,
- 0xFFF00FFF,
- 0xFFF0F000,
- 0xFFF0F00F,
- 0xFFF0F0F0,
- 0xFFF0F0FF,
- 0xFFF0FF00,
- 0xFFF0FF0F,
- 0xFFF0FFF0,
- 0xFFF0FFFF,
- 0xFFFF0000,
- 0xFFFF000F,
- 0xFFFF00F0,
- 0xFFFF00FF,
- 0xFFFF0F00,
- 0xFFFF0F0F,
- 0xFFFF0FF0,
- 0xFFFF0FFF,
- 0xFFFFF000,
- 0xFFFFF00F,
- 0xFFFFF0F0,
- 0xFFFFF0FF,
- 0xFFFFFF00,
- 0xFFFFFF0F,
- 0xFFFFFFF0,
- 0xFFFFFFFF,
-};
-#else /* PGSZ == 64 */
-No QuartetPixelMaskTable for psz=PSZ
-this would be a 64K entry table, a bit much I think.
-Try breaking things in two:
-mask = table[index&0xff00]<<32 | table[index&0xff]
-#endif /* PGSZ */
-#endif /* PSZ == 4 */
-
-#if PSZ == 8
-PixelGroup QuartetPixelMaskTable[] = {
-#if PGSZ == 32
- 0x00000000,
- 0x000000FF,
- 0x0000FF00,
- 0x0000FFFF,
- 0x00FF0000,
- 0x00FF00FF,
- 0x00FFFF00,
- 0x00FFFFFF,
- 0xFF000000,
- 0xFF0000FF,
- 0xFF00FF00,
- 0xFF00FFFF,
- 0xFFFF0000,
- 0xFFFF00FF,
- 0xFFFFFF00,
- 0xFFFFFFFF
-#else /* PGSZ == 64 */
- 0x0000000000000000, 0x00000000000000FF,
- 0x000000000000FF00, 0x000000000000FFFF,
- 0x0000000000FF0000, 0x0000000000FF00FF,
- 0x0000000000FFFF00, 0x0000000000FFFFFF,
- 0x00000000FF000000, 0x00000000FF0000FF,
- 0x00000000FF00FF00, 0x00000000FF00FFFF,
- 0x00000000FFFF0000, 0x00000000FFFF00FF,
- 0x00000000FFFFFF00, 0x00000000FFFFFFFF,
- 0x000000FF00000000, 0x000000FF000000FF,
- 0x000000FF0000FF00, 0x000000FF0000FFFF,
- 0x000000FF00FF0000, 0x000000FF00FF00FF,
- 0x000000FF00FFFF00, 0x000000FF00FFFFFF,
- 0x000000FFFF000000, 0x000000FFFF0000FF,
- 0x000000FFFF00FF00, 0x000000FFFF00FFFF,
- 0x000000FFFFFF0000, 0x000000FFFFFF00FF,
- 0x000000FFFFFFFF00, 0x000000FFFFFFFFFF,
- 0x0000FF0000000000, 0x0000FF00000000FF,
- 0x0000FF000000FF00, 0x0000FF000000FFFF,
- 0x0000FF0000FF0000, 0x0000FF0000FF00FF,
- 0x0000FF0000FFFF00, 0x0000FF0000FFFFFF,
- 0x0000FF00FF000000, 0x0000FF00FF0000FF,
- 0x0000FF00FF00FF00, 0x0000FF00FF00FFFF,
- 0x0000FF00FFFF0000, 0x0000FF00FFFF00FF,
- 0x0000FF00FFFFFF00, 0x0000FF00FFFFFFFF,
- 0x0000FFFF00000000, 0x0000FFFF000000FF,
- 0x0000FFFF0000FF00, 0x0000FFFF0000FFFF,
- 0x0000FFFF00FF0000, 0x0000FFFF00FF00FF,
- 0x0000FFFF00FFFF00, 0x0000FFFF00FFFFFF,
- 0x0000FFFFFF000000, 0x0000FFFFFF0000FF,
- 0x0000FFFFFF00FF00, 0x0000FFFFFF00FFFF,
- 0x0000FFFFFFFF0000, 0x0000FFFFFFFF00FF,
- 0x0000FFFFFFFFFF00, 0x0000FFFFFFFFFFFF,
- 0x00FF000000000000, 0x00FF0000000000FF,
- 0x00FF00000000FF00, 0x00FF00000000FFFF,
- 0x00FF000000FF0000, 0x00FF000000FF00FF,
- 0x00FF000000FFFF00, 0x00FF000000FFFFFF,
- 0x00FF0000FF000000, 0x00FF0000FF0000FF,
- 0x00FF0000FF00FF00, 0x00FF0000FF00FFFF,
- 0x00FF0000FFFF0000, 0x00FF0000FFFF00FF,
- 0x00FF0000FFFFFF00, 0x00FF0000FFFFFFFF,
- 0x00FF00FF00000000, 0x00FF00FF000000FF,
- 0x00FF00FF0000FF00, 0x00FF00FF0000FFFF,
- 0x00FF00FF00FF0000, 0x00FF00FF00FF00FF,
- 0x00FF00FF00FFFF00, 0x00FF00FF00FFFFFF,
- 0x00FF00FFFF000000, 0x00FF00FFFF0000FF,
- 0x00FF00FFFF00FF00, 0x00FF00FFFF00FFFF,
- 0x00FF00FFFFFF0000, 0x00FF00FFFFFF00FF,
- 0x00FF00FFFFFFFF00, 0x00FF00FFFFFFFFFF,
- 0x00FFFF0000000000, 0x00FFFF00000000FF,
- 0x00FFFF000000FF00, 0x00FFFF000000FFFF,
- 0x00FFFF0000FF0000, 0x00FFFF0000FF00FF,
- 0x00FFFF0000FFFF00, 0x00FFFF0000FFFFFF,
- 0x00FFFF00FF000000, 0x00FFFF00FF0000FF,
- 0x00FFFF00FF00FF00, 0x00FFFF00FF00FFFF,
- 0x00FFFF00FFFF0000, 0x00FFFF00FFFF00FF,
- 0x00FFFF00FFFFFF00, 0x00FFFF00FFFFFFFF,
- 0x00FFFFFF00000000, 0x00FFFFFF000000FF,
- 0x00FFFFFF0000FF00, 0x00FFFFFF0000FFFF,
- 0x00FFFFFF00FF0000, 0x00FFFFFF00FF00FF,
- 0x00FFFFFF00FFFF00, 0x00FFFFFF00FFFFFF,
- 0x00FFFFFFFF000000, 0x00FFFFFFFF0000FF,
- 0x00FFFFFFFF00FF00, 0x00FFFFFFFF00FFFF,
- 0x00FFFFFFFFFF0000, 0x00FFFFFFFFFF00FF,
- 0x00FFFFFFFFFFFF00, 0x00FFFFFFFFFFFFFF,
- 0xFF00000000000000, 0xFF000000000000FF,
- 0xFF0000000000FF00, 0xFF0000000000FFFF,
- 0xFF00000000FF0000, 0xFF00000000FF00FF,
- 0xFF00000000FFFF00, 0xFF00000000FFFFFF,
- 0xFF000000FF000000, 0xFF000000FF0000FF,
- 0xFF000000FF00FF00, 0xFF000000FF00FFFF,
- 0xFF000000FFFF0000, 0xFF000000FFFF00FF,
- 0xFF000000FFFFFF00, 0xFF000000FFFFFFFF,
- 0xFF0000FF00000000, 0xFF0000FF000000FF,
- 0xFF0000FF0000FF00, 0xFF0000FF0000FFFF,
- 0xFF0000FF00FF0000, 0xFF0000FF00FF00FF,
- 0xFF0000FF00FFFF00, 0xFF0000FF00FFFFFF,
- 0xFF0000FFFF000000, 0xFF0000FFFF0000FF,
- 0xFF0000FFFF00FF00, 0xFF0000FFFF00FFFF,
- 0xFF0000FFFFFF0000, 0xFF0000FFFFFF00FF,
- 0xFF0000FFFFFFFF00, 0xFF0000FFFFFFFFFF,
- 0xFF00FF0000000000, 0xFF00FF00000000FF,
- 0xFF00FF000000FF00, 0xFF00FF000000FFFF,
- 0xFF00FF0000FF0000, 0xFF00FF0000FF00FF,
- 0xFF00FF0000FFFF00, 0xFF00FF0000FFFFFF,
- 0xFF00FF00FF000000, 0xFF00FF00FF0000FF,
- 0xFF00FF00FF00FF00, 0xFF00FF00FF00FFFF,
- 0xFF00FF00FFFF0000, 0xFF00FF00FFFF00FF,
- 0xFF00FF00FFFFFF00, 0xFF00FF00FFFFFFFF,
- 0xFF00FFFF00000000, 0xFF00FFFF000000FF,
- 0xFF00FFFF0000FF00, 0xFF00FFFF0000FFFF,
- 0xFF00FFFF00FF0000, 0xFF00FFFF00FF00FF,
- 0xFF00FFFF00FFFF00, 0xFF00FFFF00FFFFFF,
- 0xFF00FFFFFF000000, 0xFF00FFFFFF0000FF,
- 0xFF00FFFFFF00FF00, 0xFF00FFFFFF00FFFF,
- 0xFF00FFFFFFFF0000, 0xFF00FFFFFFFF00FF,
- 0xFF00FFFFFFFFFF00, 0xFF00FFFFFFFFFFFF,
- 0xFFFF000000000000, 0xFFFF0000000000FF,
- 0xFFFF00000000FF00, 0xFFFF00000000FFFF,
- 0xFFFF000000FF0000, 0xFFFF000000FF00FF,
- 0xFFFF000000FFFF00, 0xFFFF000000FFFFFF,
- 0xFFFF0000FF000000, 0xFFFF0000FF0000FF,
- 0xFFFF0000FF00FF00, 0xFFFF0000FF00FFFF,
- 0xFFFF0000FFFF0000, 0xFFFF0000FFFF00FF,
- 0xFFFF0000FFFFFF00, 0xFFFF0000FFFFFFFF,
- 0xFFFF00FF00000000, 0xFFFF00FF000000FF,
- 0xFFFF00FF0000FF00, 0xFFFF00FF0000FFFF,
- 0xFFFF00FF00FF0000, 0xFFFF00FF00FF00FF,
- 0xFFFF00FF00FFFF00, 0xFFFF00FF00FFFFFF,
- 0xFFFF00FFFF000000, 0xFFFF00FFFF0000FF,
- 0xFFFF00FFFF00FF00, 0xFFFF00FFFF00FFFF,
- 0xFFFF00FFFFFF0000, 0xFFFF00FFFFFF00FF,
- 0xFFFF00FFFFFFFF00, 0xFFFF00FFFFFFFFFF,
- 0xFFFFFF0000000000, 0xFFFFFF00000000FF,
- 0xFFFFFF000000FF00, 0xFFFFFF000000FFFF,
- 0xFFFFFF0000FF0000, 0xFFFFFF0000FF00FF,
- 0xFFFFFF0000FFFF00, 0xFFFFFF0000FFFFFF,
- 0xFFFFFF00FF000000, 0xFFFFFF00FF0000FF,
- 0xFFFFFF00FF00FF00, 0xFFFFFF00FF00FFFF,
- 0xFFFFFF00FFFF0000, 0xFFFFFF00FFFF00FF,
- 0xFFFFFF00FFFFFF00, 0xFFFFFF00FFFFFFFF,
- 0xFFFFFFFF00000000, 0xFFFFFFFF000000FF,
- 0xFFFFFFFF0000FF00, 0xFFFFFFFF0000FFFF,
- 0xFFFFFFFF00FF0000, 0xFFFFFFFF00FF00FF,
- 0xFFFFFFFF00FFFF00, 0xFFFFFFFF00FFFFFF,
- 0xFFFFFFFFFF000000, 0xFFFFFFFFFF0000FF,
- 0xFFFFFFFFFF00FF00, 0xFFFFFFFFFF00FFFF,
- 0xFFFFFFFFFFFF0000, 0xFFFFFFFFFFFF00FF,
- 0xFFFFFFFFFFFFFF00, 0xFFFFFFFFFFFFFFFF,
-#endif /* PGSZ */
-};
-#endif /* PSZ == 8 */
-
-#if PSZ == 16
-PixelGroup QuartetPixelMaskTable[] = {
-#if PGSZ == 32
- 0x00000000,
- 0x0000FFFF,
- 0xFFFF0000,
- 0xFFFFFFFF,
-#else /* PGSZ == 64 */
- 0x0000000000000000, 0x000000000000FFFF,
- 0x00000000FFFF0000, 0x00000000FFFFFFFF,
- 0x0000FFFF00000000, 0x0000FFFF0000FFFF,
- 0x0000FFFFFFFF0000, 0x0000FFFFFFFFFFFF,
- 0xFFFF000000000000, 0xFFFF00000000FFFF,
- 0xFFFF0000FFFF0000, 0xFFFF0000FFFFFFFF,
- 0xFFFFFFFF00000000, 0xFFFFFFFF0000FFFF,
- 0xFFFFFFFFFFFF0000, 0xFFFFFFFFFFFFFFFF,
-#endif /* PGSZ */
-};
-#endif /* PSZ == 16 */
-
-#if PSZ == 24
-PixelGroup QuartetPixelMaskTable[] = {
-#if PGSZ == 32
-/* Four pixels consist three pixel groups....*/
- 0x00000000, 0x00FFFFFF, /*0x00000000, *//*0*/
-/* 0x00000000, 0x00000000, 0x00000000,*/ /*0*/
-/* 0x00FFFFFF, 0x00000000, 0x00000000,*/ /*1*/
-/* 0xFF000000, 0x0000FFFF, 0x00000000,*/ /*2*/
-/* 0xFFFFFFFF, 0x0000FFFF, 0x00000000,*/ /*3*/
-/* 0x00000000, 0xFFFF0000, 0x000000FF,*/ /*4*/
-/* 0x00FFFFFF, 0xFFFF0000, 0x000000FF,*/ /*5*/
-/* 0xFF000000, 0xFFFFFFFF, 0x000000FF,*/ /*6*/
-/* 0xFFFFFFFF, 0xFFFFFFFF, 0x000000FF,*/ /*7*/
-/* 0x00000000, 0x00000000, 0xFFFFFF00,*/ /*8*/
-/* 0x00FFFFFF, 0x00000000, 0xFFFFFF00,*/ /*9*/
-/* 0xFF000000, 0x0000FFFF, 0xFFFFFF00,*/ /*10*/
-/* 0xFFFFFFFF, 0x0000FFFF, 0xFFFFFF00,*/ /*11*/
-/* 0x00000000, 0xFFFF0000, 0xFFFFFFFF,*/ /*12*/
-/* 0x00FFFFFF, 0xFFFF0000, 0xFFFFFFFF,*/ /*13*/
-/* 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF,*/ /*14*/
-/* 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,*/ /*15*/
-#else /* PGSZ == 64 */
- 0x0000000000000000, 0x0000000000FFFFFF,
- 0x0000FFFFFF000000, 0xFFFFFFFFFFFFFFFF
-#endif /* PGSZ */
-};
-#endif /* PSZ == 24 */
-
-#if PSZ == 32
-PixelGroup QuartetPixelMaskTable[] = {
-#if PGSZ == 32
- 0x00000000,
- 0xFFFFFFFF,
-#else /* PGSZ == 64 */
- 0x0000000000000000,
- 0x00000000FFFFFFFF,
- 0xFFFFFFFF00000000,
- 0xFFFFFFFFFFFFFFFF
-#endif /* PGSZ */
-};
-#endif /* PSZ == 32 */
-
-#if PSZ == 24
-int cfb24Shift[] =
-#if (BITMAP_BIT_ORDER == MSBFirst)
-{8,0,16,16,8,24,0,0};
-#else /* (BITMAP_BIT_ORDER == LSBFirst) */
-{0,0,24,8,16,16,8,0};
-#endif /* (BITMAP_BIT_ORDER == MSBFirst) */
-#endif
diff --git a/cfb/cfbmskbits.h b/cfb/cfbmskbits.h
deleted file mode 100644
index 5ee9125dd..000000000
--- a/cfb/cfbmskbits.h
+++ /dev/null
@@ -1,854 +0,0 @@
-/************************************************************
-Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this
-software and its documentation for any purpose and without
-fee is hereby granted, provided that the above copyright no-
-tice appear in all copies and that both that copyright no-
-tice and this permission notice appear in supporting docu-
-mentation, and that the names of Sun or The Open Group
-not be used in advertising or publicity pertaining to
-distribution of the software without specific prior
-written permission. Sun and The Open Group make no
-representations about the suitability of this software for
-any purpose. It is provided "as is" without any express or
-implied warranty.
-
-SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
-NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
-ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
-PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
-OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
-THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-********************************************************/
-
-/* Optimizations for PSZ == 32 added by Kyle Marvin (marvin@vitec.com) */
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include "servermd.h"
-#include "compiler.h"
-
-/*
- * ==========================================================================
- * Converted from mfb to support memory-mapped color framebuffer by smarks@sun,
- * April-May 1987.
- *
- * The way I did the conversion was to consider each longword as an
- * array of four bytes instead of an array of 32 one-bit pixels. So
- * getbits() and putbits() retain much the same calling sequence, but
- * they move bytes around instead of bits. Of course, this entails the
- * removal of all of the one-bit-pixel dependencies from the other
- * files, but the major bit-hacking stuff should be covered here.
- *
- * I've created some new macros that make it easier to understand what's
- * going on in the pixel calculations, and that make it easier to change the
- * pixel size.
- *
- * name explanation
- * ---- -----------
- * PSZ pixel size (in bits)
- * PGSZ pixel group size (in bits)
- * PGSZB pixel group size (in bytes)
- * PGSZBMSK mask with lowest PGSZB bits set to 1
- * PPW pixels per word (pixels per pixel group)
- * PPWMSK mask with lowest PPW bits set to 1
- * PLST index of last pixel in a word (should be PPW-1)
- * PIM pixel index mask (index within a pixel group)
- * PWSH pixel-to-word shift (should be log2(PPW))
- * PMSK mask with lowest PSZ bits set to 1
- *
- *
- * Here are some sample values. In the notation cfbA,B: A is PSZ, and
- * B is PGSZB. All the other values are derived from these
- * two. This table does not show all combinations!
- *
- * name cfb8,4 cfb24,4 cfb32,4 cfb8,8 cfb24,8 cfb32,8
- * ---- ------ ------- ------ ------ ------ -------
- * PSZ 8 24 32 8 24 32
- * PGSZ 32 32 32 64 64 64
- * PGSZB 4 4 4 8 8 8
- * PGSZBMSK 0xF 0xF? 0xF 0xFF 0xFF 0xFF
- * PPW 4 1 1 8 2 2
- * PPWMSK 0xF 0x1 0x1 0xFF 0x3? 0x3
- * PLST 3 0 0 7 1 1
- * PIM 0x3 0x0 0x0 0x7 0x1? 0x1
- * PWSH 2 0 0 3 1 1
- * PMSK 0xFF 0xFFFFFF 0xFFFFFFFF 0xFF 0xFFFFFF 0xFFFFFFFF
- *
- *
- * I have also added a new macro, PFILL, that takes one pixel and
- * replicates it throughout a word. This macro definition is dependent
- * upon pixel and word size; it doesn't use macros like PPW and so
- * forth. Examples: for monochrome, PFILL(1) => 0xffffffff, PFILL(0) =>
- * 0x00000000. For 8-bit color, PFILL(0x5d) => 0x5d5d5d5d. This macro
- * is used primarily for replicating a plane mask into a word.
- *
- * Color framebuffers operations also support the notion of a plane
- * mask. This mask determines which planes of the framebuffer can be
- * altered; the others are left unchanged. I have added another
- * parameter to the putbits and putbitsrop macros that is the plane
- * mask.
- * ==========================================================================
- *
- * Keith Packard (keithp@suse.com)
- * 64bit code is no longer supported; it requires DIX support
- * for repadding images which significantly impacts performance
- */
-
-/*
- * PSZ needs to be defined before we get here. Usually it comes from a
- * -DPSZ=foo on the compilation command line.
- */
-
-#ifndef PSZ
-#define PSZ 8
-#endif
-
-/*
- * PixelGroup is the data type used to operate on groups of pixels.
- * We typedef it here to CARD32 with the assumption that you
- * want to manipulate 32 bits worth of pixels at a time as you can. If CARD32
- * is not appropriate for your server, define it to something else
- * before including this file. In this case you will also have to define
- * PGSZB to the size in bytes of PixelGroup.
- */
-#ifndef PixelGroup
-#define PixelGroup CARD32
-#define PGSZB 4
-#endif /* PixelGroup */
-
-#ifndef CfbBits
-#define CfbBits CARD32
-#endif
-
-#define PGSZ (PGSZB << 3)
-#define PPW (PGSZ/PSZ)
-#define PLST (PPW-1)
-#define PIM PLST
-#define PMSK (((PixelGroup)1 << PSZ) - 1)
-#define PPWMSK (((PixelGroup)1 << PPW) - 1) /* instead of BITMSK */
-#define PGSZBMSK (((PixelGroup)1 << PGSZB) - 1)
-
-/* set PWSH = log2(PPW) using brute force */
-
-#if PPW == 1
-#define PWSH 0
-#else
-#if PPW == 2
-#define PWSH 1
-#else
-#if PPW == 4
-#define PWSH 2
-#else
-#if PPW == 8
-#define PWSH 3
-#else
-#if PPW == 16
-#define PWSH 4
-#endif /* PPW == 16 */
-#endif /* PPW == 8 */
-#endif /* PPW == 4 */
-#endif /* PPW == 2 */
-#endif /* PPW == 1 */
-
-/* Defining PIXEL_ADDR means that individual pixels are addressable by this
- * machine (as type PixelType). A possible CFB architecture which supported
- * 8-bits-per-pixel on a non byte-addressable machine would not have this
- * defined.
- *
- * Defining FOUR_BIT_CODE means that cfb knows how to stipple on this machine;
- * eventually, stippling code for 16 and 32 bit devices should be written
- * which would allow them to also use FOUR_BIT_CODE. There isn't that
- * much to do in those cases, but it would make them quite a bit faster.
- */
-
-#if PSZ == 8
-#define PIXEL_ADDR
-typedef CARD8 PixelType;
-#define FOUR_BIT_CODE
-#endif
-
-#if PSZ == 16
-#define PIXEL_ADDR
-typedef CARD16 PixelType;
-#endif
-
-#if PSZ == 24
-#undef PMSK
-#define PMSK 0xFFFFFF
-/*#undef PIM
-#define PIM 3*/
-#define PIXEL_ADDR
-typedef CARD32 PixelType;
-#endif
-
-#if PSZ == 32
-#undef PMSK
-#define PMSK 0xFFFFFFFF
-#define PIXEL_ADDR
-typedef CARD32 PixelType;
-#endif
-
-
-/* the following notes use the following conventions:
-SCREEN LEFT SCREEN RIGHT
-in this file and maskbits.c, left and right refer to screen coordinates,
-NOT bit numbering in registers.
-
-cfbstarttab[n]
- pixels[0,n-1] = 0's pixels[n,PPW-1] = 1's
-cfbendtab[n] =
- pixels[0,n-1] = 1's pixels[n,PPW-1] = 0's
-
-cfbstartpartial[], cfbendpartial[]
- these are used as accelerators for doing putbits and masking out
-bits that are all contained between longword boudaries. the extra
-256 bytes of data seems a small price to pay -- code is smaller,
-and narrow things (e.g. window borders) go faster.
-
-the names may seem misleading; they are derived not from which end
-of the word the bits are turned on, but at which end of a scanline
-the table tends to be used.
-
-look at the tables and macros to understand boundary conditions.
-(careful readers will note that starttab[n] = ~endtab[n] for n != 0)
-
------------------------------------------------------------------------
-these two macros depend on the screen's bit ordering.
-in both of them x is a screen position. they are used to
-combine bits collected from multiple longwords into a
-single destination longword, and to unpack a single
-source longword into multiple destinations.
-
-SCRLEFT(dst, x)
- takes dst[x, PPW] and moves them to dst[0, PPW-x]
- the contents of the rest of dst are 0 ONLY IF
- dst is UNSIGNED.
- is cast as an unsigned.
- this is a right shift on the VAX, left shift on
- Sun and pc-rt.
-
-SCRRIGHT(dst, x)
- takes dst[0,x] and moves them to dst[PPW-x, PPW]
- the contents of the rest of dst are 0 ONLY IF
- dst is UNSIGNED.
- this is a left shift on the VAX, right shift on
- Sun and pc-rt.
-
-
-the remaining macros are cpu-independent; all bit order dependencies
-are built into the tables and the two macros above.
-
-maskbits(x, w, startmask, endmask, nlw)
- for a span of width w starting at position x, returns
-a mask for ragged pixels at start, mask for ragged pixels at end,
-and the number of whole longwords between the ends.
-
-maskpartialbits(x, w, mask)
- works like maskbits(), except all the pixels are in the
- same longword (i.e. (x&0xPIM + w) <= PPW)
-
-mask32bits(x, w, startmask, endmask, nlw)
- as maskbits, but does not calculate nlw. it is used by
- cfbGlyphBlt to put down glyphs <= PPW bits wide.
-
-getbits(psrc, x, w, dst)
- starting at position x in psrc (x < PPW), collect w
- pixels and put them in the screen left portion of dst.
- psrc is a longword pointer. this may span longword boundaries.
- it special-cases fetching all w bits from one longword.
-
- +--------+--------+ +--------+
- | | m |n| | ==> | m |n| |
- +--------+--------+ +--------+
- x x+w 0 w
- psrc psrc+1 dst
- m = PPW - x
- n = w - m
-
- implementation:
- get m pixels, move to screen-left of dst, zeroing rest of dst;
- get n pixels from next word, move screen-right by m, zeroing
- lower m pixels of word.
- OR the two things together.
-
-putbits(src, x, w, pdst, planemask)
- starting at position x in pdst, put down the screen-leftmost
- w bits of src. pdst is a longword pointer. this may
- span longword boundaries.
- it special-cases putting all w bits into the same longword.
-
- +--------+ +--------+--------+
- | m |n| | ==> | | m |n| |
- +--------+ +--------+--------+
- 0 w x x+w
- dst pdst pdst+1
- m = PPW - x
- n = w - m
-
- implementation:
- get m pixels, shift screen-right by x, zero screen-leftmost x
- pixels; zero rightmost m bits of *pdst and OR in stuff
- from before the semicolon.
- shift src screen-left by m, zero bits n-32;
- zero leftmost n pixels of *(pdst+1) and OR in the
- stuff from before the semicolon.
-
-putbitsrop(src, x, w, pdst, planemask, ROP)
- like putbits but calls DoRop with the rasterop ROP (see cfb.h for
- DoRop)
-
-getleftbits(psrc, w, dst)
- get the leftmost w (w<=PPW) bits from *psrc and put them
- in dst. this is used by the cfbGlyphBlt code for glyphs
- <=PPW bits wide.
-*/
-
-#if (BITMAP_BIT_ORDER == MSBFirst)
-#define BitRight(lw,n) ((lw) >> (n))
-#define BitLeft(lw,n) ((lw) << (n))
-#else /* (BITMAP_BIT_ORDER == LSBFirst) */
-#define BitRight(lw,n) ((lw) << (n))
-#define BitLeft(lw,n) ((lw) >> (n))
-#endif /* (BITMAP_BIT_ORDER == MSBFirst) */
-
-#define SCRLEFT(lw, n) BitLeft (lw, (n) * PSZ)
-#define SCRRIGHT(lw, n) BitRight(lw, (n) * PSZ)
-
-/*
- * Note that the shift direction is independent of the byte ordering of the
- * machine. The following is portable code.
- */
-#if PPW == 16
-#define PFILL(p) ( ((p)&PMSK) | \
- ((p)&PMSK) << PSZ | \
- ((p)&PMSK) << 2*PSZ | \
- ((p)&PMSK) << 3*PSZ | \
- ((p)&PMSK) << 4*PSZ | \
- ((p)&PMSK) << 5*PSZ | \
- ((p)&PMSK) << 6*PSZ | \
- ((p)&PMSK) << 7*PSZ | \
- ((p)&PMSK) << 8*PSZ | \
- ((p)&PMSK) << 9*PSZ | \
- ((p)&PMSK) << 10*PSZ | \
- ((p)&PMSK) << 11*PSZ | \
- ((p)&PMSK) << 12*PSZ | \
- ((p)&PMSK) << 13*PSZ | \
- ((p)&PMSK) << 14*PSZ | \
- ((p)&PMSK) << 15*PSZ )
-#define PFILL2(p, pf) { \
- pf = (p) & PMSK; \
- pf |= (pf << PSZ); \
- pf |= (pf << 2*PSZ); \
- pf |= (pf << 4*PSZ); \
- pf |= (pf << 8*PSZ); \
-}
-#endif /* PPW == 16 */
-#if PPW == 8
-#define PFILL(p) ( ((p)&PMSK) | \
- ((p)&PMSK) << PSZ | \
- ((p)&PMSK) << 2*PSZ | \
- ((p)&PMSK) << 3*PSZ | \
- ((p)&PMSK) << 4*PSZ | \
- ((p)&PMSK) << 5*PSZ | \
- ((p)&PMSK) << 6*PSZ | \
- ((p)&PMSK) << 7*PSZ )
-#define PFILL2(p, pf) { \
- pf = (p) & PMSK; \
- pf |= (pf << PSZ); \
- pf |= (pf << 2*PSZ); \
- pf |= (pf << 4*PSZ); \
-}
-#endif
-#if PPW == 4
-#define PFILL(p) ( ((p)&PMSK) | \
- ((p)&PMSK) << PSZ | \
- ((p)&PMSK) << 2*PSZ | \
- ((p)&PMSK) << 3*PSZ )
-#define PFILL2(p, pf) { \
- pf = (p) & PMSK; \
- pf |= (pf << PSZ); \
- pf |= (pf << 2*PSZ); \
-}
-#endif
-#if PPW == 2
-#define PFILL(p) ( ((p)&PMSK) | \
- ((p)&PMSK) << PSZ )
-#define PFILL2(p, pf) { \
- pf = (p) & PMSK; \
- pf |= (pf << PSZ); \
-}
-#endif
-#if PPW == 1
-#define PFILL(p) (p)
-#define PFILL2(p,pf) (pf = (p))
-#endif
-
-/*
- * Reduced raster op - using precomputed values, perform the above
- * in three instructions
- */
-
-#define DoRRop(dst, and, xor) (((dst) & (and)) ^ (xor))
-
-#define DoMaskRRop(dst, and, xor, mask) \
- (((dst) & ((and) | ~(mask))) ^ (xor & mask))
-
-#if PSZ != 32 || PPW != 1
-
-# if (PSZ == 24 && PPW == 1)
-#define maskbits(x, w, startmask, endmask, nlw) {\
- startmask = cfbstarttab[(x)&3]; \
- endmask = cfbendtab[((x)+(w)) & 3]; \
- nlw = ((((x)+(w))*3)>>2) - (((x)*3 +3)>>2); \
-}
-
-#define mask32bits(x, w, startmask, endmask) \
- startmask = cfbstarttab[(x)&3]; \
- endmask = cfbendtab[((x)+(w)) & 3];
-
-#define maskpartialbits(x, w, mask) \
- mask = cfbstartpartial[(x) & 3] & cfbendpartial[((x)+(w)) & 3];
-
-#define maskbits24(x, w, startmask, endmask, nlw) \
- startmask = cfbstarttab24[(x) & 3]; \
- endmask = cfbendtab24[((x)+(w)) & 3]; \
- if (startmask){ \
- nlw = (((w) - (4 - ((x) & 3))) >> 2); \
- } else { \
- nlw = (w) >> 2; \
- }
-
-#define getbits24(psrc, dst, index) {\
- register int idx; \
- switch(idx = ((index)&3)<<1){ \
- case 0: \
- dst = (*(psrc) &cfbmask[idx]); \
- break; \
- case 6: \
- dst = BitLeft((*(psrc) &cfbmask[idx]), cfb24Shift[idx]); \
- break; \
- default: \
- dst = BitLeft((*(psrc) &cfbmask[idx]), cfb24Shift[idx]) | \
- BitRight(((*((psrc)+1)) &cfbmask[idx+1]), cfb24Shift[idx+1]); \
- }; \
-}
-
-#define putbits24(src, w, pdst, planemask, index) {\
- register PixelGroup dstpixel; \
- register unsigned int idx; \
- switch(idx = ((index)&3)<<1){ \
- case 0: \
- dstpixel = (*(pdst) &cfbmask[idx]); \
- break; \
- case 6: \
- dstpixel = BitLeft((*(pdst) &cfbmask[idx]), cfb24Shift[idx]); \
- break; \
- default: \
- dstpixel = BitLeft((*(pdst) &cfbmask[idx]), cfb24Shift[idx])| \
- BitRight(((*((pdst)+1)) &cfbmask[idx+1]), cfb24Shift[idx+1]); \
- }; \
- dstpixel &= ~(planemask); \
- dstpixel |= (src & planemask); \
- *(pdst) &= cfbrmask[idx]; \
- switch(idx){ \
- case 0: \
- *(pdst) |= (dstpixel & cfbmask[idx]); \
- break; \
- case 2: \
- case 4: \
- pdst++;idx++; \
- *(pdst) = ((*(pdst)) & cfbrmask[idx]) | \
- (BitLeft(dstpixel, cfb24Shift[idx]) & cfbmask[idx]); \
- pdst--;idx--; \
- case 6: \
- *(pdst) |= (BitRight(dstpixel, cfb24Shift[idx]) & cfbmask[idx]); \
- break; \
- }; \
-}
-
-#define putbitsrop24(src, x, pdst, planemask, rop) \
-{ \
- register PixelGroup t1, dstpixel; \
- register unsigned int idx; \
- switch(idx = (x)<<1){ \
- case 0: \
- dstpixel = (*(pdst) &cfbmask[idx]); \
- break; \
- case 6: \
- dstpixel = BitLeft((*(pdst) &cfbmask[idx]), cfb24Shift[idx]); \
- break; \
- default: \
- dstpixel = BitLeft((*(pdst) &cfbmask[idx]), cfb24Shift[idx])| \
- BitRight(((*((pdst)+1)) &cfbmask[idx+1]), cfb24Shift[idx+1]); \
- }; \
- DoRop(t1, rop, (src), dstpixel); \
- dstpixel &= ~planemask; \
- dstpixel |= (t1 & planemask); \
- *(pdst) &= cfbrmask[idx]; \
- switch(idx){ \
- case 0: \
- *(pdst) |= (dstpixel & cfbmask[idx]); \
- break; \
- case 2: \
- case 4: \
- *((pdst)+1) = ((*((pdst)+1)) & cfbrmask[idx+1]) | \
- (BitLeft(dstpixel, cfb24Shift[idx+1]) & (cfbmask[idx+1])); \
- case 6: \
- *(pdst) |= (BitRight(dstpixel, cfb24Shift[idx]) & cfbmask[idx]); \
- }; \
-}
-# else /* PSZ == 24 && PPW == 1 */
-#define maskbits(x, w, startmask, endmask, nlw) \
- startmask = cfbstarttab[(x)&PIM]; \
- endmask = cfbendtab[((x)+(w)) & PIM]; \
- if (startmask) \
- nlw = (((w) - (PPW - ((x)&PIM))) >> PWSH); \
- else \
- nlw = (w) >> PWSH;
-
-#define maskpartialbits(x, w, mask) \
- mask = cfbstartpartial[(x) & PIM] & cfbendpartial[((x) + (w)) & PIM];
-
-#define mask32bits(x, w, startmask, endmask) \
- startmask = cfbstarttab[(x)&PIM]; \
- endmask = cfbendtab[((x)+(w)) & PIM];
-
-/* FIXME */
-#define maskbits24(x, w, startmask, endmask, nlw) \
- abort()
-#define getbits24(psrc, dst, index) \
- abort()
-#define putbits24(src, w, pdst, planemask, index) \
- abort()
-#define putbitsrop24(src, x, pdst, planemask, rop) \
- abort()
-
-#endif /* PSZ == 24 && PPW == 1 */
-
-#define getbits(psrc, x, w, dst) \
-if ( ((x) + (w)) <= PPW) \
-{ \
- dst = SCRLEFT(*(psrc), (x)); \
-} \
-else \
-{ \
- int m; \
- m = PPW-(x); \
- dst = (SCRLEFT(*(psrc), (x)) & cfbendtab[m]) | \
- (SCRRIGHT(*((psrc)+1), m) & cfbstarttab[m]); \
-}
-
-
-#define putbits(src, x, w, pdst, planemask) \
-if ( ((x)+(w)) <= PPW) \
-{ \
- PixelGroup tmpmask; \
- maskpartialbits((x), (w), tmpmask); \
- tmpmask &= PFILL(planemask); \
- *(pdst) = (*(pdst) & ~tmpmask) | (SCRRIGHT(src, x) & tmpmask); \
-} \
-else \
-{ \
- unsigned int m; \
- unsigned int n; \
- PixelGroup pm = PFILL(planemask); \
- m = PPW-(x); \
- n = (w) - m; \
- *(pdst) = (*(pdst) & (cfbendtab[x] | ~pm)) | \
- (SCRRIGHT(src, x) & (cfbstarttab[x] & pm)); \
- *((pdst)+1) = (*((pdst)+1) & (cfbstarttab[n] | ~pm)) | \
- (SCRLEFT(src, m) & (cfbendtab[n] & pm)); \
-}
-#if defined(__GNUC__) && defined(mc68020)
-#undef getbits
-#define FASTGETBITS(psrc, x, w, dst) \
- asm ("bfextu %3{%1:%2},%0" \
- : "=d" (dst) : "di" (x), "di" (w), "o" (*(char *)(psrc)))
-
-#define getbits(psrc,x,w,dst) \
-{ \
- FASTGETBITS(psrc, (x) * PSZ, (w) * PSZ, dst); \
- dst = SCRLEFT(dst,PPW-(w)); \
-}
-
-#define FASTPUTBITS(src, x, w, pdst) \
- asm ("bfins %3,%0{%1:%2}" \
- : "=o" (*(char *)(pdst)) \
- : "di" (x), "di" (w), "d" (src), "0" (*(char *) (pdst)))
-
-#undef putbits
-#define putbits(src, x, w, pdst, planemask) \
-{ \
- if (planemask != PMSK) { \
- PixelGroup _m, _pm; \
- FASTGETBITS(pdst, (x) * PSZ , (w) * PSZ, _m); \
- PFILL2(planemask, _pm); \
- _m &= (~_pm); \
- _m |= (SCRRIGHT(src, PPW-(w)) & _pm); \
- FASTPUTBITS(_m, (x) * PSZ, (w) * PSZ, pdst); \
- } else { \
- FASTPUTBITS(SCRRIGHT(src, PPW-(w)), (x) * PSZ, (w) * PSZ, pdst); \
- } \
-}
-
-
-#endif /* mc68020 */
-
-#define putbitsrop(src, x, w, pdst, planemask, rop) \
-if ( ((x)+(w)) <= PPW) \
-{ \
- PixelGroup tmpmask; \
- PixelGroup t1, t2; \
- maskpartialbits((x), (w), tmpmask); \
- PFILL2(planemask, t1); \
- tmpmask &= t1; \
- t1 = SCRRIGHT((src), (x)); \
- DoRop(t2, rop, t1, *(pdst)); \
- *(pdst) = (*(pdst) & ~tmpmask) | (t2 & tmpmask); \
-} \
-else \
-{ \
- CfbBits m; \
- CfbBits n; \
- PixelGroup t1, t2; \
- PixelGroup pm; \
- PFILL2(planemask, pm); \
- m = PPW-(x); \
- n = (w) - m; \
- t1 = SCRRIGHT((src), (x)); \
- DoRop(t2, rop, t1, *(pdst)); \
- *(pdst) = (*(pdst) & (cfbendtab[x] | ~pm)) | (t2 & (cfbstarttab[x] & pm));\
- t1 = SCRLEFT((src), m); \
- DoRop(t2, rop, t1, *((pdst) + 1)); \
- *((pdst)+1) = (*((pdst)+1) & (cfbstarttab[n] | ~pm)) | \
- (t2 & (cfbendtab[n] & pm)); \
-}
-
-#else /* PSZ == 32 && PPW == 1*/
-
-/*
- * These macros can be optimized for 32-bit pixels since there is no
- * need to worry about left/right edge masking. These macros were
- * derived from the above using the following reductions:
- *
- * - x & PIW = 0 [since PIW = 0]
- * - all masking tables are only indexed by 0 [ due to above ]
- * - cfbstartab[0] and cfbendtab[0] = 0 [ no left/right edge masks]
- * - cfbstartpartial[0] and cfbendpartial[0] = ~0 [no partial pixel mask]
- *
- * Macro reduction based upon constants cannot be performed automatically
- * by the compiler since it does not know the contents of the masking
- * arrays in cfbmskbits.c.
- */
-#define maskbits(x, w, startmask, endmask, nlw) \
- startmask = endmask = 0; \
- nlw = (w);
-
-#define maskpartialbits(x, w, mask) \
- mask = 0xFFFFFFFF;
-
-#define mask32bits(x, w, startmask, endmask) \
- startmask = endmask = 0;
-
-/*
- * For 32-bit operations, getbits(), putbits(), and putbitsrop()
- * will only be invoked with x = 0 and w = PPW (1). The getbits()
- * macro is only called within left/right edge logic, which doesn't
- * happen for 32-bit pixels.
- */
-#define getbits(psrc, x, w, dst) (dst) = *(psrc)
-
-#define putbits(src, x, w, pdst, planemask) \
- *(pdst) = (*(pdst) & ~planemask) | (src & planemask);
-
-#define putbitsrop(src, x, w, pdst, planemask, rop) \
-{ \
- PixelGroup t1; \
- DoRop(t1, rop, (src), *(pdst)); \
- *(pdst) = (*(pdst) & ~planemask) | (t1 & planemask); \
-}
-
-#endif /* PSZ != 32 */
-
-/*
- * Use these macros only when you're using the MergeRop stuff
- * in ../mfb/mergerop.h
- */
-
-/* useful only when not spanning destination longwords */
-#if PSZ == 24
-#define putbitsmropshort24(src,x,w,pdst,index) {\
- PixelGroup _tmpmask; \
- PixelGroup _t1; \
- maskpartialbits ((x), (w), _tmpmask); \
- _t1 = SCRRIGHT((src), (x)); \
- DoMaskMergeRop24(_t1, pdst, _tmpmask, index); \
-}
-#endif
-#define putbitsmropshort(src,x,w,pdst) {\
- PixelGroup _tmpmask; \
- PixelGroup _t1; \
- maskpartialbits ((x), (w), _tmpmask); \
- _t1 = SCRRIGHT((src), (x)); \
- *pdst = DoMaskMergeRop(_t1, *pdst, _tmpmask); \
-}
-
-/* useful only when spanning destination longwords */
-#define putbitsmroplong(src,x,w,pdst) { \
- PixelGroup _startmask, _endmask; \
- int _m; \
- PixelGroup _t1; \
- _m = PPW - (x); \
- _startmask = cfbstarttab[x]; \
- _endmask = cfbendtab[(w) - _m]; \
- _t1 = SCRRIGHT((src), (x)); \
- pdst[0] = DoMaskMergeRop(_t1,pdst[0],_startmask); \
- _t1 = SCRLEFT ((src),_m); \
- pdst[1] = DoMaskMergeRop(_t1,pdst[1],_endmask); \
-}
-
-#define putbitsmrop(src,x,w,pdst) \
-if ((x) + (w) <= PPW) {\
- putbitsmropshort(src,x,w,pdst); \
-} else { \
- putbitsmroplong(src,x,w,pdst); \
-}
-
-#if GETLEFTBITS_ALIGNMENT == 1
-#define getleftbits(psrc, w, dst) dst = *((unsigned int *) psrc)
-#define getleftbits24(psrc, w, dst, idx){ \
- regiseter int index; \
- switch(index = ((idx)&3)<<1){ \
- case 0: \
- dst = (*((unsigned int *) psrc))&cfbmask[index]; \
- break; \
- case 2: \
- case 4: \
- dst = BitLeft(((*((unsigned int *) psrc))&cfbmask[index]), cfb24Shift[index]); \
- dst |= BitRight(((*((unsigned int *) psrc)+1)&cfbmask[index]), cfb4Shift[index]); \
- break; \
- case 6: \
- dst = BitLeft((*((unsigned int *) psrc)),cfb24Shift[index]); \
- break; \
- }; \
-}
-#endif /* GETLEFTBITS_ALIGNMENT == 1 */
-
-#define getglyphbits(psrc, x, w, dst) \
-{ \
- dst = BitLeft((unsigned) *(psrc), (x)); \
- if ( ((x) + (w)) > 32) \
- dst |= (BitRight((unsigned) *((psrc)+1), 32-(x))); \
-}
-#if GETLEFTBITS_ALIGNMENT == 2
-#define getleftbits(psrc, w, dst) \
- { \
- if ( ((int)(psrc)) & 0x01 ) \
- getglyphbits( ((unsigned int *)(((char *)(psrc))-1)), 8, (w), (dst) ); \
- else \
- dst = *((unsigned int *) psrc); \
- }
-#endif /* GETLEFTBITS_ALIGNMENT == 2 */
-
-#if GETLEFTBITS_ALIGNMENT == 4
-#define getleftbits(psrc, w, dst) \
- { \
- int off, off_b; \
- off_b = (off = ( ((int)(psrc)) & 0x03)) << 3; \
- getglyphbits( \
- (unsigned int *)( ((char *)(psrc)) - off), \
- (off_b), (w), (dst) \
- ); \
- }
-#endif /* GETLEFTBITS_ALIGNMENT == 4 */
-
-/*
- * getstipplepixels( psrcstip, x, w, ones, psrcpix, destpix )
- *
- * Converts bits to pixels in a reasonable way. Takes w (1 <= w <= PPW)
- * bits from *psrcstip, starting at bit x; call this a quartet of bits.
- * Then, takes the pixels from *psrcpix corresponding to the one-bits (if
- * ones is TRUE) or the zero-bits (if ones is FALSE) of the quartet
- * and puts these pixels into destpix.
- *
- * Example:
- *
- * getstipplepixels( &(0x08192A3B), 17, 4, 1, &(0x4C5D6E7F), dest )
- *
- * 0x08192A3B = 0000 1000 0001 1001 0010 1010 0011 1011
- *
- * This will take 4 bits starting at bit 17, so the quartet is 0x5 = 0101.
- * It will take pixels from 0x4C5D6E7F corresponding to the one-bits in this
- * quartet, so dest = 0x005D007F.
- *
- * XXX Works with both byte order.
- * XXX This works for all values of x and w within a doubleword.
- */
-#if (BITMAP_BIT_ORDER == MSBFirst)
-#define getstipplepixels( psrcstip, x, w, ones, psrcpix, destpix ) \
-{ \
- PixelGroup q; \
- int m; \
- if ((m = ((x) - ((PPW*PSZ)-PPW))) > 0) { \
- q = (*(psrcstip)) << m; \
- if ( (x)+(w) > (PPW*PSZ) ) \
- q |= *((psrcstip)+1) >> ((PPW*PSZ)-m); \
- } \
- else \
- q = (*(psrcstip)) >> -m; \
- q = QuartetBitsTable[(w)] & ((ones) ? q : ~q); \
- *(destpix) = (*(psrcpix)) & QuartetPixelMaskTable[q]; \
-}
-/* I just copied this to get the linker satisfied on PowerPC,
- * so this may not be correct at all.
- */
-#define getstipplepixels24(psrcstip,xt,ones,psrcpix,destpix,stipindex) \
-{ \
- PixelGroup q; \
- q = *(psrcstip) >> (xt); \
- q = ((ones) ? q : ~q) & 1; \
- *(destpix) = (*(psrcpix)) & QuartetPixelMaskTable[q]; \
-}
-#else /* BITMAP_BIT_ORDER == LSB */
-
-/* this must load 32 bits worth; for most machines, thats an int */
-#define CfbFetchUnaligned(x) ldl_u(x)
-
-#define getstipplepixels( psrcstip, xt, w, ones, psrcpix, destpix ) \
-{ \
- PixelGroup q; \
- q = CfbFetchUnaligned(psrcstip) >> (xt); \
- if ( ((xt)+(w)) > (PPW*PSZ) ) \
- q |= (CfbFetchUnaligned((psrcstip)+1)) << ((PPW*PSZ)-(xt)); \
- q = QuartetBitsTable[(w)] & ((ones) ? q : ~q); \
- *(destpix) = (*(psrcpix)) & QuartetPixelMaskTable[q]; \
-}
-#if PSZ == 24
-#define getstipplepixels24(psrcstip,xt,ones,psrcpix,destpix,stipindex) \
-{ \
- PixelGroup q; \
- q = *(psrcstip) >> (xt); \
- q = ((ones) ? q : ~q) & 1; \
- *(destpix) = (*(psrcpix)) & QuartetPixelMaskTable[q]; \
-}
-#endif /* PSZ == 24 */
-#endif
-
-extern PixelGroup cfbstarttab[];
-extern PixelGroup cfbendtab[];
-extern PixelGroup cfbstartpartial[];
-extern PixelGroup cfbendpartial[];
-extern PixelGroup cfbrmask[];
-extern PixelGroup cfbmask[];
-extern PixelGroup QuartetBitsTable[];
-extern PixelGroup QuartetPixelMaskTable[];
-#if PSZ == 24
-extern int cfb24Shift[];
-#endif
diff --git a/cfb/cfbpixmap.c b/cfb/cfbpixmap.c
deleted file mode 100644
index 1166f90b7..000000000
--- a/cfb/cfbpixmap.c
+++ /dev/null
@@ -1,375 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 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.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-/* pixmap management
- written by drewry, september 1986
-
- on a monchrome device, a pixmap is a bitmap.
-*/
-
-#include <string.h>
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/Xmd.h>
-#include "servermd.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "mi.h"
-#include "cfb.h"
-#include "cfbmskbits.h"
-
-PixmapPtr
-cfbCreatePixmap (pScreen, width, height, depth, usage_hint)
- ScreenPtr pScreen;
- int width;
- int height;
- int depth;
- unsigned usage_hint;
-{
- PixmapPtr pPixmap;
- size_t datasize;
- size_t paddedWidth;
-
- paddedWidth = PixmapBytePad(width, depth);
-
- if (paddedWidth / 4 > 32767 || height > 32767)
- return NullPixmap;
- datasize = height * paddedWidth;
- pPixmap = AllocatePixmap(pScreen, datasize);
- if (!pPixmap)
- return NullPixmap;
- pPixmap->drawable.type = DRAWABLE_PIXMAP;
- pPixmap->drawable.class = 0;
- pPixmap->drawable.pScreen = pScreen;
- pPixmap->drawable.depth = depth;
- pPixmap->drawable.bitsPerPixel = BitsPerPixel(depth);
- pPixmap->drawable.id = 0;
- pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- pPixmap->drawable.x = 0;
- pPixmap->drawable.y = 0;
- pPixmap->drawable.width = width;
- pPixmap->drawable.height = height;
- pPixmap->devKind = paddedWidth;
- pPixmap->refcnt = 1;
- pPixmap->devPrivate.ptr = datasize ?
- (pointer)((char *)pPixmap + pScreen->totalPixmapSize) : NULL;
- pPixmap->usage_hint = usage_hint;
- return pPixmap;
-}
-
-Bool
-cfbDestroyPixmap(pPixmap)
- PixmapPtr pPixmap;
-{
- if(--pPixmap->refcnt)
- return TRUE;
- dixFreePrivates(pPixmap->devPrivates);
- xfree(pPixmap);
- return TRUE;
-}
-
-PixmapPtr
-cfbCopyPixmap(pSrc)
- register PixmapPtr pSrc;
-{
- register PixmapPtr pDst;
- int size;
- ScreenPtr pScreen;
-
- size = pSrc->drawable.height * pSrc->devKind;
- pScreen = pSrc->drawable.pScreen;
- pDst = (*pScreen->CreatePixmap) (pScreen, pSrc->drawable.width,
- pSrc->drawable.height, pSrc->drawable.depth, 0);
- if (!pDst)
- return NullPixmap;
- memmove((char *)pDst->devPrivate.ptr, (char *)pSrc->devPrivate.ptr, size);
- return pDst;
-}
-
-
-/* replicates a pattern to be a full 32 bits wide.
- relies on the fact that each scnaline is longword padded.
- doesn't do anything if pixmap is not a factor of 32 wide.
- changes width field of pixmap if successful, so that the fast
- cfbXRotatePixmap code gets used if we rotate the pixmap later.
- cfbYRotatePixmap code gets used if we rotate the pixmap later.
-
- calculate number of times to repeat
- for each scanline of pattern
- zero out area to be filled with replicate
- left shift and or in original as many times as needed
-*/
-void
-cfbPadPixmap(pPixmap)
- PixmapPtr pPixmap;
-{
- register int width = (pPixmap->drawable.width) * (pPixmap->drawable.bitsPerPixel);
- register int h;
- register CfbBits mask;
- register CfbBits *p;
- register CfbBits bits; /* real pattern bits */
- register int i;
- int rep; /* repeat count for pattern */
-
- if (width >= PGSZ)
- return;
-
- rep = PGSZ/width;
- if (rep*width != PGSZ)
- return;
-
- mask = mfbGetendtab(width);
-
- p = (CfbBits *)(pPixmap->devPrivate.ptr);
- for (h=0; h < pPixmap->drawable.height; h++)
- {
- *p &= mask;
- bits = *p;
- for(i=1; i<rep; i++)
- {
-#if (BITMAP_BIT_ORDER == MSBFirst)
- bits >>= width;
-#else
- bits <<= width;
-#endif
- *p |= bits;
- }
- p++;
- }
- pPixmap->drawable.width = PGSZ/(pPixmap->drawable.bitsPerPixel);
-}
-
-
-#ifdef notdef
-/*
- * cfb debugging routine -- assumes pixmap is 1 byte deep
- */
-static cfbdumppixmap(pPix)
- PixmapPtr pPix;
-{
- unsigned int *pw;
- char *psrc, *pdst;
- int i, j;
- char line[66];
-
- ErrorF( "pPixmap: 0x%x\n", pPix);
- ErrorF( "%d wide %d high\n", pPix->drawable.width, pPix->drawable.height);
- if (pPix->drawable.width > 64)
- {
- ErrorF( "too wide to see\n");
- return;
- }
-
- pw = (unsigned int *) pPix->devPrivate.ptr;
- psrc = (char *) pw;
-
-/*
- for ( i=0; i<pPix->drawable.height; ++i )
- ErrorF( "0x%x\n", pw[i] );
-*/
-
- for ( i = 0; i < pPix->drawable.height; ++i ) {
- pdst = line;
- for(j = 0; j < pPix->drawable.width; j++) {
- *pdst++ = *psrc++ ? 'X' : ' ' ;
- }
- *pdst++ = '\n';
- *pdst++ = '\0';
- ErrorF( "%s", line);
- }
-}
-#endif /* notdef */
-
-/* Rotates pixmap pPix by w pixels to the right on the screen. Assumes that
- * words are PGSZ bits wide, and that the least significant bit appears on the
- * left.
- */
-void
-cfbXRotatePixmap(pPix, rw)
- PixmapPtr pPix;
- register int rw;
-{
- register CfbBits *pw, *pwFinal;
- register CfbBits t;
- int rot;
-
- if (pPix == NullPixmap)
- return;
-
- switch (((DrawablePtr) pPix)->bitsPerPixel) {
- case PSZ:
- break;
- case 1:
- mfbXRotatePixmap(pPix, rw);
- return;
- default:
- ErrorF("cfbXRotatePixmap: unsupported bitsPerPixel %d\n", ((DrawablePtr) pPix)->bitsPerPixel);
- return;
- }
- pw = (CfbBits *)pPix->devPrivate.ptr;
- modulus (rw, (int) pPix->drawable.width, rot);
- if(pPix->drawable.width == PPW)
- {
- pwFinal = pw + pPix->drawable.height;
- while(pw < pwFinal)
- {
- t = *pw;
- *pw++ = SCRRIGHT(t, rot) |
- (SCRLEFT(t, (PPW-rot)) & cfbendtab[rot]);
- }
- }
- else
- {
- ErrorF("cfb internal error: trying to rotate odd-sized pixmap.\n");
-#ifdef notdef
- register CfbBits *pwTmp;
- int size, tsize;
-
- tsize = PixmapBytePad(pPix->drawable.width - rot, pPix->drawable.depth);
- pwTmp = (CfbBits *) xalloc(pPix->drawable.height * tsize);
- if (!pwTmp)
- return;
- /* divide pw (the pixmap) in two vertically at (w - rot) and swap */
- tsize >>= 2;
- size = pPix->devKind >> SIZE0F(PixelGroup);
- cfbQuickBlt((CfbBits *)pw, (CfbBits *)pwTmp,
- 0, 0, 0, 0,
- (int)pPix->drawable.width - rot, (int)pPix->drawable.height,
- size, tsize);
- cfbQuickBlt((CfbBits *)pw, (CfbBits *)pw,
- (int)pPix->drawable.width - rot, 0, 0, 0,
- rot, (int)pPix->drawable.height,
- size, size);
- cfbQuickBlt((CfbBits *)pwTmp, (CfbBits *)pw,
- 0, 0, rot, 0,
- (int)pPix->drawable.width - rot, (int)pPix->drawable.height,
- tsize, size);
- xfree(pwTmp);
-#endif
- }
-}
-
-/* Rotates pixmap pPix by h lines. Assumes that h is always less than
- pPix->drawable.height
- works on any width.
- */
-void
-cfbYRotatePixmap(pPix, rh)
- register PixmapPtr pPix;
- int rh;
-{
- int nbyDown; /* bytes to move down to row 0; also offset of
- row rh */
- int nbyUp; /* bytes to move up to line rh; also
- offset of first line moved down to 0 */
- char *pbase;
- char *ptmp;
- int rot;
-
- if (pPix == NullPixmap)
- return;
- switch (((DrawablePtr) pPix)->bitsPerPixel) {
- case PSZ:
- break;
- case 1:
- mfbYRotatePixmap(pPix, rh);
- return;
- default:
- ErrorF("cfbYRotatePixmap: unsupported bitsPerPixel %d\n", ((DrawablePtr) pPix)->bitsPerPixel);
- return;
- }
-
- modulus (rh, (int) pPix->drawable.height, rot);
- pbase = (char *)pPix->devPrivate.ptr;
-
- nbyDown = rot * pPix->devKind;
- nbyUp = (pPix->devKind * pPix->drawable.height) - nbyDown;
- if(!(ptmp = (char *)xalloc(nbyUp)))
- return;
-
- memmove(ptmp, pbase, nbyUp); /* save the low rows */
- memmove(pbase, pbase+nbyUp, nbyDown); /* slide the top rows down */
- memmove(pbase+nbyDown, ptmp, nbyUp); /* move lower rows up to row rot */
- xfree(ptmp);
-}
-
-void
-cfbCopyRotatePixmap(psrcPix, ppdstPix, xrot, yrot)
- register PixmapPtr psrcPix, *ppdstPix;
- int xrot, yrot;
-{
- register PixmapPtr pdstPix;
-
- if ((pdstPix = *ppdstPix) &&
- (pdstPix->devKind == psrcPix->devKind) &&
- (pdstPix->drawable.height == psrcPix->drawable.height))
- {
- memmove((char *)pdstPix->devPrivate.ptr,
- (char *)psrcPix->devPrivate.ptr,
- psrcPix->drawable.height * psrcPix->devKind);
- pdstPix->drawable.width = psrcPix->drawable.width;
- pdstPix->drawable.depth = psrcPix->drawable.depth;
- pdstPix->drawable.bitsPerPixel = psrcPix->drawable.bitsPerPixel;
- pdstPix->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- }
- else
- {
- if (pdstPix)
- /* FIX XBUG 6168 */
- (*pdstPix->drawable.pScreen->DestroyPixmap)(pdstPix);
- *ppdstPix = pdstPix = cfbCopyPixmap(psrcPix);
- if (!pdstPix)
- return;
- }
- cfbPadPixmap(pdstPix);
- if (xrot)
- cfbXRotatePixmap(pdstPix, xrot);
- if (yrot)
- cfbYRotatePixmap(pdstPix, yrot);
-}
diff --git a/cfb/cfbply1rct.c b/cfb/cfbply1rct.c
deleted file mode 100644
index ce0bcb203..000000000
--- a/cfb/cfbply1rct.c
+++ /dev/null
@@ -1,363 +0,0 @@
-/*
- *
-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
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <X11/X.h>
-
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "regionstr.h"
-#include "scrnintstr.h"
-#include "mistruct.h"
-
-#include "cfb.h"
-#include "cfbmskbits.h"
-#include "cfbrrop.h"
-
-void
-RROP_NAME(cfbFillPoly1Rect) (pDrawable, pGC, shape, mode, count, ptsIn)
- DrawablePtr pDrawable;
- GCPtr pGC;
- int shape;
- int mode;
- int count;
- DDXPointPtr ptsIn;
-{
- cfbPrivGCPtr devPriv;
- int nwidth;
- CfbBits *addrl, *addr;
-#if PSZ == 24
- CfbBits startmask, endmask;
- register int pidx;
-#else
-#if PPW > 1
- CfbBits mask, bits = ~((CfbBits)0);
-#endif
-#endif
- int maxy;
- int origin;
- register int vertex1, vertex2;
- int c = 0;
- BoxPtr extents;
- int clip;
- int y;
- int *vertex1p = NULL, *vertex2p;
- int *endp;
- int x1 = 0, x2 = 0;
- int dx1 = 0, dx2 = 0;
- int dy1 = 0, dy2 = 0;
- int e1 = 0, e2 = 0;
- int step1 = 0, step2 = 0;
- int sign1 = 0, sign2 = 0;
- int h;
- int l;
-#if PSZ != 24 && PPW > 1
- int r;
-#endif
- int nmiddle;
- RROP_DECLARE
-
- if (mode == CoordModePrevious)
- {
- miFillPolygon (pDrawable, pGC, shape, mode, count, ptsIn);
- return;
- }
-
- devPriv = cfbGetGCPrivate(pGC);
-#ifdef NO_ONE_RECT
- if (REGION_NUM_RECTS(pGC->pCompositeClip) != 1)
- {
- miFillPolygon (pDrawable, pGC, shape, mode, count, ptsIn);
- return;
- }
-#endif
- origin = *((int *) &pDrawable->x);
- vertex2 = origin - ((origin & 0x8000) << 1);
- extents = &pGC->pCompositeClip->extents;
- RROP_FETCH_GCPRIV(devPriv);
- vertex1 = *((int *) &extents->x1) - vertex2;
- vertex2 = *((int *) &extents->x2) - vertex2 - 0x00010001;
- clip = 0;
- y = 32767;
- maxy = 0;
- vertex2p = (int *) ptsIn;
- endp = vertex2p + count;
- if (shape == Convex)
- {
- while (count--)
- {
- c = *vertex2p;
- clip |= (c - vertex1) | (vertex2 - c);
- c = intToY(c);
- if (c < y)
- {
- y = c;
- vertex1p = vertex2p;
- }
- vertex2p++;
- if (c > maxy)
- maxy = c;
- }
- }
- else
- {
- int yFlip = 0;
- dx1 = 1;
- x2 = -1;
- x1 = -1;
- while (count--)
- {
- c = *vertex2p;
- clip |= (c - vertex1) | (vertex2 - c);
- c = intToY(c);
- if (c < y)
- {
- y = c;
- vertex1p = vertex2p;
- }
- vertex2p++;
- if (c > maxy)
- maxy = c;
- if (c == x1)
- continue;
- if (dx1 > 0)
- {
- if (x2 < 0)
- x2 = c;
- else
- dx2 = dx1 = (c - x1) >> 31;
- }
- else
- if ((c - x1) >> 31 != dx1)
- {
- dx1 = ~dx1;
- yFlip++;
- }
- x1 = c;
- }
- x1 = (x2 - c) >> 31;
- if (x1 != dx1)
- yFlip++;
- if (x1 != dx2)
- yFlip++;
- if (yFlip != 2)
- clip = 0x8000;
- }
- if (y == maxy)
- return;
-
- if (clip & 0x80008000)
- {
- miFillPolygon (pDrawable, pGC, shape, mode, vertex2p - (int *) ptsIn, ptsIn);
- return;
- }
-
-#define AddrYPlus(a,y) (CfbBits *) (((unsigned char *) (a)) + (y) * nwidth)
-
- cfbGetTypedWidthAndPointer(pDrawable, nwidth, addrl, unsigned char, CfbBits);
- addrl = AddrYPlus(addrl,y + pDrawable->y);
- origin = intToX(origin);
- vertex2p = vertex1p;
- vertex2 = vertex1 = *vertex2p++;
- if (vertex2p == endp)
- vertex2p = (int *) ptsIn;
-#define Setup(c,x,vertex,dx,dy,e,sign,step) {\
- x = intToX(vertex); \
- if ((dy = intToY(c) - y)) { \
- dx = intToX(c) - x; \
- step = 0; \
- if (dx >= 0) \
- { \
- e = 0; \
- sign = 1; \
- if (dx >= dy) {\
- step = dx / dy; \
- dx = dx % dy; \
- } \
- } \
- else \
- { \
- e = 1 - dy; \
- sign = -1; \
- dx = -dx; \
- if (dx >= dy) { \
- step = - (dx / dy); \
- dx = dx % dy; \
- } \
- } \
- } \
- x += origin; \
- vertex = c; \
-}
-
-#define Step(x,dx,dy,e,sign,step) {\
- x += step; \
- if ((e += dx) > 0) \
- { \
- x += sign; \
- e -= dy; \
- } \
-}
- for (;;)
- {
- if (y == intToY(vertex1))
- {
- do
- {
- if (vertex1p == (int *) ptsIn)
- vertex1p = endp;
- c = *--vertex1p;
- Setup (c,x1,vertex1,dx1,dy1,e1,sign1,step1)
- } while (y >= intToY(vertex1));
- h = dy1;
- }
- else
- {
- Step(x1,dx1,dy1,e1,sign1,step1)
- h = intToY(vertex1) - y;
- }
- if (y == intToY(vertex2))
- {
- do
- {
- c = *vertex2p++;
- if (vertex2p == endp)
- vertex2p = (int *) ptsIn;
- Setup (c,x2,vertex2,dx2,dy2,e2,sign2,step2)
- } while (y >= intToY(vertex2));
- if (dy2 < h)
- h = dy2;
- }
- else
- {
- Step(x2,dx2,dy2,e2,sign2,step2)
- if ((c = (intToY(vertex2) - y)) < h)
- h = c;
- }
- /* fill spans for this segment */
- y += h;
- for (;;)
- {
- l = x1;
-#if PSZ != 24 && PPW > 1
- r = x2;
-#endif
- nmiddle = x2 - x1;
- if (nmiddle < 0)
- {
- nmiddle = -nmiddle;
- l = x2;
-#if PSZ != 24 && PPW > 1
- r = x1;
-#endif
- }
-#if PPW > 1
- c = l & PIM;
- l -= c;
-#endif
-
-#if PGSZ == 32
-#define LWRD_SHIFT 2
-#else /* PGSZ == 64 */
-#define LWRD_SHIFT 3
-#endif /* PGSZ */
-
-#if PSZ == 24
- addr = (CfbBits *)((char *)addrl + ((l * 3) & ~0x03));
- if (nmiddle <= 1){
- if (nmiddle)
- RROP_SOLID24(addr, l);
- } else {
- maskbits(l, nmiddle, startmask, endmask, nmiddle);
- pidx = l & 3;
- if (startmask){
- RROP_SOLID_MASK(addr, startmask, pidx-1);
- addr++;
- if (pidx == 3)
- pidx = 0;
- }
- while (--nmiddle >= 0){
- RROP_SOLID(addr, pidx);
- addr++;
- if (++pidx == 3)
- pidx = 0;
- }
- if (endmask)
- RROP_SOLID_MASK(addr, endmask, pidx);
- }
-#else /* PSZ == 24 */
-#if PWSH > LWRD_SHIFT
- l = l >> (PWSH - LWRD_SHIFT);
-#endif
-#if PWSH < LWRD_SHIFT
- l = l << (LWRD_SHIFT - PWSH);
-#endif
- addr = (CfbBits *) (((char *) addrl) + l);
-#if PPW > 1
- if (c + nmiddle < PPW)
- {
- mask = SCRRIGHT (bits,c) ^ SCRRIGHT (bits,c+nmiddle);
- RROP_SOLID_MASK(addr,mask);
- }
- else
- {
- if (c)
- {
- mask = SCRRIGHT(bits, c);
- RROP_SOLID_MASK(addr,mask);
- nmiddle += c - PPW;
- addr++;
- }
-#endif
- nmiddle >>= PWSH;
- while (--nmiddle >= 0) {
- RROP_SOLID(addr); addr++;
- }
-#if PPW > 1
- if ((mask = ~SCRRIGHT(bits, r & PIM)))
- RROP_SOLID_MASK(addr,mask);
- }
-#endif
-#endif /* PSZ == 24 */
- if (!--h)
- break;
- addrl = AddrYPlus (addrl, 1);
- Step(x1,dx1,dy1,e1,sign1,step1)
- Step(x2,dx2,dy2,e2,sign2,step2)
- }
- if (y == maxy)
- break;
- addrl = AddrYPlus (addrl, 1);
- }
- RROP_UNDECLARE
-}
diff --git a/cfb/cfbpolypnt.c b/cfb/cfbpolypnt.c
deleted file mode 100644
index 06a768e8d..000000000
--- a/cfb/cfbpolypnt.c
+++ /dev/null
@@ -1,202 +0,0 @@
-/************************************************************
-
-Copyright 1989, 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.
-
-********************************************************/
-
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "regionstr.h"
-#include "scrnintstr.h"
-#include "cfb.h"
-#include "cfbmskbits.h"
-
-#define isClipped(c,ul,lr) ((((c) - (ul)) | ((lr) - (c))) & ClipMask)
-
-/* WARNING: pbox contains two shorts. This code assumes they are packed
- * and can be referenced together as an INT32.
- */
-
-#define PointLoop(fill) { \
- for (nbox = REGION_NUM_RECTS(cclip), pbox = REGION_RECTS(cclip); \
- --nbox >= 0; \
- pbox++) \
- { \
- c1 = *((INT32 *) &pbox->x1) - off; \
- c2 = *((INT32 *) &pbox->x2) - off - 0x00010001; \
- for (ppt = (INT32 *) pptInit, i = npt; --i >= 0;) \
- { \
- pt = *ppt++; \
- if (!isClipped(pt,c1,c2)) { \
- fill \
- } \
- } \
- } \
-}
-
-#if PSZ == 24
-# include "cfbrrop24.h"
-#endif
-
-void
-cfbPolyPoint(pDrawable, pGC, mode, npt, pptInit)
- DrawablePtr pDrawable;
- GCPtr pGC;
- int mode;
- int npt;
- xPoint *pptInit;
-{
- register INT32 pt;
- register INT32 c1, c2;
- register CARD32 ClipMask = 0x80008000;
- register CfbBits xor;
-#ifdef PIXEL_ADDR
- register PixelType *addrp;
- register int npwidth;
-#if PSZ != 24
- PixelType *addrpt;
-#endif
-#else
- register CfbBits *addrl;
- register int nlwidth;
- register int xoffset;
- CfbBits *addrlt;
-#endif
-#if PSZ == 24
- RROP_DECLARE
- register int xtmp;
- register PixelType *p;
-#endif
- register INT32 *ppt;
- RegionPtr cclip;
- int nbox;
- register int i;
- register BoxPtr pbox;
- CfbBits and;
- int rop = pGC->alu;
- int off;
- cfbPrivGCPtr devPriv;
- xPoint *pptPrev;
-
- devPriv =cfbGetGCPrivate(pGC);
- rop = devPriv->rop;
- if (rop == GXnoop)
- return;
- cclip = pGC->pCompositeClip;
- xor = devPriv->xor;
- if ((mode == CoordModePrevious) && (npt > 1))
- {
- for (pptPrev = pptInit + 1, i = npt - 1; --i >= 0; pptPrev++)
- {
- pptPrev->x += (pptPrev-1)->x;
- pptPrev->y += (pptPrev-1)->y;
- }
- }
- off = *((int *) &pDrawable->x);
- off -= (off & 0x8000) << 1;
-#ifdef PIXEL_ADDR
- cfbGetPixelWidthAndPointer(pDrawable, npwidth, addrp);
-#if PSZ == 24
- addrp = addrp + pDrawable->y * npwidth;
-#else
- addrp = addrp + pDrawable->y * npwidth + pDrawable->x;
-#endif
- if (rop == GXcopy)
- {
-#if PSZ == 24
- RROP_COPY_SETUP(xor)
-#endif
- if (!(npwidth & (npwidth - 1)))
- {
- npwidth = ffs(npwidth) - 1;
-#if PSZ == 24
- PointLoop(
- xtmp = pDrawable->x + intToX(pt);
- p = addrp + (intToY(pt) << npwidth) + ((xtmp * 3) >>2);
- RROP_SOLID24_COPY(p, xtmp))
-#else
- PointLoop(*(addrp + (intToY(pt) << npwidth) + intToX(pt)) = xor;)
-#endif
- }
-#ifdef sun
- else if (npwidth == 1152)
- {
- register int y;
- PointLoop(y = intToY(pt); *(addrp + (y << 10) + (y << 7) + intToX(pt)) = xor;)
- }
-#endif
- else
- {
-#if PSZ == 24
- PointLoop(
- xtmp = pDrawable->x + intToX(pt);
- p = addrp + intToY(pt) * npwidth + ((xtmp * 3) >> 2);
- RROP_SOLID24_COPY(p, xtmp))
-#else
- PointLoop(*(addrp + intToY(pt) * npwidth + intToX(pt)) = xor;)
-#endif
- }
- }
- else
- {
- and = devPriv->and;
-#if PSZ == 24
- RROP_SET_SETUP(xor, and)
- PointLoop(
- xtmp = pDrawable->x + intToX(pt);
- p = addrp + intToY(pt) * npwidth + ((xtmp * 3) >> 2);
- RROP_SOLID24_SET(p, xtmp))
-#else
- PointLoop( addrpt = addrp + intToY(pt) * npwidth + intToX(pt);
- *addrpt = DoRRop (*addrpt, and, xor);)
-#endif
- }
-#else /* !PIXEL_ADDR */
- cfbGetLongWidthAndPointer(pDrawable, nlwidth, addrl);
- addrl = addrl + pDrawable->y * nlwidth + (pDrawable->x >> PWSH);
- xoffset = pDrawable->x & PIM;
- and = devPriv->and;
-#if PSZ == 24
- PointLoop( addrlt = addrl + intToY(pt) * nlwidth
- + ((intToX(pt) + xoffset) >> PWSH);
- *addrlt = DoRRop (*addrlt,
- and | ~cfbmask[(intToX(pt) + xoffset) & PIM],
- xor & cfbmask[(intToX(pt) + xoffset) & PIM]);
- )
-#else
- PointLoop( addrlt = addrl + intToY(pt) * nlwidth
- + ((intToX(pt) + xoffset) >> PWSH);
- *addrlt = DoRRop (*addrlt,
- and | ~cfbmask[((intToX(pt) + xoffset) & 3)<<1],
- xor & cfbmask[((intToX(pt) + xoffset) & 3)<<1]);
- )
-#endif
-#endif /* PIXEL_ADDR */
-}
diff --git a/cfb/cfbpush8.c b/cfb/cfbpush8.c
deleted file mode 100644
index 857ec94a6..000000000
--- a/cfb/cfbpush8.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Push Pixels for 8 bit displays.
- */
-
-
-/*
-
-Copyright 1989, 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.
-*/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#if PSZ == 8
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <X11/Xproto.h>
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "regionstr.h"
-#include "cfb.h"
-#include "cfbmskbits.h"
-#include "cfb8bit.h"
-#define MFB_CONSTS_ONLY
-#include "maskbits.h"
-
-void
-cfbPushPixels8 (pGC, pBitmap, pDrawable, dx, dy, xOrg, yOrg)
- GCPtr pGC;
- PixmapPtr pBitmap;
- DrawablePtr pDrawable;
- int dx, dy, xOrg, yOrg;
-{
- register CfbBits *src, *dst;
- register CfbBits pixel;
- register CfbBits c, bits;
- CfbBits *pdstLine, *psrcLine;
- CfbBits *pdstBase;
- int srcWidth;
- int dstWidth;
- int xoff;
- int nBitmapLongs, nPixmapLongs;
- int nBitmapTmp, nPixmapTmp;
- CfbBits rightMask;
- BoxRec bbox;
- cfbPrivGCPtr devPriv;
-
- bbox.x1 = xOrg;
- bbox.y1 = yOrg;
- bbox.x2 = bbox.x1 + dx;
- bbox.y2 = bbox.y1 + dy;
- devPriv = cfbGetGCPrivate(pGC);
-
- switch (RECT_IN_REGION(pGC->pScreen, pGC->pCompositeClip, &bbox))
- {
- case rgnPART:
- mfbPushPixels(pGC, pBitmap, pDrawable, dx, dy, xOrg, yOrg);
- case rgnOUT:
- return;
- }
-
- cfbGetLongWidthAndPointer (pDrawable, dstWidth, pdstBase)
-
- psrcLine = (CfbBits *) pBitmap->devPrivate.ptr;
- srcWidth = (int) pBitmap->devKind >> PWSH;
-
- pixel = devPriv->xor;
- xoff = xOrg & PIM;
- nBitmapLongs = (dx + xoff) >> MFB_PWSH;
- nPixmapLongs = (dx + PGSZB + xoff) >> PWSH;
-
- rightMask = ~cfb8BitLenMasks[((dx + xoff) & MFB_PIM)];
-
- pdstLine = pdstBase + (yOrg * dstWidth) + (xOrg >> PWSH);
-
- while (dy--)
- {
- c = 0;
- nPixmapTmp = nPixmapLongs;
- nBitmapTmp = nBitmapLongs;
- src = psrcLine;
- dst = pdstLine;
- while (nBitmapTmp--)
- {
- bits = *src++;
- c |= BitRight (bits, xoff);
- WriteBitGroup(dst, pixel, GetBitGroup(c));
- NextBitGroup(c);
- dst++;
- WriteBitGroup(dst, pixel, GetBitGroup(c));
- NextBitGroup(c);
- dst++;
- WriteBitGroup(dst, pixel, GetBitGroup(c));
- NextBitGroup(c);
- dst++;
- WriteBitGroup(dst, pixel, GetBitGroup(c));
- NextBitGroup(c);
- dst++;
- WriteBitGroup(dst, pixel, GetBitGroup(c));
- NextBitGroup(c);
- dst++;
- WriteBitGroup(dst, pixel, GetBitGroup(c));
- NextBitGroup(c);
- dst++;
- WriteBitGroup(dst, pixel, GetBitGroup(c));
- NextBitGroup(c);
- dst++;
- WriteBitGroup(dst, pixel, GetBitGroup(c));
- NextBitGroup(c);
- dst++;
- nPixmapTmp -= 8;
- c = 0;
- if (xoff)
- c = BitLeft (bits, PGSZ - xoff);
- }
- if (BitLeft (rightMask, xoff))
- c |= BitRight (*src, xoff);
- c &= rightMask;
- switch (nPixmapTmp) {
- case 8:
- WriteBitGroup(dst, pixel, GetBitGroup(c));
- NextBitGroup(c);
- dst++;
- case 7:
- WriteBitGroup(dst, pixel, GetBitGroup(c));
- NextBitGroup(c);
- dst++;
- case 6:
- WriteBitGroup(dst, pixel, GetBitGroup(c));
- NextBitGroup(c);
- dst++;
- case 5:
- WriteBitGroup(dst, pixel, GetBitGroup(c));
- NextBitGroup(c);
- dst++;
- case 4:
- WriteBitGroup(dst, pixel, GetBitGroup(c));
- NextBitGroup(c);
- dst++;
- case 3:
- WriteBitGroup(dst, pixel, GetBitGroup(c));
- NextBitGroup(c);
- dst++;
- case 2:
- WriteBitGroup(dst, pixel, GetBitGroup(c));
- NextBitGroup(c);
- dst++;
- case 1:
- WriteBitGroup(dst, pixel, GetBitGroup(c));
- NextBitGroup(c);
- dst++;
- case 0:
- break;
- }
- pdstLine += dstWidth;
- psrcLine += srcWidth;
- }
-}
-
-#endif
diff --git a/cfb/cfbrctstp8.c b/cfb/cfbrctstp8.c
deleted file mode 100644
index 485d40998..000000000
--- a/cfb/cfbrctstp8.c
+++ /dev/null
@@ -1,593 +0,0 @@
-/*
- * Fill 32 bit stippled rectangles for 8 bit frame buffers
- */
-/*
-
-Copyright 1989, 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
-
-*/
-
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#if PSZ == 8
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include "servermd.h"
-#include "gcstruct.h"
-#include "window.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-#include "windowstr.h"
-
-#include "cfb.h"
-#include "cfbmskbits.h"
-#include "cfb8bit.h"
-
-#define MFB_CONSTS_ONLY
-#include "maskbits.h"
-
-void
-cfb8FillRectOpaqueStippled32 (pDrawable, pGC, nBox, pBox)
- DrawablePtr pDrawable;
- GCPtr pGC;
- int nBox; /* number of boxes to fill */
- register BoxPtr pBox; /* pointer to list of boxes to fill */
-{
- CfbBits *src;
- int stippleHeight;
-
- int nlwDst; /* width in longwords of the dest pixmap */
- int w; /* width of current box */
- register int h; /* height of current box */
- CfbBits startmask;
- CfbBits endmask; /* masks for reggedy bits at either end of line */
- int nlwMiddle; /* number of longwords between sides of boxes */
- register int nlw; /* loop version of nlwMiddle */
- CfbBits *dstLine;
- register CfbBits *dst; /* pointer to bits we're writing */
- CfbBits *dstTmp;
- int y; /* current scan line */
-
- CfbBits *pbits;/* pointer to start of pixmap */
- register CfbBits bits; /* bits from stipple */
- int rot;
- register CfbBits xor;
- PixmapPtr stipple;
- int wEnd;
-
- stipple = pGC->pRotatedPixmap;
-
- cfb8CheckOpaqueStipple(pGC->alu, pGC->fgPixel, pGC->bgPixel, pGC->planemask);
-
- stippleHeight = stipple->drawable.height;
- src = (CfbBits *)stipple->devPrivate.ptr;
-
- cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits)
-
- while (nBox--)
- {
- w = pBox->x2 - pBox->x1;
- h = pBox->y2 - pBox->y1;
- y = pBox->y1;
- dstLine = pbits + (pBox->y1 * nlwDst) + ((pBox->x1 & ~PIM) >> PWSH);
- if (((pBox->x1 & PIM) + w) <= PPW)
- {
- maskpartialbits(pBox->x1, w, startmask);
- nlwMiddle = 0;
- endmask = 0;
- }
- else
- {
- maskbits (pBox->x1, w, startmask, endmask, nlwMiddle);
- }
- rot = (pBox->x1 & ((PGSZ-1) & ~PIM));
- pBox++;
- y = y % stippleHeight;
-#if PPW == 4
- if (cfb8StippleRRop == GXcopy)
- {
- if (w < PGSZ*2)
- {
- while (h--)
- {
- bits = src[y];
- y++;
- if (y == stippleHeight)
- y = 0;
- if (rot)
- RotBitsLeft(bits,rot);
- dst = dstLine;
- dstLine += nlwDst;
- if (startmask)
- {
- *dst = (*dst & ~startmask) |
- (GetPixelGroup (bits) & startmask);
- dst++;
- RotBitsLeft (bits, PGSZB);
- }
- nlw = nlwMiddle;
- while (nlw--)
- {
- *dst++ = GetPixelGroup(bits);
- RotBitsLeft (bits, PGSZB);
- }
- if (endmask)
- {
- *dst = (*dst & ~endmask) |
- (GetPixelGroup (bits) & endmask);
- }
- }
- }
- else
- {
- wEnd = 7 - (nlwMiddle & 7);
- nlwMiddle = (nlwMiddle >> 3) + 1;
- while (h--)
- {
- bits = src[y];
- y++;
- if (y == stippleHeight)
- y = 0;
- if (rot != 0)
- RotBitsLeft (bits, rot);
- dstTmp = dstLine;
- dstLine += nlwDst;
- if (startmask)
- {
- *dstTmp = (*dstTmp & ~startmask) |
- (GetPixelGroup (bits) & startmask);
- dstTmp++;
- RotBitsLeft (bits, PGSZB);
- }
- w = 7 - wEnd;
- while (w--)
- {
- nlw = nlwMiddle;
- dst = dstTmp;
- dstTmp++;
- xor = GetPixelGroup (bits);
- while (nlw--)
- {
- *dst = xor;
- dst += 8;
- }
- NextBitGroup (bits);
- }
- nlwMiddle--;
- w = wEnd + 1;
- if (endmask)
- {
- dst = dstTmp + (nlwMiddle << 3);
- *dst = (*dst & ~endmask) |
- (GetPixelGroup(bits) & endmask);
- }
- while (w--)
- {
- nlw = nlwMiddle;
- dst = dstTmp;
- dstTmp++;
- xor = GetPixelGroup (bits);
- while (nlw--)
- {
- *dst = xor;
- dst += 8;
- }
- NextBitGroup (bits);
- }
- nlwMiddle++;
- }
- }
- }
- else
-#endif /* PPW == 4 */
- {
- while (h--)
- {
- bits = src[y];
- y++;
- if (y == stippleHeight)
- y = 0;
- if (rot)
- RotBitsLeft(bits,rot);
- dst = dstLine;
- dstLine += nlwDst;
- if (startmask)
- {
- xor = GetBitGroup(bits);
- *dst = MaskRRopPixels(*dst, xor, startmask);
- dst++;
- RotBitsLeft (bits, PGSZB);
- }
- nlw = nlwMiddle;
- while (nlw--)
- {
- RRopBitGroup(dst, GetBitGroup(bits));
- dst++;
- RotBitsLeft (bits, PGSZB);
- }
- if (endmask)
- {
- xor = GetBitGroup(bits);
- *dst = MaskRRopPixels(*dst, xor, endmask);
- }
- }
- }
- }
-}
-
-void
-cfb8FillRectTransparentStippled32 (pDrawable, pGC, nBox, pBox)
- DrawablePtr pDrawable;
- GCPtr pGC;
- int nBox; /* number of boxes to fill */
- BoxPtr pBox; /* pointer to list of boxes to fill */
-{
- int x, y, w, h;
- int nlwMiddle, nlwDst;
- CfbBits startmask, endmask;
- register CfbBits *dst;
- CfbBits *dstLine, *pbits, *dstTmp;
- CfbBits *src;
- register CfbBits xor;
- register CfbBits bits, mask;
- int rot;
- int wEnd;
- cfbPrivGCPtr devPriv;
- PixmapPtr stipple;
- int stippleHeight;
- register int nlw;
-
- devPriv = cfbGetGCPrivate(pGC);
- stipple = pGC->pRotatedPixmap;
- src = (CfbBits *)stipple->devPrivate.ptr;
- stippleHeight = stipple->drawable.height;
-
- cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask);
-
- cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits)
-
- while (nBox--)
- {
- x = pBox->x1;
- w = pBox->x2 - x;
- if (((x & PIM) + w) <= PPW)
- {
- maskpartialbits(x, w, startmask);
- endmask = 0;
- nlwMiddle = 0;
- }
- else
- {
- maskbits (x, w, startmask, endmask, nlwMiddle);
- }
- rot = (x & ((PGSZ-1) & ~PIM));
- y = pBox->y1;
- dstLine = pbits + (y * nlwDst) + (x >> PWSH);
- h = pBox->y2 - y;
- pBox++;
- y %= stippleHeight;
-#if PPW == 4
- if (cfb8StippleRRop == GXcopy)
- {
- xor = devPriv->xor;
- if (w < PGSZ*2)
- {
- while (h--)
- {
- bits = src[y];
- y++;
- if (y == stippleHeight)
- y = 0;
- if (rot != 0)
- RotBitsLeft (bits, rot);
- dst = dstLine;
- dstLine += nlwDst;
- if (startmask)
- {
- mask = cfb8PixelMasks[GetBitGroup(bits)];
- *dst = (*dst & ~(mask & startmask)) |
- (xor & (mask & startmask));
- dst++;
- RotBitsLeft (bits, PGSZB);
- }
- nlw = nlwMiddle;
- while (nlw--)
- {
- WriteBitGroup (dst,xor,GetBitGroup(bits))
- dst++;
- RotBitsLeft (bits, PGSZB);
- }
- if (endmask)
- {
- mask = cfb8PixelMasks[GetBitGroup(bits)];
- *dst = (*dst & ~(mask & endmask)) |
- (xor & (mask & endmask));
- }
- }
- }
- else
- {
- wEnd = 7 - (nlwMiddle & 7);
- nlwMiddle = (nlwMiddle >> 3) + 1;
- while (h--)
- {
- bits = src[y];
- y++;
- if (y == stippleHeight)
- y = 0;
- if (rot != 0)
- RotBitsLeft (bits, rot);
- dstTmp = dstLine;
- dstLine += nlwDst;
- if (startmask)
- {
- mask = cfb8PixelMasks[GetBitGroup(bits)];
- *dstTmp = (*dstTmp & ~(mask & startmask)) |
- (xor & (mask & startmask));
- dstTmp++;
- RotBitsLeft (bits, PGSZB);
- }
- w = 7 - wEnd;
- while (w--)
- {
- nlw = nlwMiddle;
- dst = dstTmp;
- dstTmp++;
-#if defined(__GNUC__) && defined(mc68020)
- mask = cfb8PixelMasks[GetBitGroup(bits)];
- xor = xor & mask;
- mask = ~mask;
- while (nlw--)
- {
- *dst = (*dst & mask) | xor;
- dst += 8;
- }
- xor = devPriv->xor;
-#else
-#define SwitchBitsLoop(body) \
- while (nlw--) \
- { \
- body \
- dst += 8; \
- }
- SwitchBitGroup(dst, xor, GetBitGroup(bits));
-#undef SwitchBitsLoop
-#endif
- NextBitGroup (bits);
- }
- nlwMiddle--;
- w = wEnd + 1;
- if (endmask)
- {
- mask = cfb8PixelMasks[GetBitGroup(bits)];
- dst = dstTmp + (nlwMiddle << 3);
- *dst = (*dst & ~(mask & endmask)) |
- (xor & (mask & endmask));
- }
- while (w--)
- {
- nlw = nlwMiddle;
- dst = dstTmp;
- dstTmp++;
-#if defined(__GNUC__) && defined(mc68020)
- mask = cfb8PixelMasks[GetBitGroup(bits)];
- xor = xor & mask;
- mask = ~mask;
- while (nlw--)
- {
- *dst = (*dst & mask) | xor;
- dst += 8;
- }
- xor = devPriv->xor;
-#else
-#define SwitchBitsLoop(body) \
- while (nlw--) \
- { \
- body \
- dst += 8; \
- }
- SwitchBitGroup(dst, xor, GetBitGroup(bits));
-#undef SwitchBitsLoop
-#endif
- NextBitGroup (bits);
- }
- nlwMiddle++;
- }
- }
- }
- else
-#endif /* PPW == 4 */
- {
- while (h--)
- {
- bits = src[y];
- y++;
- if (y == stippleHeight)
- y = 0;
- if (rot != 0)
- RotBitsLeft (bits, rot);
- dst = dstLine;
- dstLine += nlwDst;
- if (startmask)
- {
- xor = GetBitGroup(bits);
- *dst = MaskRRopPixels(*dst, xor, startmask);
- dst++;
- RotBitsLeft (bits, PGSZB);
- }
- nlw = nlwMiddle;
- while (nlw--)
- {
- RRopBitGroup(dst, GetBitGroup(bits));
- dst++;
- RotBitsLeft (bits, PGSZB);
- }
- if (endmask)
- {
- xor = GetBitGroup(bits);
- *dst = MaskRRopPixels(*dst, xor, endmask);
- }
- }
- }
- }
-}
-
-
-void
-cfb8FillRectStippledUnnatural (pDrawable, pGC, nBox, pBox)
- DrawablePtr pDrawable;
- GCPtr pGC;
- int nBox;
- register BoxPtr pBox;
-{
- CfbBits *pdstBase; /* pointer to start of bitmap */
- CfbBits *pdstLine; /* current destination line */
- int nlwDst; /* width in longwords of bitmap */
- PixmapPtr pStipple; /* pointer to stipple we want to fill with */
- int nlwMiddle;
- register int nlw;
- int x, y, w, h, xrem, xSrc, ySrc;
- int stwidth, stippleWidth;
- int stippleHeight;
- register CfbBits bits, inputBits;
- register int partBitsLeft;
- int nextPartBits;
- int bitsLeft, bitsWhole;
- register CfbBits *pdst; /* pointer to current word in bitmap */
- CfbBits *srcTemp, *srcStart;
- CfbBits *psrcBase;
- CfbBits startmask, endmask;
-
- if (pGC->fillStyle == FillStippled)
- cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask);
- else
- cfb8CheckOpaqueStipple (pGC->alu, pGC->fgPixel, pGC->bgPixel, pGC->planemask);
-
- if (cfb8StippleRRop == GXnoop)
- return;
-
- /*
- * OK, so what's going on here? We have two Drawables:
- *
- * The Stipple:
- * Depth = 1
- * Width = stippleWidth
- * Words per scanline = stwidth
- * Pointer to pixels = pStipple->devPrivate.ptr
- */
-
- pStipple = pGC->stipple;
-
- stwidth = pStipple->devKind >> PWSH;
- stippleWidth = pStipple->drawable.width;
- stippleHeight = pStipple->drawable.height;
- psrcBase = (CfbBits *) pStipple->devPrivate.ptr;
-
- /*
- * The Target:
- * Depth = PSZ
- * Width = determined from *pwidth
- * Words per scanline = nlwDst
- * Pointer to pixels = addrlBase
- */
-
- xSrc = pDrawable->x;
- ySrc = pDrawable->y;
-
- cfbGetLongWidthAndPointer (pDrawable, nlwDst, pdstBase)
-
- /* this replaces rotating the stipple. Instead we just adjust the offset
- * at which we start grabbing bits from the stipple.
- * Ensure that ppt->x - xSrc >= 0 and ppt->y - ySrc >= 0,
- * so that iline and xrem always stay within the stipple bounds.
- */
-
- xSrc += (pGC->patOrg.x % stippleWidth) - stippleWidth;
- ySrc += (pGC->patOrg.y % stippleHeight) - stippleHeight;
-
- bitsWhole = stippleWidth;
-
- while (nBox--)
- {
- x = pBox->x1;
- y = pBox->y1;
- w = pBox->x2 - x;
- h = pBox->y2 - y;
- pBox++;
- pdstLine = pdstBase + y * nlwDst + (x >> PWSH);
- y = (y - ySrc) % stippleHeight;
- srcStart = psrcBase + y * stwidth;
- xrem = ((x & ~PIM) - xSrc) % stippleWidth;
- if (((x & PIM) + w) < PPW)
- {
- maskpartialbits (x, w, startmask);
- nlwMiddle = 0;
- endmask = 0;
- }
- else
- {
- maskbits (x, w, startmask, endmask, nlwMiddle);
- }
- while (h--)
- {
- srcTemp = srcStart + (xrem >> MFB_PWSH);
- bitsLeft = stippleWidth - (xrem & ~MFB_PIM);
- NextUnnaturalStippleWord
- NextSomeBits (inputBits, (xrem & MFB_PIM));
- partBitsLeft -= (xrem & MFB_PIM);
- NextUnnaturalStippleBits
- nlw = nlwMiddle;
- pdst = pdstLine;
- if (startmask)
- {
- *pdst = MaskRRopPixels(*pdst,bits,startmask);
- pdst++;
- NextUnnaturalStippleBits
- }
- while (nlw--)
- {
- *pdst = RRopPixels(*pdst,bits);
- pdst++;
- NextUnnaturalStippleBits
- }
- if (endmask)
- *pdst = MaskRRopPixels(*pdst,bits,endmask);
- pdstLine += nlwDst;
- y++;
- srcStart += stwidth;
- if (y == stippleHeight)
- {
- y = 0;
- srcStart = psrcBase;
- }
- }
- }
-}
-
-#endif /* PSZ == 8 */
diff --git a/cfb/cfbrrop.c b/cfb/cfbrrop.c
deleted file mode 100644
index ffd813853..000000000
--- a/cfb/cfbrrop.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- *
-Copyright 1989, 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
- */
-
-/* cfb reduced rasterop computations */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <X11/Xproto.h>
-#include "cfb.h"
-#include "cfbmskbits.h"
-
-/* A description:
- *
- * There are four possible operations on each bit in the destination word,
- *
- * 1 2 3 4
- *
- * 0 0 0 1 1
- * 1 0 1 0 1
- *
- * On examination of the reduced rop equation (dst = (dst & and) ^ xor),
- * these four fall to reduced rops as follows:
- *
- * and 0 1 1 0
- * xor 0 0 1 1
- *
- * or, (if 'and' is expensive) (dst = (dst | or) ^ xor)
- *
- * or 1 0 0 1
- * xor 1 0 1 0
- *
- * The trouble with using this later equation is that trivial
- * rasterop reduction is more difficult; some common rasterops
- * use complicated expressions of xor/and instead of the simple
- * ones while other common rasterops are not made any simpler:
- *
- * GXcopy: *dst = ~xor instead of *dst = xor
- * GXand: *dst = *dst & ~or instead of *dst = *dst & and
- * GXor: *dst = *dst | or instead of *dst = *dst | xor
- * GXxor: *dst = *dst ^ xor instead of *dst = *dst ^ xor
- *
- * If you're really set on using this second mechanism, the changes
- * are pretty simple.
- *
- * All that remains is to provide a mechanism for computing and/xor values
- * based on the raster op and foreground value.
- *
- * The 16 rops fall as follows, with the associated reduced
- * rop and/xor and or/xor values. The values in parenthesis following the
- * reduced values gives an equation using the source value for
- * the reduced value, and is one of {0, src, ~src, 1} as appropriate.
- *
- * clear and andReverse copy
- * src 0 1 0 1 0 1 0 1
- * dst 0 0 0 0 0 0 0 0 1 0 0 1
- * 1 0 0 1 0 1 1 0 0 1 0 1
- *
- * and 0 0 (0) 0 1 (src) 0 1 (src) 0 0 (0)
- * xor 0 0 (0) 0 0 (0) 0 1 (src) 0 1 (src)
- *
- * or 1 1 (1) 1 0 (~src) 1 0 (~src) 1 1 (1)
- * xor 1 1 (1) 1 0 (~src) 1 1 (1) 1 0 (~src)
- *
- * andInverted noop xor or
- * src 0 1 0 1 0 1 0 1
- * dst 0 0 0 0 0 0 0 0 1 0 0 1
- * 1 1 0 1 1 1 1 1 0 1 1 1
- *
- * and 1 0 (~src) 1 1 (1) 1 1 (1) 1 0 (~src)
- * xor 0 0 (0) 0 0 (0) 0 1 (src) 0 1 (src)
- *
- * or 0 1 (src) 0 0 (0) 0 0 (0) 0 1 (src)
- * xor 0 1 (src) 0 0 (0) 0 1 (src) 0 0 (0)
- *
- * nor equiv invert orReverse
- * src 0 1 0 1 0 1 0 1
- * dst 0 1 0 0 1 0 0 1 1 0 1 1
- * 1 0 0 1 0 1 1 0 0 1 0 1
- *
- * and 1 0 (~src) 1 1 (1) 1 1 (1) 1 0 (~src)
- * xor 1 0 (~src) 1 0 (~src) 1 1 (1) 1 1 (1)
- *
- * or 0 1 (src) 0 0 (0) 0 0 (0) 0 1 (src)
- * xor 1 1 (1) 1 0 (~src) 1 1 (1) 1 0 (~src)
- *
- * copyInverted orInverted nand set
- * src 0 1 0 1 0 1 0 1
- * dst 0 1 0 0 1 0 0 1 1 0 1 1
- * 1 1 0 1 1 1 1 1 0 1 1 1
- *
- * and 0 0 (0) 0 1 (src) 0 1 (src) 0 0 (0)
- * xor 1 0 (~src) 1 0 (~src) 1 1 (1) 1 1 (1)
- *
- * or 1 1 (1) 1 0 (~src) 1 0 (~src) 1 1 (1)
- * xor 0 1 (src) 0 0 (0) 0 1 (src) 0 0 (0)
- */
-
-int
-cfbReduceRasterOp (rop, fg, pm, andp, xorp)
- int rop;
- CfbBits fg, pm;
- CfbBits *andp, *xorp;
-{
- CfbBits and, xor;
- int rrop;
-
- fg = PFILL (fg);
- pm = PFILL (pm);
- switch (rop)
- {
- case GXclear:
- and = 0;
- xor = 0;
- break;
- case GXand:
- and = fg;
- xor = 0;
- break;
- case GXandReverse:
- and = fg;
- xor = fg;
- break;
- case GXcopy:
- and = 0;
- xor = fg;
- break;
- case GXandInverted:
- and = ~fg;
- xor = 0;
- break;
- case GXnoop:
- and = ~0;
- xor = 0;
- break;
- case GXxor:
- and = ~0;
- xor = fg;
- break;
- case GXor:
- and = ~fg;
- xor = fg;
- break;
- case GXnor:
- and = ~fg;
- xor = ~fg;
- break;
- case GXequiv:
- and = ~0;
- xor = ~fg;
- break;
- case GXinvert:
- and = ~0;
- xor = ~0;
- break;
- case GXorReverse:
- and = ~fg;
- xor = ~0;
- break;
- case GXcopyInverted:
- and = 0;
- xor = ~fg;
- break;
- case GXorInverted:
- and = fg;
- xor = ~fg;
- break;
- case GXnand:
- and = fg;
- xor = ~0;
- break;
- case GXset:
- and = 0;
- xor = ~0;
- break;
- default:
- and = xor = 0;
- break;
- }
- and |= ~pm;
- xor &= pm;
- *andp = and;
- *xorp = xor;
- /* check for some special cases to reduce computation */
- if (and == 0)
- rrop = GXcopy;
- /* nothing checks for GXnoop
- else if (and == ~0 && xor == 0)
- rrop = GXnoop;
- */
- else if (and == ~0)
- rrop = GXxor;
- else if (xor == 0)
- rrop = GXand;
- else if ( (and ^ xor) == ~0) /* fix XBUG 6541 */
- rrop = GXor;
- else
- rrop = GXset; /* rop not reduced */
- return rrop;
-}
diff --git a/cfb/cfbrrop.h b/cfb/cfbrrop.h
deleted file mode 100644
index e9ca881be..000000000
--- a/cfb/cfbrrop.h
+++ /dev/null
@@ -1,343 +0,0 @@
-/*
- *
-Copyright 1989, 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
- */
-
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef GXcopy
-#include <X11/X.h>
-#endif
-
-#define RROP_FETCH_GC(gc) \
- RROP_FETCH_GCPRIV((cfbPrivGCPtr)dixLookupPrivate(&(gc)->devPrivates, \
- cfbGCPrivateKey))
-
-#ifndef RROP
-#define RROP GXset
-#endif
-
-#if RROP == GXcopy
-#if PSZ == 24
-#define RROP_DECLARE register CfbBits rrop_xor; \
- CfbBits piQxelXor[3], spiQxelXor[8];
-#define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor; \
- spiQxelXor[0] = rrop_xor & 0xFFFFFF; \
- spiQxelXor[2] = rrop_xor << 24; \
- spiQxelXor[3] = (rrop_xor & 0xFFFF00)>> 8; \
- spiQxelXor[4] = rrop_xor << 16; \
- spiQxelXor[5] = (rrop_xor & 0xFF0000)>> 16; \
- spiQxelXor[6] = rrop_xor << 8; \
- spiQxelXor[1] = spiQxelXor[7] = 0; \
- piQxelXor[0] = (rrop_xor & 0xFFFFFF)|(rrop_xor << 24); \
- piQxelXor[1] = (rrop_xor << 16)|((rrop_xor & 0xFFFF00)>> 8); \
- piQxelXor[2] = (rrop_xor << 8)|((rrop_xor & 0xFF0000)>> 16);
-#define RROP_SOLID24(dst,index) {\
- register int idx = ((index) & 3)<< 1; \
- *(dst) = (*(dst) & cfbrmask[idx])|spiQxelXor[idx]; \
- if (idx == 2 || idx == 4){ \
- idx++; \
- *((dst)+1) = (*((dst)+1) & cfbrmask[idx])|spiQxelXor[idx]; \
- } \
- }
-#define RROP_SOLID(dst, idx) \
- (*(dst) = piQxelXor[(idx)])
-#define RROP_SOLID_MASK(dst,mask,idx) \
- (*(dst) = (*(dst) & ~(mask))|(piQxelXor[(idx)] & (mask)))
-#define RROP_UNDECLARE (void)piQxelXor; (void)spiQxelXor;
-#else
-#define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor;
-#define RROP_DECLARE register CfbBits rrop_xor;
-#define RROP_SOLID(dst) (*(dst) = (rrop_xor))
-#define RROP_SOLID_MASK(dst,mask) (*(dst) = (*(dst) & ~(mask)) | ((rrop_xor) & (mask)))
-#define RROP_UNDECLARE
-#endif
-#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,Copy)
-#endif /* GXcopy */
-
-#if RROP == GXxor
-#if PSZ == 24
-#define RROP_DECLARE register CfbBits rrop_xor; \
- CfbBits piQxelXor[3], spiQxelXor[8];
-#define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor; \
- spiQxelXor[0] = rrop_xor & 0xFFFFFF; \
- spiQxelXor[2] = rrop_xor << 24; \
- spiQxelXor[3] = (rrop_xor & 0xFFFF00)>> 8; \
- spiQxelXor[4] = rrop_xor << 16; \
- spiQxelXor[5] = (rrop_xor & 0xFF0000)>> 16; \
- spiQxelXor[6] = rrop_xor << 8; \
- spiQxelXor[1] = spiQxelXor[7] = 0; \
- piQxelXor[0] = (rrop_xor & 0xFFFFFF)|(rrop_xor << 24); \
- piQxelXor[1] = (rrop_xor << 16)|((rrop_xor & 0xFFFF00)>> 8); \
- piQxelXor[2] = (rrop_xor << 8)|((rrop_xor & 0xFF0000)>> 16);
-#define RROP_SOLID24(dst,index) {\
- register int idx = ((index) & 3)<< 1; \
- *(dst) ^= spiQxelXor[idx]; \
- if (idx == 2 || idx == 4) \
- *((dst)+1) ^= spiQxelXor[idx+1]; \
- }
-#define RROP_SOLID(dst,idx) \
- (*(dst) ^= piQxelXor[(idx)])
-#define RROP_SOLID_MASK(dst,mask,idx) \
- (*(dst) ^= (piQxelXor[(idx)] & (mask)))
-#define RROP_UNDECLARE (void)piQxelXor; (void)spiQxelXor;
-#else
-#define RROP_DECLARE register CfbBits rrop_xor;
-#define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor;
-#define RROP_SOLID(dst) (*(dst) ^= (rrop_xor))
-#define RROP_SOLID_MASK(dst,mask) (*(dst) ^= ((rrop_xor) & (mask)))
-#define RROP_UNDECLARE
-#endif
-#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,Xor)
-#endif /* GXxor */
-
-#if RROP == GXand
-#if PSZ == 24
-#define RROP_DECLARE register CfbBits rrop_and; \
- CfbBits piQxelAnd[3], spiQxelAnd[6];
-#define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and; \
- spiQxelAnd[0] = (rrop_and & 0xFFFFFF) | 0xFF000000; \
- spiQxelAnd[2] = (rrop_and << 24) | 0xFFFFFF; \
- spiQxelAnd[3] = ((rrop_and & 0xFFFF00)>> 8) | 0xFFFF0000; \
- spiQxelAnd[4] = (rrop_and << 16) | 0xFFFF; \
- spiQxelAnd[5] = ((rrop_and & 0xFF0000)>> 16) | 0xFFFFFF00; \
- spiQxelAnd[1] = (rrop_and << 8) | 0xFF; \
- piQxelAnd[0] = (rrop_and & 0xFFFFFF)|(rrop_and << 24); \
- piQxelAnd[1] = (rrop_and << 16)|((rrop_and & 0xFFFF00)>> 8); \
- piQxelAnd[2] = (rrop_and << 8)|((rrop_and & 0xFF0000)>> 16);
-#define RROP_SOLID24(dst,index) {\
- switch((index) & 3){ \
- case 0: \
- *(dst) &= spiQxelAnd[0]; \
- break; \
- case 3: \
- *(dst) &= spiQxelAnd[1]; \
- break; \
- case 1: \
- *(dst) &= spiQxelAnd[2]; \
- *((dst)+1) &= spiQxelAnd[3]; \
- break; \
- case 2: \
- *(dst) &= spiQxelAnd[4]; \
- *((dst)+1) &= spiQxelAnd[5]; \
- break; \
- } \
- }
-#define RROP_SOLID(dst,idx) \
- (*(dst) &= piQxelAnd[(idx)])
-#define RROP_SOLID_MASK(dst,mask,idx) \
- (*(dst) &= (piQxelAnd[(idx)] | ~(mask)))
-#define RROP_UNDECLARE (void)piQxelAnd; (void)spiQxelAnd;
-#else
-#define RROP_DECLARE register CfbBits rrop_and;
-#define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and;
-#define RROP_SOLID(dst) (*(dst) &= (rrop_and))
-#define RROP_SOLID_MASK(dst,mask) (*(dst) &= ((rrop_and) | ~(mask)))
-#define RROP_UNDECLARE
-#endif
-#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,And)
-#endif /* GXand */
-
-#if RROP == GXor
-#if PSZ == 24
-#define RROP_DECLARE register CfbBits rrop_or; \
- CfbBits piQxelOr[3], spiQxelOr[6];
-#define RROP_FETCH_GCPRIV(devPriv) rrop_or = (devPriv)->xor; \
- spiQxelOr[0] = rrop_or & 0xFFFFFF; \
- spiQxelOr[1] = rrop_or << 24; \
- spiQxelOr[2] = rrop_or << 16; \
- spiQxelOr[3] = rrop_or << 8; \
- spiQxelOr[4] = (rrop_or & 0xFFFF00)>> 8; \
- spiQxelOr[5] = (rrop_or & 0xFF0000)>> 16; \
- piQxelOr[0] = (rrop_or & 0xFFFFFF)|(rrop_or << 24); \
- piQxelOr[1] = (rrop_or << 16)|((rrop_or & 0xFFFF00)>> 8); \
- piQxelOr[2] = (rrop_or << 8)|((rrop_or & 0xFF0000)>> 16);
-#define RROP_SOLID24(dst,index) {\
- switch((index) & 3){ \
- case 0: \
- *(dst) |= spiQxelOr[0]; \
- break; \
- case 3: \
- *(dst) |= spiQxelOr[3]; \
- break; \
- case 1: \
- *(dst) |= spiQxelOr[1]; \
- *((dst)+1) |= spiQxelOr[4]; \
- break; \
- case 2: \
- *(dst) |= spiQxelOr[2]; \
- *((dst)+1) |= spiQxelOr[5]; \
- break; \
- } \
- }
-#define RROP_SOLID(dst,idx) \
- (*(dst) |= piQxelOr[(idx)])
-#define RROP_SOLID_MASK(dst,mask,idx) \
- (*(dst) |= (piQxelOr[(idx)] & (mask)))
-#define RROP_UNDECLARE (void)piQxelOr; (void)spiQxelOr;
-#else
-#define RROP_DECLARE register CfbBits rrop_or;
-#define RROP_FETCH_GCPRIV(devPriv) rrop_or = (devPriv)->xor;
-#define RROP_SOLID(dst) (*(dst) |= (rrop_or))
-#define RROP_SOLID_MASK(dst,mask) (*(dst) |= ((rrop_or) & (mask)))
-#define RROP_UNDECLARE
-#endif
-#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,Or)
-#endif /* GXor */
-
-#if RROP == GXnoop
-#define RROP_DECLARE
-#define RROP_FETCH_GCPRIV(devPriv)
-#define RROP_SOLID(dst)
-#define RROP_SOLID_MASK(dst,mask)
-#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,Noop)
-#define RROP_UNDECLARE
-#endif /* GXnoop */
-
-#if RROP == GXset
-#if PSZ == 24
-#define RROP_DECLARE register CfbBits rrop_and, rrop_xor; \
- CfbBits piQxelAnd[3], piQxelXor[3], spiQxelAnd[6], spiQxelXor[6];
-#define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and; \
- rrop_xor = (devPriv)->xor; \
- spiQxelXor[0] = rrop_xor & 0xFFFFFF; \
- spiQxelXor[1] = rrop_xor << 24; \
- spiQxelXor[2] = rrop_xor << 16; \
- spiQxelXor[3] = rrop_xor << 8; \
- spiQxelXor[4] = (rrop_xor & 0xFFFF00)>> 8; \
- spiQxelXor[5] = (rrop_xor & 0xFF0000)>> 16; \
- spiQxelAnd[0] = (rrop_and & 0xFFFFFF) | 0xFF000000; \
- spiQxelAnd[1] = (rrop_and << 24) | 0xFFFFFF; \
- spiQxelAnd[2] = (rrop_and << 16) | 0xFFFF; \
- spiQxelAnd[3] = (rrop_and << 8) | 0xFF; \
- spiQxelAnd[4] = ((rrop_and & 0xFFFF00)>> 8) | 0xFFFF0000; \
- spiQxelAnd[5] = ((rrop_and & 0xFF0000)>> 16) | 0xFFFFFF00; \
- piQxelAnd[0] = (rrop_and & 0xFFFFFF)|(rrop_and << 24); \
- piQxelAnd[1] = (rrop_and << 16)|((rrop_and & 0xFFFF00)>> 8); \
- piQxelAnd[2] = (rrop_and << 8)|((rrop_and & 0xFF0000)>> 16); \
- piQxelXor[0] = (rrop_xor & 0xFFFFFF)|(rrop_xor << 24); \
- piQxelXor[1] = (rrop_xor << 16)|((rrop_xor & 0xFFFF00)>> 8); \
- piQxelXor[2] = (rrop_xor << 8)|((rrop_xor & 0xFF0000)>> 16);
-#define RROP_SOLID24(dst,index) {\
- switch((index) & 3){ \
- case 0: \
- *(dst) = ((*(dst) & (piQxelAnd[0] |0xFF000000))^(piQxelXor[0] & 0xFFFFFF)); \
- break; \
- case 3: \
- *(dst) = ((*(dst) & (piQxelAnd[2]|0xFF))^(piQxelXor[2] & 0xFFFFFF00)); \
- break; \
- case 1: \
- *(dst) = ((*(dst) & (piQxelAnd[0]|0xFFFFFF))^(piQxelXor[0] & 0xFF000000)); \
- *((dst)+1) = ((*((dst)+1) & (piQxelAnd[1]|0xFFFF0000))^(piQxelXor[1] & 0xFFFF)); \
- break; \
- case 2: \
- *(dst) = ((*(dst) & (piQxelAnd[1]|0xFFFF))^(piQxelXor[1] & 0xFFFF0000)); \
- *((dst)+1) = ((*((dst)+1) & (piQxelAnd[2]|0xFFFFFF00))^(piQxelXor[2] & 0xFF)); \
- break; \
- } \
- }
-#define RROP_SOLID(dst,idx) \
- (*(dst) = DoRRop (*(dst), piQxelAnd[(idx)], piQxelXor[(idx)]))
-#define RROP_SOLID_MASK(dst,mask,idx) \
- (*(dst) = DoMaskRRop (*(dst), piQxelAnd[(idx)], piQxelXor[(idx)], (mask)))
-#define RROP_UNDECLARE (void)piQxelAnd; (void)piQxelXor; \
- (void)spiQxelAnd; (void)spiQxelXor;
-#else
-#define RROP_DECLARE register CfbBits rrop_and, rrop_xor;
-#define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and; \
- rrop_xor = (devPriv)->xor;
-#define RROP_SOLID(dst) (*(dst) = DoRRop (*(dst), rrop_and, rrop_xor))
-#define RROP_SOLID_MASK(dst,mask) (*(dst) = DoMaskRRop (*(dst), rrop_and, rrop_xor, (mask)))
-#define RROP_UNDECLARE
-#endif
-#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,General)
-#endif /* GXset */
-
-#define RROP_UNROLL_CASE1(p,i) case (i): RROP_SOLID((p) - (i));
-#define RROP_UNROLL_CASE2(p,i) RROP_UNROLL_CASE1(p,(i)+1) RROP_UNROLL_CASE1(p,i)
-#define RROP_UNROLL_CASE4(p,i) RROP_UNROLL_CASE2(p,(i)+2) RROP_UNROLL_CASE2(p,i)
-#define RROP_UNROLL_CASE8(p,i) RROP_UNROLL_CASE4(p,(i)+4) RROP_UNROLL_CASE4(p,i)
-#define RROP_UNROLL_CASE16(p,i) RROP_UNROLL_CASE8(p,(i)+8) RROP_UNROLL_CASE8(p,i)
-#define RROP_UNROLL_CASE32(p,i) RROP_UNROLL_CASE16(p,(i)+16) RROP_UNROLL_CASE16(p,i)
-#define RROP_UNROLL_CASE3(p) RROP_UNROLL_CASE2(p,2) RROP_UNROLL_CASE1(p,1)
-#define RROP_UNROLL_CASE7(p) RROP_UNROLL_CASE4(p,4) RROP_UNROLL_CASE3(p)
-#define RROP_UNROLL_CASE15(p) RROP_UNROLL_CASE8(p,8) RROP_UNROLL_CASE7(p)
-#define RROP_UNROLL_CASE31(p) RROP_UNROLL_CASE16(p,16) RROP_UNROLL_CASE15(p)
-#ifdef LONG64
-#define RROP_UNROLL_CASE63(p) RROP_UNROLL_CASE32(p,32) RROP_UNROLL_CASE31(p)
-#endif /* LONG64 */
-
-#define RROP_UNROLL_LOOP1(p,i) RROP_SOLID((p) + (i));
-#define RROP_UNROLL_LOOP2(p,i) RROP_UNROLL_LOOP1(p,(i)) RROP_UNROLL_LOOP1(p,(i)+1)
-#define RROP_UNROLL_LOOP4(p,i) RROP_UNROLL_LOOP2(p,(i)) RROP_UNROLL_LOOP2(p,(i)+2)
-#define RROP_UNROLL_LOOP8(p,i) RROP_UNROLL_LOOP4(p,(i)) RROP_UNROLL_LOOP4(p,(i)+4)
-#define RROP_UNROLL_LOOP16(p,i) RROP_UNROLL_LOOP8(p,(i)) RROP_UNROLL_LOOP8(p,(i)+8)
-#define RROP_UNROLL_LOOP32(p,i) RROP_UNROLL_LOOP16(p,(i)) RROP_UNROLL_LOOP16(p,(i)+16)
-#ifdef LONG64
-#define RROP_UNROLL_LOOP64(p,i) RROP_UNROLL_LOOP32(p,(i)) RROP_UNROLL_LOOP32(p,(i)+32)
-#endif /* LONG64 */
-
-#if defined (FAST_CONSTANT_OFFSET_MODE) && defined (SHARED_IDCACHE) && (RROP == GXcopy)
-
-#ifdef LONG64
-#define RROP_UNROLL_SHIFT 6
-#define RROP_UNROLL_CASE(p) RROP_UNROLL_CASE63(p)
-#define RROP_UNROLL_LOOP(p) RROP_UNROLL_LOOP64(p,-64)
-#else /* not LONG64 */
-#define RROP_UNROLL_SHIFT 5
-#define RROP_UNROLL_CASE(p) RROP_UNROLL_CASE31(p)
-#define RROP_UNROLL_LOOP(p) RROP_UNROLL_LOOP32(p,-32)
-#endif /* LONG64 */
-#define RROP_UNROLL (1<<RROP_UNROLL_SHIFT)
-#define RROP_UNROLL_MASK (RROP_UNROLL-1)
-
-#define RROP_SPAN(pdst,nmiddle) {\
- int part = (nmiddle) & RROP_UNROLL_MASK; \
- (nmiddle) >>= RROP_UNROLL_SHIFT; \
- (pdst) += part * (sizeof (CfbBits) / sizeof (*pdst)); \
- switch (part) {\
- RROP_UNROLL_CASE((CfbBits *) (pdst)) \
- } \
- while (--(nmiddle) >= 0) { \
- (pdst) += RROP_UNROLL * (sizeof (CfbBits) / sizeof (*pdst)); \
- RROP_UNROLL_LOOP((CfbBits *) (pdst)) \
- } \
-}
-#else
-#define RROP_SPAN(pdst,nmiddle) \
- while (--(nmiddle) >= 0) { \
- RROP_SOLID((CfbBits *) (pdst)); \
- (pdst) += sizeof (CfbBits) / sizeof (*pdst); \
- }
-#endif
-
-#if !defined(UNIXCPP) || defined(ANSICPP)
-#define RROP_NAME_CAT(prefix,suffix) prefix##suffix
-#else
-#define RROP_NAME_CAT(prefix,suffix) prefix/**/suffix
-#endif
diff --git a/cfb/cfbscrinit.c b/cfb/cfbscrinit.c
deleted file mode 100644
index 6f9ba2e85..000000000
--- a/cfb/cfbscrinit.c
+++ /dev/null
@@ -1,223 +0,0 @@
-/************************************************************
-Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this
-software and its documentation for any purpose and without
-fee is hereby granted, provided that the above copyright no-
-tice appear in all copies and that both that copyright no-
-tice and this permission notice appear in supporting docu-
-mentation, and that the names of Sun or The Open Group
-not be used in advertising or publicity pertaining to
-distribution of the software without specific prior
-written permission. Sun and The Open Group make no
-representations about the suitability of this software for
-any purpose. It is provided "as is" without any express or
-implied warranty.
-
-SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
-NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
-ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
-PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
-OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
-THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-********************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include "servermd.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "resource.h"
-#include "colormap.h"
-#include "colormapst.h"
-#include "cfb.h"
-#include "mi.h"
-#include "mistruct.h"
-#include "dix.h"
-#include "cfbmskbits.h"
-#include "mibstore.h"
-
-Bool
-cfbCloseScreen (index, pScreen)
- int index;
- ScreenPtr pScreen;
-{
- int d;
- DepthPtr depths = pScreen->allowedDepths;
-
- for (d = 0; d < pScreen->numDepths; d++)
- xfree (depths[d].vids);
- xfree (depths);
- xfree (pScreen->visuals);
-#ifdef CFB_NEED_SCREEN_PRIVATE
- xfree (dixLookupPrivate(&pScreen->devPrivates, cfbScreenPrivateKey));
-#else
- xfree (pScreen->devPrivate);
-#endif
- return TRUE;
-}
-
-static void DestroyColormapNoop(
- ColormapPtr pColormap)
-{
- /* NOOP */
-}
-
-static void StoreColorsNoop(
- ColormapPtr pColormap,
- int ndef,
- xColorItem * pdef)
-{
- /* NOOP */
-}
-
-Bool
-cfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
- register ScreenPtr pScreen;
- pointer pbits; /* pointer to screen bitmap */
- int xsize, ysize; /* in pixels */
- int dpix, dpiy; /* dots per inch */
- int width; /* pixel width of frame buffer */
-{
- if (!cfbAllocatePrivates(pScreen, NULL))
- return FALSE;
- pScreen->defColormap = FakeClientID(0);
- /* let CreateDefColormap do whatever it wants for pixels */
- pScreen->blackPixel = pScreen->whitePixel = (Pixel) 0;
- pScreen->QueryBestSize = mfbQueryBestSizeWeak();
- /* SaveScreen */
- pScreen->GetImage = cfbGetImage;
- pScreen->GetSpans = cfbGetSpans;
- pScreen->CreateWindow = cfbCreateWindow;
- pScreen->DestroyWindow = cfbDestroyWindow;
- pScreen->PositionWindow = cfbPositionWindow;
- pScreen->ChangeWindowAttributes = cfbChangeWindowAttributes;
- pScreen->RealizeWindow = cfbMapWindow;
- pScreen->UnrealizeWindow = cfbUnmapWindow;
- pScreen->CopyWindow = cfbCopyWindow;
- pScreen->CreatePixmap = cfbCreatePixmap;
- pScreen->DestroyPixmap = cfbDestroyPixmap;
- pScreen->RealizeFont = mfbRealizeFontWeak();
- pScreen->UnrealizeFont = mfbUnrealizeFontWeak();
- pScreen->CreateGC = cfbCreateGC;
- pScreen->CreateColormap = cfbInitializeColormap;
- pScreen->DestroyColormap = DestroyColormapNoop;
- pScreen->InstallColormap = cfbInstallColormap;
- pScreen->UninstallColormap = cfbUninstallColormap;
- pScreen->ListInstalledColormaps = cfbListInstalledColormaps;
- pScreen->StoreColors = StoreColorsNoop;
- pScreen->ResolveColor = cfbResolveColor;
- pScreen->BitmapToRegion = mfbPixmapToRegionWeak();
-
- mfbRegisterCopyPlaneProc (pScreen, cfbCopyPlane);
- return TRUE;
-}
-
-#ifdef CFB_NEED_SCREEN_PRIVATE
-Bool
-cfbCreateScreenResources(pScreen)
- ScreenPtr pScreen;
-{
- Bool retval;
-
- pointer oldDevPrivate = pScreen->devPrivate;
- pScreen->devPrivate = dixLookupPrivate(&pScreen->devPrivates,
- cfbScreenPrivateKey);
- retval = miCreateScreenResources(pScreen);
- dixSetPrivate(&pScreen->devPrivates, cfbScreenPrivateKey,
- pScreen->devPrivate);
- pScreen->devPrivate = oldDevPrivate;
- return retval;
-}
-#endif
-
-Bool
-cfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
- register ScreenPtr pScreen;
- pointer pbits; /* pointer to screen bitmap */
- int xsize, ysize; /* in pixels */
- int dpix, dpiy; /* dots per inch */
- int width; /* pixel width of frame buffer */
-{
-#ifdef CFB_NEED_SCREEN_PRIVATE
- pointer oldDevPrivate;
-#endif
- VisualPtr visuals;
- DepthPtr depths;
- int nvisuals;
- int ndepths;
- int rootdepth;
- VisualID defaultVisual;
-
- rootdepth = 0;
- if (!cfbInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootdepth,
- &defaultVisual,((unsigned long)1<<(PSZ-1)), 8))
- return FALSE;
-#ifdef CFB_NEED_SCREEN_PRIVATE
- oldDevPrivate = pScreen->devPrivate;
-#endif
- if (! miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
- rootdepth, ndepths, depths,
- defaultVisual, nvisuals, visuals))
- return FALSE;
- /* overwrite miCloseScreen with our own */
- pScreen->CloseScreen = cfbCloseScreen;
-#ifdef CFB_NEED_SCREEN_PRIVATE
- pScreen->CreateScreenResources = cfbCreateScreenResources;
- dixSetPrivate(&pScreen->devPrivates, cfbScreenPrivateKey,
- pScreen->devPrivate);
- pScreen->devPrivate = oldDevPrivate;
-#endif
- pScreen->GetScreenPixmap = cfbGetScreenPixmap;
- pScreen->SetScreenPixmap = cfbSetScreenPixmap;
- return TRUE;
-}
-
-/* dts * (inch/dot) * (25.4 mm / inch) = mm */
-Bool
-cfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
- register ScreenPtr pScreen;
- pointer pbits; /* pointer to screen bitmap */
- int xsize, ysize; /* in pixels */
- int dpix, dpiy; /* dots per inch */
- int width; /* pixel width of frame buffer */
-{
- if (!cfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width))
- return FALSE;
- return cfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width);
-}
-
-PixmapPtr
-cfbGetScreenPixmap(pScreen)
- ScreenPtr pScreen;
-{
-#ifdef CFB_NEED_SCREEN_PRIVATE
- return (PixmapPtr)dixLookupPrivate(&pScreen->devPrivates,
- cfbScreenPrivateKey);
-#else
- return (PixmapPtr)pScreen->devPrivate;
-#endif
-}
-
-void
-cfbSetScreenPixmap(pPix)
- PixmapPtr pPix;
-{
-#ifdef CFB_NEED_SCREEN_PRIVATE
- if (pPix)
- dixSetPrivate(&pPix->drawable.pScreen->devPrivates,
- cfbScreenPrivateKey, pPix);
-#else
- if (pPix)
- pPix->drawable.pScreen->devPrivate = (pointer)pPix;
-#endif
-}
diff --git a/cfb/cfbsetsp.c b/cfb/cfbsetsp.c
deleted file mode 100644
index a000fd9e1..000000000
--- a/cfb/cfbsetsp.c
+++ /dev/null
@@ -1,316 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 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.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include "servermd.h"
-
-#include "misc.h"
-#include "regionstr.h"
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-
-#include "cfb.h"
-#include "cfbmskbits.h"
-#include <mergerop.h>
-
-/* cfbSetScanline -- copies the bits from psrc to the drawable starting at
- * (xStart, y) and continuing to (xEnd, y). xOrigin tells us where psrc
- * starts on the scanline. (I.e., if this scanline passes through multiple
- * boxes, we may not want to start grabbing bits at psrc but at some offset
- * further on.)
- */
-void
-cfbSetScanline(y, xOrigin, xStart, xEnd, psrc, alu, pdstBase, widthDst, planemask)
- int y;
- int xOrigin; /* where this scanline starts */
- int xStart; /* first bit to use from scanline */
- int xEnd; /* last bit to use from scanline + 1 */
- register unsigned int *psrc;
- register int alu; /* raster op */
- int *pdstBase; /* start of the drawable */
- int widthDst; /* width of drawable in words */
- unsigned long planemask;
-{
- int w; /* width of scanline in bits */
- register int *pdst; /* where to put the bits */
- register int tmpSrc; /* scratch buffer to collect bits in */
- int offSrc;
- int nl;
-#if PSZ == 24
- register char *psrcb, *pdstb;
- register int xIndex;
-#else
- int dstBit; /* offset in bits from beginning of
- * word */
- register int nstart; /* number of bits from first partial */
-#if PSZ != 32 || PPW != 1
- register int nend; /* " " last partial word */
-#endif
- int startmask, endmask, nlMiddle;
-#endif
- DeclareMergeRop()
-
- InitializeMergeRop(alu,planemask);
-#if PSZ == 24
- pdst = pdstBase + (y * widthDst);
- xIndex = xStart;
- pdstb = (char *)pdst + (xStart * 3);
- offSrc = xStart - xOrigin;
- psrcb = (char *)psrc + (offSrc * 3);
-#else
- pdst = pdstBase + (y * widthDst) + (xStart >> PWSH);
- psrc += (xStart - xOrigin) >> PWSH;
- offSrc = (xStart - xOrigin) & PIM;
-#endif
- w = xEnd - xStart;
-
-#if PSZ == 24
- nl = w;
- while (nl--){
- psrc = (unsigned int *)((unsigned long)psrcb & ~0x03);
- getbits24(psrc, tmpSrc, offSrc);
- pdst = (int *)((unsigned long)pdstb & ~0x03);
- DoMergeRop24(tmpSrc, pdst, xIndex);
- offSrc++;
- psrcb += 3;
- xIndex++;
- pdstb += 3;
- }
-#else /* PSZ == 24 */
- dstBit = xStart & PIM;
- if (dstBit + w <= PPW)
- {
- maskpartialbits(dstBit, w, startmask);
- endmask = 0;
- nlMiddle = 0;
- }
- else
- {
- maskbits(xStart, w, startmask, endmask, nlMiddle);
- }
- if (startmask)
- nstart = PPW - dstBit;
- else
- nstart = 0;
-#if PSZ != 32 || PPW != 1
- if (endmask)
- nend = xEnd & PIM;
- else
- nend = 0;
-#endif
- if (startmask)
- {
- getbits(psrc, offSrc, nstart, tmpSrc);
- putbitsmropshort(tmpSrc, dstBit, nstart, pdst);
- pdst++;
- offSrc += nstart;
- if (offSrc > PLST)
- {
- psrc++;
- offSrc -= PPW;
- }
- }
- nl = nlMiddle;
- while (nl--)
- {
- getbits(psrc, offSrc, PPW, tmpSrc);
- *pdst = DoMergeRop(tmpSrc, *pdst);
- pdst++;
- psrc++;
- }
- if (endmask)
- {
- getbits(psrc, offSrc, nend, tmpSrc);
- putbitsmropshort(tmpSrc, 0, nend, pdst);
- }
-#endif /* PSZ == 24 */
-}
-
-
-
-/* SetSpans -- for each span copy pwidth[i] bits from psrc to pDrawable at
- * ppt[i] using the raster op from the GC. If fSorted is TRUE, the scanlines
- * are in increasing Y order.
- * Source bit lines are server scanline padded so that they always begin
- * on a word boundary.
- */
-void
-cfbSetSpans(pDrawable, pGC, pcharsrc, ppt, pwidth, nspans, fSorted)
- DrawablePtr pDrawable;
- GCPtr pGC;
- char *pcharsrc;
- register DDXPointPtr ppt;
- int *pwidth;
- int nspans;
- int fSorted;
-{
- unsigned int *psrc = (unsigned int *)pcharsrc;
- CfbBits *pdstBase; /* start of dst bitmap */
- int widthDst; /* width of bitmap in words */
- register BoxPtr pbox, pboxLast, pboxTest;
- register DDXPointPtr pptLast;
- int alu;
- RegionPtr prgnDst;
- int xStart, xEnd;
- int yMax;
-
- alu = pGC->alu;
- prgnDst = cfbGetCompositeClip(pGC);
- pptLast = ppt + nspans;
-
- cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase)
-
- yMax = (int) pDrawable->y + (int) pDrawable->height;
-
- pbox = REGION_RECTS(prgnDst);
- pboxLast = pbox + REGION_NUM_RECTS(prgnDst);
-
- if(fSorted)
- {
- /* scan lines sorted in ascending order. Because they are sorted, we
- * don't have to check each scanline against each clip box. We can be
- * sure that this scanline only has to be clipped to boxes at or after the
- * beginning of this y-band
- */
- pboxTest = pbox;
- while(ppt < pptLast)
- {
- pbox = pboxTest;
- if(ppt->y >= yMax)
- break;
- while(pbox < pboxLast)
- {
- if(pbox->y1 > ppt->y)
- {
- /* scanline is before clip box */
- break;
- }
- else if(pbox->y2 <= ppt->y)
- {
- /* clip box is before scanline */
- pboxTest = ++pbox;
- continue;
- }
- else if(pbox->x1 > ppt->x + *pwidth)
- {
- /* clip box is to right of scanline */
- break;
- }
- else if(pbox->x2 <= ppt->x)
- {
- /* scanline is to right of clip box */
- pbox++;
- continue;
- }
-
- /* at least some of the scanline is in the current clip box */
- xStart = max(pbox->x1, ppt->x);
- xEnd = min(ppt->x + *pwidth, pbox->x2);
- cfbSetScanline(ppt->y, ppt->x, xStart, xEnd, psrc, alu,
- (int *)pdstBase, widthDst, pGC->planemask);
- if(ppt->x + *pwidth <= pbox->x2)
- {
- /* End of the line, as it were */
- break;
- }
- else
- pbox++;
- }
- /* We've tried this line against every box; it must be outside them
- * all. move on to the next point */
- ppt++;
- psrc += PixmapWidthInPadUnits(*pwidth, pDrawable->depth);
- pwidth++;
- }
- }
- else
- {
- /* scan lines not sorted. We must clip each line against all the boxes */
- while(ppt < pptLast)
- {
- if(ppt->y >= 0 && ppt->y < yMax)
- {
-
- for(pbox = REGION_RECTS(prgnDst); pbox< pboxLast; pbox++)
- {
- if(pbox->y1 > ppt->y)
- {
- /* rest of clip region is above this scanline,
- * skip it */
- break;
- }
- if(pbox->y2 <= ppt->y)
- {
- /* clip box is below scanline */
- pbox++;
- break;
- }
- if(pbox->x1 <= ppt->x + *pwidth &&
- pbox->x2 > ppt->x)
- {
- xStart = max(pbox->x1, ppt->x);
- xEnd = min(pbox->x2, ppt->x + *pwidth);
- cfbSetScanline(ppt->y, ppt->x, xStart, xEnd, psrc, alu,
- (int *)pdstBase, widthDst, pGC->planemask);
- }
-
- }
- }
- psrc += PixmapWidthInPadUnits(*pwidth, pDrawable->depth);
- ppt++;
- pwidth++;
- }
- }
-}
-
diff --git a/cfb/cfbsolid.c b/cfb/cfbsolid.c
deleted file mode 100644
index 6b8238dd9..000000000
--- a/cfb/cfbsolid.c
+++ /dev/null
@@ -1,1365 +0,0 @@
-/*
- *
-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
- */
-
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include "servermd.h"
-#include "gcstruct.h"
-#include "window.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-#include "windowstr.h"
-
-#include "cfb.h"
-#include "cfbmskbits.h"
-#include "cfbrrop.h"
-
-#include "mi.h"
-#include "mispans.h"
-
-#if defined(FAST_CONSTANT_OFFSET_MODE) && (RROP != GXcopy)
-# define Expand(left,right,leftAdjust) {\
- int part = nmiddle & 3; \
- int widthStep; \
- widthStep = widthDst - nmiddle - leftAdjust; \
- nmiddle >>= 2; \
- pdst = pdstRect; \
- while (h--) { \
- left \
- pdst += part; \
- switch (part) { \
- RROP_UNROLL_CASE3(pdst) \
- } \
- m = nmiddle; \
- while (m) { \
- pdst += 4; \
- RROP_UNROLL_LOOP4(pdst,-4) \
- m--; \
- } \
- right \
- pdst += widthStep; \
- } \
-}
-#else
-# ifdef RROP_UNROLL
-# define Expand(left,right,leftAdjust) {\
- int part = nmiddle & RROP_UNROLL_MASK; \
- int widthStep; \
- widthStep = widthDst - nmiddle - leftAdjust; \
- nmiddle >>= RROP_UNROLL_SHIFT; \
- pdst = pdstRect; \
- while (h--) { \
- left \
- pdst += part; \
- switch (part) { \
- RROP_UNROLL_CASE(pdst) \
- } \
- m = nmiddle; \
- while (m) { \
- pdst += RROP_UNROLL; \
- RROP_UNROLL_LOOP(pdst) \
- m--; \
- } \
- right \
- pdst += widthStep; \
- } \
-}
-
-# else
-# define Expand(left, right, leftAdjust) { \
- while (h--) { \
- pdst = pdstRect; \
- left \
- m = nmiddle; \
- while (m--) {\
- RROP_SOLID(pdst); \
- pdst++; \
- } \
- right \
- pdstRect += widthDst; \
- } \
-}
-# endif
-#endif
-
-
-void
-RROP_NAME(cfbFillRectSolid) (pDrawable, pGC, nBox, pBox)
- DrawablePtr pDrawable;
- GCPtr pGC;
- int nBox;
- BoxPtr pBox;
-{
- register int m;
- register CfbBits *pdst;
- RROP_DECLARE
- CfbBits *pdstBase, *pdstRect;
- int nmiddle;
- int h;
- int w;
- int widthDst;
-#if PSZ == 24
- int leftIndex, rightIndex;
-#else
- register CfbBits leftMask, rightMask;
-#endif
-
- cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase)
-
- RROP_FETCH_GC(pGC)
-
- for (; nBox; nBox--, pBox++)
- {
- pdstRect = pdstBase + pBox->y1 * widthDst;
- h = pBox->y2 - pBox->y1;
- w = pBox->x2 - pBox->x1;
-#if PSZ == 8
- if (w == 1)
- {
- register char *pdstb = ((char *) pdstRect) + pBox->x1;
- int incr = widthDst * PGSZB;
-
- while (h--)
- {
- RROP_SOLID (pdstb);
- pdstb += incr;
- }
- }
- else
- {
-#endif
-#if PSZ == 24
- leftIndex = pBox->x1 &3;
-/* rightIndex = ((leftIndex+w)<5)?0:pBox->x2 &3;*/
- rightIndex = pBox->x2 &3;
-
- nmiddle = w - rightIndex;
- if(leftIndex){
- nmiddle -= (4 - leftIndex);
- }
- nmiddle >>= 2;
- if(nmiddle < 0)
- nmiddle = 0;
-
- pdstRect += (pBox->x1 * 3) >> 2;
- pdst = pdstRect;
- switch(leftIndex+w){
- case 4:
- switch(leftIndex){
- case 0:
- while(h--){
-#if RROP == GXcopy
- *pdst++ = piQxelXor[0];
- *pdst++ = piQxelXor[1];
- *pdst-- = piQxelXor[2];
-#endif
-#if RROP == GXxor
- *pdst++ ^= piQxelXor[0];
- *pdst++ ^= piQxelXor[1];
- *pdst-- ^= piQxelXor[2];
-#endif
-#if RROP == GXand
- *pdst++ &= piQxelAnd[0];
- *pdst++ &= piQxelAnd[1];
- *pdst-- &= piQxelAnd[2];
-#endif
-#if RROP == GXor
- *pdst++ |= piQxelOr[0];
- *pdst++ |= piQxelOr[1];
- *pdst-- |= piQxelOr[2];
-#endif
-#if RROP == GXset
- *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
- pdst++;
- *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
- pdst++;
- *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
- pdst--;
-#endif
- pdst--;
- pdst += widthDst;
- }
- break;
- case 1:
- while(h--){
-#if RROP == GXcopy
- *pdst = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
- pdst++;
- *pdst++ = piQxelXor[1];
- *pdst-- = piQxelXor[2];
-#endif
-#if RROP == GXxor
- *pdst++ ^= (piQxelXor[0] & 0xFF000000);
- *pdst++ ^= piQxelXor[1];
- *pdst-- ^= piQxelXor[2];
-#endif
-#if RROP == GXand
- *pdst++ &= (piQxelAnd[0] | 0x00FFFFFF);
- *pdst++ &= piQxelAnd[1];
- *pdst-- &= piQxelAnd[2];
-#endif
-#if RROP == GXor
- *pdst++ |= (piQxelOr[0] & 0xFF000000);
- *pdst++ |= piQxelOr[1];
- *pdst-- |= piQxelOr[2];
-#endif
-#if RROP == GXset
- *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000);
- pdst++;
- *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
- pdst++;
- *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
- pdst--;
-#endif
- pdst--;
- pdst += widthDst;
- }
- break;
- case 2:
- while(h--){
-#if RROP == GXcopy
- *pdst = ((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000);
- pdst++;
- *pdst-- = piQxelXor[2];
-#endif
-#if RROP == GXxor
- *pdst++ ^= (piQxelXor[1] & 0xFFFF0000);
- *pdst-- ^= piQxelXor[2];
-#endif
-#if RROP == GXand
- *pdst++ &= (piQxelAnd[1] | 0xFFFF);
- *pdst-- &= piQxelAnd[2];
-#endif
-#if RROP == GXor
- *pdst++ |= (piQxelOr[1] & 0xFFFF0000);
- *pdst-- |= piQxelOr[2];
-#endif
-#if RROP == GXset
- *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000);
- pdst++;
- *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
- pdst--;
-#endif
- pdst += widthDst;
- }
- break;
- case 3:
- while(h--){
-#if RROP == GXcopy
- *pdst = ((*pdst) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00);
-#endif
-#if RROP == GXxor
- *pdst ^= (piQxelXor[2] & 0xFFFFFF00);
-#endif
-#if RROP == GXand
- *pdst &= (piQxelAnd[2] | 0xFF);
-#endif
-#if RROP == GXor
- *pdst |= (piQxelOr[2] & 0xFFFFFF00);
-#endif
-#if RROP == GXset
- *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFFFFFF00);
-#endif
- pdst += widthDst;
- }
- break;
- }
- break;
- case 3:
- switch(leftIndex){
- case 0:
- while(h--){
-#if RROP == GXcopy
- *pdst++ = piQxelXor[0];
- *pdst++ = piQxelXor[1];
- *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
- pdst--;
-#endif
-#if RROP == GXxor
- *pdst++ ^= piQxelXor[0];
- *pdst++ ^= piQxelXor[1];
- *pdst-- ^= (piQxelXor[2] & 0xFF);
-#endif
-#if RROP == GXand
- *pdst++ &= piQxelAnd[0];
- *pdst++ &= piQxelAnd[1];
- *pdst-- &= (piQxeAnd[2] | 0xFFFFFF00);
-#endif
-#if RROP == GXor
- *pdst++ |= piQxelOr[0];
- *pdst++ |= piQxelOr[1];
- *pdst-- |= (piQxelOr[2] & 0xFF);
-#endif
-#if RROP == GXset
- *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
- pdst++;
- *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
- pdst++;
- *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF);
- pdst--;
-#endif
- pdst--;
- pdst += widthDst;
- }
- break;
- case 1:
- while(h--){
-#if RROP == GXcopy
- *pdst = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
- pdst++;
- *pdst++ = piQxelXor[1];
- *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
- pdst--;
-#endif
-#if RROP == GXxor
- *pdst++ ^= (piQxelXor[0] & 0xFF000000);
- *pdst++ ^= piQxelXor[1];
- *pdst-- ^= (piQxelXor[2] & 0xFF);
-#endif
-#if RROP == GXand
- *pdst++ &= (piQxelAnd[0] | 0x00FFFFFF);
- *pdst++ &= piQxelAnd[1];
- *pdst-- &= (piQxelAnd[2] | 0xFFFFFF00);
-#endif
-#if RROP == GXor
- *pdst++ |= (piQxelOr[0] & 0xFF000000);
- *pdst++ |= piQxelOr[1];
- *pdst-- |= (piQxelOr[2] & 0xFF);
-#endif
-#if RROP == GXset
- *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000);
- pdst++;
- *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
- pdst++;
- *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF);
- pdst--;
-#endif
- pdst--;
- pdst += widthDst;
- }
- break;
- case 2:
- while(h--){
-#if RROP == GXcopy
- *pdst = ((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000);
- pdst++;
- *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
- pdst--;
-#endif
-#if RROP == GXxor
- *pdst++ ^= (piQxelXor[1] & 0xFFFF0000);
- *pdst-- ^= (piQxelXor[2] & 0xFF);
-#endif
-#if RROP == GXand
- *pdst++ &= (piQxelAnd[1] | 0xFFFF);
- *pdst-- &= (piQxelAnd[2] | 0xFFFFFF00);
-#endif
-#if RROP == GXor
- *pdst++ |= (piQxelOr[1] & 0xFFFF0000);
- *pdst-- |= (piQxelOr[2] & 0xFF);
-#endif
-#if RROP == GXset
- *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000);
- pdst++;
- *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF);
- pdst--;
-#endif
- pdst += widthDst;
- }
- break;
- case 3:
- while(h--){
-#if RROP == GXcopy
- *pdst = ((*pdst) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00);
-#endif
-#if RROP == GXxor
- *pdst ^= (piQxelXor[2] & 0xFFFFFF00);
-#endif
-#if RROP == GXand
- *pdst &= (piQxelAnd[2] | 0xFF);
-#endif
-#if RROP == GXor
- *pdst |= (piQxelOr[2] & 0xFFFFFF00);
-#endif
-#if RROP == GXset
- *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFFFFFF00);
-#endif
- pdst += widthDst;
- }
- break;
- }
- break;
- case 2: /* leftIndex + w = 2*/
- switch(leftIndex){
- case 2:
- while(h--){
-#if RROP == GXcopy
- *pdst = ((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000);
- pdst++;
- *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
- pdst--;
-#endif
-#if RROP == GXxor
- *pdst++ ^= (piQxelXor[1] & 0xFFFF0000);
- *pdst-- ^= (piQxelXor[2] & 0xFF);
-#endif
-#if RROP == GXand
- *pdst++ &= (piQxelAnd[1] | 0xFFFF0000);
- *pdst-- &= (piQxelAnd[2] | 0xFF);
-#endif
-#if RROP == GXor
- *pdst++ |= (piQxelOr[1] & 0xFFFF0000);
- *pdst-- |= (piQxelOr[2] & 0xFF);
-#endif
-#if RROP == GXset
- *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000);
- pdst++;
- *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF);
- pdst--;
-#endif
- pdst += widthDst;
- }
- break;
- case 1:
- while(h--){
-#if RROP == GXcopy
- *pdst = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
- pdst++;
- *pdst = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF);
- pdst--;
-#endif
-#if RROP == GXxor
- *pdst++ ^= (piQxelXor[0] & 0xFF000000);
- *pdst-- ^= (piQxelXor[1] & 0xFFFF);
-#endif
-#if RROP == GXand
- *pdst++ &= (piQxelAnd[0] | 0xFFFFFF);
- *pdst-- &= (piQxelAnd[1] | 0xFFFF0000);
-#endif
-#if RROP == GXor
- *pdst++ |= (piQxelOr[0] & 0xFF000000);
- *pdst-- |= (piQxelOr[1] & 0xFFFF);
-#endif
-#if RROP == GXset
- *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000);
- pdst++;
- *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF);
- pdst--;
-#endif
- pdst += widthDst;
- }
- break;
- case 0: /*case 2 leftIndex == 0 */
- while(h--){
-#if RROP == GXcopy
- *pdst++ = piQxelXor[0];
- *pdst = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF);
- pdst--;
-#endif
-#if RROP == GXxor
- *pdst++ ^= piQxelXor[0];
- *pdst-- ^= (piQxelXor[1] & 0xFFFF);
-#endif
-#if RROP == GXand
- *pdst++ &= piQxelAnd[0];
- *pdst-- &= (piQxelAnd[1] | 0xFFFF0000);
-#endif
-#if RROP == GXor
- *pdst++ |= piQxelOr[0];
- *pdst-- |= (piQxelOr[1] & 0xFFFF);
-#endif
-#if RROP == GXset
- *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
- pdst++;
- *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF);
- pdst--;
-#endif
- pdst += widthDst;
- }
- break;
- }
- break;
- case 1: /*only if leftIndex = 0 and w = 1*/
- while(h--){
-#if RROP == GXcopy
- *pdst = ((*pdst) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF);
-#endif
-#if RROP == GXxor
- *pdst ^= (piQxelXor[0] & 0xFFFFFF);
-#endif
-#if RROP == GXand
- *pdst &= (piQxelAnd[0] | 0xFF000000);
-#endif
-#if RROP == GXor
- *pdst |= (piQxelOr[0] & 0xFFFFFF);
-#endif
-#if RROP == GXset
- *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFFFFFF);
-#endif
- pdst += widthDst;
- }
- break;
- case 0: /*never*/
- break;
- default:
- {
- while(h--){
- pdst = pdstRect;
- switch(leftIndex){
- case 0:
- break;
- case 1:
-#if RROP == GXcopy
- *pdst = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
- pdst++;
- *pdst++ = piQxelXor[1];
- *pdst++ = piQxelXor[2];
-#endif
-#if RROP == GXxor
- *pdst++ ^= (piQxelXor[0] & 0xFF000000);
- *pdst++ ^= piQxelXor[1];
- *pdst++ ^= piQxelXor[2];
-#endif
-#if RROP == GXand
- *pdst++ &= (piQxelAnd[0] | 0xFFFFFF);
- *pdst++ &= piQxelAnd[1];
- *pdst++ &= piQxelAnd[2];
-#endif
-#if RROP == GXor
- *pdst++ |= (piQxelOr[0] & 0xFF000000);
- *pdst++ |= piQxelOr[1];
- *pdst++ |= piQxelOr[2];
-#endif
-#if RROP == GXset
- *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000);
- pdst++;
- *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
- pdst++;
- *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
- pdst++;
-#endif
- break;
- case 2:
-#if RROP == GXcopy
- *pdst = (((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000));
- pdst++;
- *pdst++ = piQxelXor[2];
-#endif
-#if RROP == GXxor
- *pdst++ ^=(piQxelXor[1] & 0xFFFF0000);
- *pdst++ ^= piQxelXor[2];
-#endif
-#if RROP == GXand
- *pdst++ &= (piQxelAnd[1] | 0xFFFF);
- *pdst++ &= piQxelAnd[2];
-#endif
-#if RROP == GXor
- *pdst++ |= (piQxelOr[1] & 0xFFFF0000);
- *pdst++ |= piQxelOr[2];
-#endif
-#if RROP == GXset
- *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000);
- pdst++;
- *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
- pdst++;
-#endif
- break;
- case 3:
-#if RROP == GXcopy
- *pdst = ((*pdst) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00);
- pdst++;
-#endif
-#if RROP == GXxor
- *pdst++ ^= (piQxelXor[2] & 0xFFFFFF00);
-#endif
-#if RROP == GXand
- *pdst++ &= (piQxelAnd[2] | 0xFF);
-#endif
-#if RROP == GXor
- *pdst++ |= (piQxelOr[2] & 0xFFFFFF00);
-#endif
-#if RROP == GXset
- *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFFFFFF00);
- pdst++;
-#endif
- break;
- }
- m = nmiddle;
- while(m--){
-#if RROP == GXcopy
- *pdst++ = piQxelXor[0];
- *pdst++ = piQxelXor[1];
- *pdst++ = piQxelXor[2];
-#endif
-#if RROP == GXxor
- *pdst++ ^= piQxelXor[0];
- *pdst++ ^= piQxelXor[1];
- *pdst++ ^= piQxelXor[2];
-#endif
-#if RROP == GXand
- *pdst++ &= piQxelAnd[0];
- *pdst++ &= piQxelAnd[1];
- *pdst++ &= piQxelAnd[2];
-#endif
-#if RROP == GXor
- *pdst++ |= piQxelOr[0];
- *pdst++ |= piQxelOr[1];
- *pdst++ |= piQxelOr[2];
-#endif
-#if RROP == GXset
- *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
- pdst++;
- *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
- pdst++;
- *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
- pdst++;
-#endif
- }
- switch(rightIndex){
- case 0:
- break;
- case 1:
-#if RROP == GXcopy
- *pdst = ((*pdst) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF);
- pdst++;
-#endif
-#if RROP == GXxor
- *pdst++ ^= (piQxelXor[0] & 0xFFFFFF);
-#endif
-#if RROP == GXand
- *pdst++ &= (piQxelAnd[0] | 0xFF);
-#endif
-#if RROP == GXor
- *pdst++ |= (piQxelOr[0] & 0xFFFFFF);
-#endif
-#if RROP == GXset
- *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFFFFFF);
- pdst++;
-#endif
- break;
- case 2:
-#if RROP == GXcopy
- *pdst++ = piQxelXor[0];
- *pdst = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF);
- pdst++;
-#endif
-#if RROP == GXxor
- *pdst++ ^= piQxelXor[0];
- *pdst++ ^= (piQxelXor[1] & 0xFFFF);
-#endif
-#if RROP == GXand
- *pdst++ &= piQxelAnd[0];
- *pdst++ &= (piQxelAnd[1] | 0xFFFF0000);
-#endif
-#if RROP == GXor
- *pdst++ |= piQxelOr[0];
- *pdst++ |= (piQxelOr[1] & 0xFFFF);
-#endif
-#if RROP == GXset
- *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
- pdst++;
- *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF);
- pdst++;
-#endif
- break;
- case 3:
-#if RROP == GXcopy
- *pdst++ = piQxelXor[0];
- *pdst++ = piQxelXor[1];
- *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
- pdst++;
-#endif
-#if RROP == GXxor
- *pdst++ ^= piQxelXor[0];
- *pdst++ ^= piQxelXor[1];
- *pdst++ ^= (piQxelXor[2] & 0xFF);
-#endif
-#if RROP == GXand
- *pdst++ &= piQxelAnd[0];
- *pdst++ &= piQxelAnd[1];
- *pdst++ &= (piQxelAnd[2] | 0xFFFFFF00);
-#endif
-#if RROP == GXor
- *pdst++ |= piQxelOr[0];
- *pdst++ |= piQxelOr[1];
- *pdst++ |= (piQxelOr[2] & 0xFF);
-#endif
-#if RROP == GXset
- *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
- pdst++;
- *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
- pdst++;
- *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF);
- pdst++;
-#endif
- break;
- }
- pdstRect += widthDst;
- }
- }
- }
-#else /* PSZ != 24 */
- pdstRect += (pBox->x1 >> PWSH);
- if ((pBox->x1 & PIM) + w <= PPW)
- {
- maskpartialbits(pBox->x1, w, leftMask);
- pdst = pdstRect;
- while (h--) {
- RROP_SOLID_MASK (pdst, leftMask);
- pdst += widthDst;
- }
- }
- else
- {
- maskbits (pBox->x1, w, leftMask, rightMask, nmiddle);
- if (leftMask)
- {
- if (rightMask) /* left mask and right mask */
- {
- Expand(RROP_SOLID_MASK (pdst, leftMask); pdst++;,
- RROP_SOLID_MASK (pdst, rightMask);, 1)
- }
- else /* left mask and no right mask */
- {
- Expand(RROP_SOLID_MASK (pdst, leftMask); pdst++;,
- ;, 1)
- }
- }
- else
- {
- if (rightMask) /* no left mask and right mask */
- {
- Expand(;,
- RROP_SOLID_MASK (pdst, rightMask);, 0)
- }
- else /* no left mask and no right mask */
- {
- Expand(;,
- ;, 0)
- }
- }
- }
-#endif
-#if PSZ == 8
- }
-#endif
- }
- RROP_UNDECLARE
-}
-
-void
-RROP_NAME(cfbSolidSpans) (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
- DrawablePtr pDrawable;
- GCPtr pGC;
- int nInit; /* number of spans to fill */
- DDXPointPtr pptInit; /* pointer to list of start points */
- int *pwidthInit; /* pointer to list of n widths */
- int fSorted;
-{
- CfbBits *pdstBase;
- int widthDst;
-
- RROP_DECLARE
-
- register CfbBits *pdst;
- register int nlmiddle;
- register int w;
- int x;
-
- /* next three parameters are post-clip */
- int n; /* number of spans to fill */
- DDXPointPtr ppt; /* pointer to list of start points */
- int *pwidthFree;/* copies of the pointers to free */
- DDXPointPtr pptFree;
- int *pwidth;
- cfbPrivGCPtr devPriv;
-#if PSZ == 24
- int leftIndex, rightIndex;
-#else
- register CfbBits startmask, endmask;
-#endif
-
- devPriv = cfbGetGCPrivate(pGC);
- RROP_FETCH_GCPRIV(devPriv)
- n = nInit * miFindMaxBand(pGC->pCompositeClip);
- pwidthFree = (int *)xalloc(n * sizeof(int));
- pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
- if(!pptFree || !pwidthFree)
- {
- if (pptFree) xfree(pptFree);
- if (pwidthFree) xfree(pwidthFree);
- return;
- }
- pwidth = pwidthFree;
- ppt = pptFree;
- n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit,
- ppt, pwidth, fSorted);
-
- cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase)
-
- while (n--)
- {
- x = ppt->x;
- pdst = pdstBase + (ppt->y * widthDst);
- ++ppt;
- w = *pwidth++;
- if (!w)
- continue;
-#if PSZ == 24
- leftIndex = x &3;
-/* rightIndex = ((leftIndex+w)<5)?0:(x+w)&3;*/
- rightIndex = (x+w)&3;
-
- nlmiddle = w - rightIndex;
- if(leftIndex){
- nlmiddle -= (4 - leftIndex);
- }
-/* nlmiddle += 3;*/
- nlmiddle >>= 2;
- if(nlmiddle < 0)
- nlmiddle = 0;
-
- pdst += (x >> 2)*3;
- pdst += leftIndex? (leftIndex -1):0;
- switch(leftIndex+w){
- case 4:
- switch(leftIndex){
- case 0:
-#if RROP == GXcopy
- *pdst++ = piQxelXor[0];
- *pdst++ = piQxelXor[1];
- *pdst-- = piQxelXor[2];
-#endif
-#if RROP == GXxor
- *pdst++ ^= piQxelXor[0];
- *pdst++ ^= piQxelXor[1];
- *pdst-- ^= piQxelXor[2];
-#endif
-#if RROP == GXand
- *pdst++ &= piQxelAnd[0];
- *pdst++ &= piQxelAnd[1];
- *pdst-- &= piQxelAnd[2];
-#endif
-#if RROP == GXor
- *pdst++ |= piQxelOr[0];
- *pdst++ |= piQxelOr[1];
- *pdst-- |= piQxelOr[2];
-#endif
-#if RROP == GXset
- *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
- pdst++;
- *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
- pdst++;
- *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
- pdst--;
-#endif
- pdst--;
- break;
- case 1:
-#if RROP == GXcopy
- *pdst = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
- pdst++;
- *pdst++ = piQxelXor[1];
- *pdst-- = piQxelXor[2];
-#endif
-#if RROP == GXxor
- *pdst++ ^= (piQxelXor[0] & 0xFF000000);
- *pdst++ ^= piQxelXor[1];
- *pdst-- ^= piQxelXor[2];
-#endif
-#if RROP == GXand
- *pdst++ &= (piQxelAnd[0] | 0x00FFFFFF);
- *pdst++ &= piQxelAnd[1];
- *pdst-- &= piQxelAnd[2];
-#endif
-#if RROP == GXor
- *pdst++ |= (piQxelOr[0] & 0xFF000000);
- *pdst++ |= piQxelOr[1];
- *pdst-- |= piQxelOr[2];
-#endif
-#if RROP == GXset
- *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000);
- pdst++;
- *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
- pdst++;
- *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
- pdst--;
-#endif
- pdst--;
- break;
- case 2:
-#if RROP == GXcopy
- *pdst = ((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000);
- pdst++;
- *pdst-- = piQxelXor[2];
-#endif
-#if RROP == GXxor
- *pdst++ ^= (piQxelXor[1] & 0xFFFF0000);
- *pdst-- ^= piQxelXor[2];
-#endif
-#if RROP == GXand
- *pdst++ &= (piQxelAnd[1] | 0xFFFF);
- *pdst-- &= piQxelAnd[2];
-#endif
-#if RROP == GXor
- *pdst++ |= (piQxelOr[1] & 0xFFFF0000);
- *pdst-- |= piQxelOr[2];
-#endif
-#if RROP == GXset
- *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000);
- pdst++;
- *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
- pdst--;
-#endif
- break;
- case 3:
-#if RROP == GXcopy
- *pdst = ((*pdst) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00);
-#endif
-#if RROP == GXxor
- *pdst ^= (piQxelXor[2] & 0xFFFFFF00);
-#endif
-#if RROP == GXand
- *pdst &= (piQxelAnd[2] | 0xFF);
-#endif
-#if RROP == GXor
- *pdst |= (piQxelOr[2] & 0xFFFFFF00);
-#endif
-#if RROP == GXset
- *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFFFFFF00);
-#endif
- break;
- }
- break;
- case 3:
- switch(leftIndex){
- case 0:
-#if RROP == GXcopy
- *pdst++ = piQxelXor[0];
- *pdst++ = piQxelXor[1];
- *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
- pdst--;
-#endif
-#if RROP == GXxor
- *pdst++ ^= piQxelXor[0];
- *pdst++ ^= piQxelXor[1];
- *pdst-- ^= (piQxelXor[2] & 0xFF);
-#endif
-#if RROP == GXand
- *pdst++ &= piQxelAnd[0];
- *pdst++ &= piQxelAnd[1];
- *pdst-- &= (piQxelAnd[2] | 0xFFFFFF00);
-#endif
-#if RROP == GXor
- *pdst++ |= piQxelOr[0];
- *pdst++ |= piQxelOr[1];
-
- *pdst-- |= (piQxelOr[2] & 0xFF);
-#endif
-#if RROP == GXset
- *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
- pdst++;
- *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
- pdst++;
- *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF);
- pdst--;
-#endif
- pdst--;
- break;
- case 1:
-#if RROP == GXcopy
- *pdst = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
- pdst++;
- *pdst++ = piQxelXor[1];
- *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
- pdst--;
-#endif
-#if RROP == GXxor
- *pdst++ ^= (piQxelXor[0] & 0xFF000000);
- *pdst++ ^= piQxelXor[1];
- *pdst-- ^= (piQxelXor[2] & 0xFF);
-#endif
-#if RROP == GXand
- *pdst++ &= (piQxelAnd[0] | 0x00FFFFFF);
- *pdst++ &= piQxelAnd[1];
- *pdst-- &= (piQxelAnd[2] | 0xFFFFFF00);
-#endif
-#if RROP == GXor
- *pdst++ |= (piQxelOr[0] & 0xFF000000);
- *pdst++ |= piQxelOr[1];
- *pdst-- |= (piQxelOr[2] & 0xFF);
-#endif
-#if RROP == GXset
- *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000);
- pdst++;
- *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
- pdst++;
- *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF);
- pdst--;
-#endif
- pdst--;
- break;
- case 2:
-/* pdst++;*/
-#if RROP == GXcopy
- *pdst = ((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000);
- pdst++;
- *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
- pdst--;
-#endif
-#if RROP == GXxor
- *pdst++ ^= (piQxelXor[1] & 0xFFFF0000);
- *pdst-- ^= (piQxelXor[2] & 0xFF);
-#endif
-#if RROP == GXand
- *pdst++ &= (piQxelAnd[1] | 0xFFFF);
- *pdst-- &= (piQxelAnd[2] | 0xFFFFFF00);
-#endif
-#if RROP == GXor
- *pdst++ |= (piQxelOr[1] & 0xFFFF0000);
- *pdst-- |= (piQxelOr[2] & 0xFF);
-#endif
-#if RROP == GXset
- *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000);
- pdst++;
- *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF);
- pdst--;
-#endif
- break;
- }
- break;
- case 2: /* leftIndex + w = 2*/
- if(leftIndex){
-#if RROP == GXcopy
- *pdst = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
- pdst++;
- *pdst = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF);
- pdst--;
-#endif
-#if RROP == GXxor
- *pdst++ ^= (piQxelXor[0] & 0xFF000000);
- *pdst-- ^= (piQxelXor[1] & 0xFFFF);
-#endif
-#if RROP == GXand
- *pdst++ &= (piQxelAnd[0] | 0xFFFFFF);
- *pdst-- &= (piQxelAnd[1] | 0xFFFF0000);
-#endif
-#if RROP == GXor
- *pdst++ |= (piQxelOr[0] & 0xFF000000);
- *pdst-- |= (piQxelOr[1] & 0xFFFF);
-#endif
-#if RROP == GXset
- *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000);
- pdst++;
- *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF);
- pdst--;
-#endif
- }
- else{ /*case 2 leftIndex === 0 */
-#if RROP == GXcopy
- *pdst++ = piQxelXor[0];
- *pdst = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF);
- pdst--;
-#endif
-#if RROP == GXxor
- *pdst++ ^= piQxelXor[0];
- *pdst-- ^= (piQxelXor[1] & 0xFFFF);
-#endif
-#if RROP == GXand
- *pdst++ &= piQxelAnd[0];
- *pdst-- &= (piQxelAnd[1] | 0xFFFF0000);
-#endif
-#if RROP == GXor
- *pdst++ |= piQxelOr[0];
- *pdst-- |= (piQxelOr[1] & 0xFFFF);
-#endif
-#if RROP == GXset
- *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
- pdst++;
- *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF);
- pdst--;
-#endif
- }
- break;
- case 1: /*only if leftIndex = 0 and w = 1*/
-#if RROP == GXcopy
- *pdst = ((*pdst) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF);
-#endif
-#if RROP == GXxor
- *pdst ^= (piQxelXor[0] & 0xFFFFFF);
-#endif
-#if RROP == GXand
- *pdst &= (piQxelAnd[0] | 0xFF000000);
-#endif
-#if RROP == GXor
- *pdst |= (piQxelOr[0] & 0xFFFFFF);
-#endif
-#if RROP == GXset
- *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFFFFFF);
-#endif
- break;
- case 0: /*never*/
- break;
- default:
- {
- switch(leftIndex){
- case 0:
- break;
- case 1:
-#if RROP == GXcopy
- *pdst = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000);
- pdst++;
- *pdst++ = piQxelXor[1];
- *pdst++ = piQxelXor[2];
-#endif
-#if RROP == GXxor
- *pdst++ ^= (piQxelXor[0] & 0xFF000000);
- *pdst++ ^= piQxelXor[1];
- *pdst++ ^= piQxelXor[2];
-#endif
-#if RROP == GXand
- *pdst++ &= (piQxelAnd[0] | 0xFFFFFF);
- *pdst++ &= piQxelAnd[1];
- *pdst++ &= piQxelAnd[2];
-#endif
-#if RROP == GXor
- *pdst++ |= (piQxelOr[0] & 0xFF000000);
- *pdst++ |= piQxelOr[1];
- *pdst++ |= piQxelOr[2];
-#endif
-#if RROP == GXset
- *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000);
- pdst++;
- *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
- pdst++;
- *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
- pdst++;
-#endif
- break;
- case 2:
-#if RROP == GXcopy
- *pdst = (((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000));
- pdst++;
- *pdst++ = piQxelXor[2];
-#endif
-#if RROP == GXxor
- *pdst++ ^=(piQxelXor[1] & 0xFFFF0000);
- *pdst++ ^= piQxelXor[2];
-#endif
-#if RROP == GXand
- *pdst++ &= (piQxelAnd[1] | 0xFFFF);
- *pdst++ &= piQxelAnd[2];
-#endif
-#if RROP == GXor
- *pdst++ |= (piQxelOr[1] & 0xFFFF0000);
- *pdst++ |= piQxelOr[2];
-#endif
-#if RROP == GXset
- *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000);
- pdst++;
- *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
- pdst++;
-#endif
- break;
- case 3:
-#if RROP == GXcopy
- *pdst = ((*pdst) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00);
- pdst++;
-#endif
-#if RROP == GXxor
- *pdst++ ^= (piQxelXor[2] & 0xFFFFFF00);
-#endif
-#if RROP == GXand
- *pdst++ &= (piQxelAnd[2] | 0xFF);
-#endif
-#if RROP == GXor
- *pdst++ |= (piQxelOr[2] & 0xFFFFFF00);
-#endif
-#if RROP == GXset
- *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFFFFFF00);
- pdst++;
-#endif
- break;
- }
- while(nlmiddle--){
-#if RROP == GXcopy
- *pdst++ = piQxelXor[0];
- *pdst++ = piQxelXor[1];
- *pdst++ = piQxelXor[2];
-#endif
-#if RROP == GXxor
- *pdst++ ^= piQxelXor[0];
- *pdst++ ^= piQxelXor[1];
- *pdst++ ^= piQxelXor[2];
-#endif
-#if RROP == GXand
- *pdst++ &= piQxelAnd[0];
- *pdst++ &= piQxelAnd[1];
- *pdst++ &= piQxelAnd[2];
-#endif
-#if RROP == GXor
- *pdst++ |= piQxelOr[0];
- *pdst++ |= piQxelOr[1];
- *pdst++ |= piQxelOr[2];
-#endif
-#if RROP == GXset
- *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
- pdst++;
- *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
- pdst++;
- *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]);
- pdst++;
-#endif
- }
- switch(rightIndex){
- case 0:
- break;
- case 1:
-#if RROP == GXcopy
- *pdst = ((*pdst) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF);
- pdst++;
-#endif
-#if RROP == GXxor
- *pdst++ ^= (piQxelXor[0] & 0xFFFFFF);
-#endif
-#if RROP == GXand
- *pdst++ &= (piQxelAnd[0] | 0xFF);
-#endif
-#if RROP == GXor
- *pdst++ |= (piQxelOr[0] & 0xFFFFFF);
-#endif
-#if RROP == GXset
- *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFFFFFF);
-#endif
- break;
- case 2:
-#if RROP == GXcopy
- *pdst++ = piQxelXor[0];
- *pdst = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF);
- pdst++;
-#endif
-#if RROP == GXxor
- *pdst++ ^= piQxelXor[0];
- *pdst++ ^= (piQxelXor[1] & 0xFFFF);
-#endif
-#if RROP == GXand
- *pdst++ &= piQxelAnd[0];
- *pdst++ &= (piQxelAnd[1] | 0xFFFF0000);
-#endif
-#if RROP == GXor
- *pdst++ |= piQxelOr[0];
- *pdst++ |= (piQxelOr[1] & 0xFFFF);
-#endif
-#if RROP == GXset
- *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
- pdst++;
- *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF);
- pdst++;
-#endif
- break;
- case 3:
-#if RROP == GXcopy
- *pdst++ = piQxelXor[0];
- *pdst++ = piQxelXor[1];
- *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF);
- pdst++;
-#endif
-#if RROP == GXxor
- *pdst++ ^= piQxelXor[0];
- *pdst++ ^= piQxelXor[1];
- *pdst++ ^= (piQxelXor[2] & 0xFF);
-#endif
-#if RROP == GXand
- *pdst++ &= piQxelAnd[0];
- *pdst++ &= piQxelAnd[1];
- *pdst++ &= (piQxelAnd[2] | 0xFFFFFF00);
-#endif
-#if RROP == GXor
- *pdst++ |= piQxelOr[0];
- *pdst++ |= piQxelOr[1];
- *pdst++ |= (piQxelOr[2] & 0xFF);
-#endif
-#if RROP == GXset
- *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]);
- pdst++;
- *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]);
- pdst++;
- *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF);
- pdst++;
-#endif
- break;
- }
- }
-}
-#else
-#if PSZ == 8
- if (w <= PGSZB)
- {
- register char *addrb;
-
- addrb = ((char *) pdst) + x;
- while (w--)
- {
- RROP_SOLID (addrb);
- addrb++;
- }
- }
-#else
- if ((x & PIM) + w <= PPW)
- {
- pdst += x >> PWSH;
- maskpartialbits (x, w, startmask);
- RROP_SOLID_MASK (pdst, startmask);
- }
-#endif
- else
- {
- pdst += x >> PWSH;
- maskbits (x, w, startmask, endmask, nlmiddle);
- if (startmask)
- {
- RROP_SOLID_MASK (pdst, startmask);
- ++pdst;
- }
-
- RROP_SPAN(pdst,nlmiddle)
- if (endmask)
- {
- RROP_SOLID_MASK (pdst, endmask);
- }
- }
-#endif
- }
- xfree(pptFree);
- xfree(pwidthFree);
- RROP_UNDECLARE
-}
diff --git a/cfb/cfbteblt8.c b/cfb/cfbteblt8.c
deleted file mode 100644
index 9d4ce5708..000000000
--- a/cfb/cfbteblt8.c
+++ /dev/null
@@ -1,589 +0,0 @@
-/*
- * TEGblt - ImageText expanded glyph fonts only. For
- * 8 bit displays, in Copy mode with no clipping.
- */
-
-/*
-
-Copyright 1989, 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.
-*/
-
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#if PSZ == 8
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <X11/Xproto.h>
-#include "cfb.h"
-#include <X11/fonts/fontstruct.h>
-#include "dixfontstr.h"
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "regionstr.h"
-#include "cfbmskbits.h"
-#include "cfb8bit.h"
-
-/*
- * this code supports up to 5 characters at a time. The performance
- * differences between 4 and 5 is usually small (~7% on PMAX) and
- * frequently negative (SPARC and Sun3), so this file is compiled
- * only once for now. If you want to use the other options, you'll
- * need to hack cfbgc.c as well.
- */
-
-#ifndef NGLYPHS
-#define NGLYPHS 4
-#define DO_COMMON
-#endif
-
-#ifdef DO_COMMON
-#define CFBTEGBLT8 cfbTEGlyphBlt8
-#endif
-
-/*
- * On little-endian machines (or where fonts are padded to 32-bit
- * boundaries) we can use some magic to avoid the expense of getleftbits
- */
-
-#if ((BITMAP_BIT_ORDER == LSBFirst && NGLYPHS >= 4) || GLYPHPADBYTES == 4)
-
-#if GLYPHPADBYTES == 1
-typedef unsigned char *glyphPointer;
-#define USE_LEFTBITS
-#endif
-
-#if GLYPHPADBYTES == 2
-typedef unsigned short *glyphPointer;
-#define USE_LEFTBITS
-#endif
-
-#if GLYPHPADBYTES == 4
-typedef unsigned int *glyphPointer;
-#endif
-
-#define GetBitsL c = BitLeft (*leftChar++, lshift)
-#define NGetBits1S(r) c = BitRight(*char1++ r, xoff1)
-#define NGetBits1L(r) GetBitsL | BitRight(*char1++ r, xoff1)
-#define NGetBits1U(r) c = *char1++ r
-#define NGetBits2S(r) NGetBits1S(| BitRight(*char2++ r, widthGlyph))
-#define NGetBits2L(r) NGetBits1L(| BitRight(*char2++ r, widthGlyph))
-#define NGetBits2U(r) NGetBits1U(| BitRight(*char2++ r, widthGlyph))
-#define NGetBits3S(r) NGetBits2S(| BitRight(*char3++ r, widthGlyph))
-#define NGetBits3L(r) NGetBits2L(| BitRight(*char3++ r, widthGlyph))
-#define NGetBits3U(r) NGetBits2U(| BitRight(*char3++ r, widthGlyph))
-#define NGetBits4S(r) NGetBits3S(| BitRight(*char4++ r, widthGlyph))
-#define NGetBits4L(r) NGetBits3L(| BitRight(*char4++ r, widthGlyph))
-#define NGetBits4U(r) NGetBits3U(| BitRight(*char4++ r, widthGlyph))
-#define NGetBits5S(r) NGetBits4S(| BitRight(*char5++ r, widthGlyph))
-#define NGetBits5L(r) NGetBits4L(| BitRight(*char5++ r, widthGlyph))
-#define NGetBits5U(r) NGetBits4U(| BitRight(*char5++ r, widthGlyph))
-#define GetBits1S c = BitRight(*char1++, xoff1)
-#define GetBits1L GetBitsL | BitRight(*char1++, xoff1)
-#define GetBits1U c = *char1++
-#define GetBits2S NGetBits1S(| BitRight(*char2++, widthGlyph))
-#define GetBits2L NGetBits1L(| BitRight(*char2++, widthGlyph))
-#define GetBits2U NGetBits1U(| BitRight(*char2++, widthGlyph))
-#define GetBits3S NGetBits2S(| BitRight(*char3++, widthGlyph))
-#define GetBits3L NGetBits2L(| BitRight(*char3++, widthGlyph))
-#define GetBits3U NGetBits2U(| BitRight(*char3++, widthGlyph))
-#define GetBits4S NGetBits3S(| BitRight(*char4++, widthGlyph))
-#define GetBits4L NGetBits3L(| BitRight(*char4++, widthGlyph))
-#define GetBits4U NGetBits3U(| BitRight(*char4++, widthGlyph))
-#define GetBits5S NGetBits4S(| BitRight(*char5++, widthGlyph))
-#define GetBits5L NGetBits4L(| BitRight(*char5++, widthGlyph))
-#define GetBits5U NGetBits4U(| BitRight(*char5++, widthGlyph))
-
-#else
-
-typedef unsigned int *glyphPointer;
-
-#define USE_LEFTBITS
-#define ALL_LEFTBITS
-
-#define GetBitsL WGetBitsL
-#define GetBits1S WGetBits1S
-#define GetBits1L WGetBits1L
-#define GetBits1U WGetBits1U
-
-#define GetBits2S GetBits1S Get1Bits (char2, tmpSrc) \
- c |= BitRight(tmpSrc, xoff2);
-#define GetBits2L GetBits1L Get1Bits (char2, tmpSrc) \
- c |= BitRight(tmpSrc, xoff2);
-#define GetBits2U GetBits1U Get1Bits (char2, tmpSrc) \
- c |= BitRight(tmpSrc, xoff2);
-
-#define GetBits3S GetBits2S Get1Bits (char3, tmpSrc) \
- c |= BitRight(tmpSrc, xoff3);
-#define GetBits3L GetBits2L Get1Bits (char3, tmpSrc) \
- c |= BitRight(tmpSrc, xoff3);
-#define GetBits3U GetBits2U Get1Bits (char3, tmpSrc) \
- c |= BitRight(tmpSrc, xoff3);
-
-#define GetBits4S GetBits3S Get1Bits (char4, tmpSrc) \
- c |= BitRight(tmpSrc, xoff4);
-#define GetBits4L GetBits3L Get1Bits (char4, tmpSrc) \
- c |= BitRight(tmpSrc, xoff4);
-#define GetBits4U GetBits3U Get1Bits (char4, tmpSrc) \
- c |= BitRight(tmpSrc, xoff4);
-
-#define GetBits5S GetBits4S Get1Bits (char5, tmpSrc) \
- c |= BitRight(tmpSrc, xoff5);
-#define GetBits5L GetBits4L Get1Bits (char5, tmpSrc) \
- c |= BitRight(tmpSrc, xoff5);
-#define GetBits5U GetBits4U Get1Bits (char5, tmpSrc) \
- c |= BitRight(tmpSrc, xoff5);
-
-#endif
-
-#ifdef USE_LEFTBITS
-
-#define IncChar(c) (c = (glyphPointer) (((char *) c) + glyphBytes))
-
-#define Get1Bits(ch,dst) glyphbits (ch, widthGlyph, glyphMask, dst); \
- IncChar (ch);
-
-#define glyphbits(bits,width,mask,dst) getleftbits(bits,width,dst); \
- dst &= mask;
-
-#define WGetBitsL Get1Bits(leftChar,c); \
- c = BitLeft (c, lshift);
-#define WGetBits1S Get1Bits (char1, c) \
- c = BitRight (c, xoff1);
-#define WGetBits1L WGetBitsL Get1Bits (char1, tmpSrc) \
- c |= BitRight (tmpSrc, xoff1);
-#define WGetBits1U Get1Bits (char1, c)
-
-#else
-#define WGetBitsL GetBitsL
-#define WGetBits1S GetBits1S
-#define WGetBits1L GetBits1L
-#define WGetBits1U GetBits1U
-#endif
-
-#if NGLYPHS == 2
-# define GetBitsNS GetBits2S
-# define GetBitsNL GetBits2L
-# define GetBitsNU GetBits2U
-# define LastChar char2
-#ifndef CFBTEGBLT8
-# define CFBTEGBLT8 cfbTEGlyphBlt8x2
-#endif
-#endif
-#if NGLYPHS == 3
-# define GetBitsNS GetBits3S
-# define GetBitsNL GetBits3L
-# define GetBitsNU GetBits3U
-# define LastChar char3
-#ifndef CFBTEGBLT8
-# define CFBTEGBLT8 cfbTEGlyphBlt8x3
-#endif
-#endif
-#if NGLYPHS == 4
-# define GetBitsNS GetBits4S
-# define GetBitsNL GetBits4L
-# define GetBitsNU GetBits4U
-# define LastChar char4
-#ifndef CFBTEGBLT8
-# define CFBTEGBLT8 cfbTEGlyphBlt8x4
-#endif
-#endif
-#if NGLYPHS == 5
-# define GetBitsNS GetBits5S
-# define GetBitsNL GetBits5L
-# define GetBitsNU GetBits5U
-# define LastChar char5
-#ifndef CFBTEGBLT8
-# define CFBTEGBLT8 cfbTEGlyphBlt8x5
-#endif
-#endif
-
-/* another ugly giant macro */
-#define SwitchEm switch (ew) \
- { \
- case 0: \
- break; \
- case 1: \
- while (hTmp--) { \
- GetBits; \
- StoreBits0 \
- Loop \
- } \
- break; \
- case 2: \
- while (hTmp--) { \
- GetBits; \
- StoreBits0 FirstStep StoreBits(1) \
- Loop \
- } \
- break; \
- case 3: \
- while (hTmp--) { \
- GetBits; \
- StoreBits0 FirstStep StoreBits(1) Step StoreBits(2) \
- Loop \
- } \
- break; \
- case 4: \
- while (hTmp--) { \
- GetBits; \
- StoreBits0 FirstStep StoreBits(1) Step \
- StoreBits(2) Step StoreBits(3) \
- Loop \
- } \
- break; \
- case 5: \
- while (hTmp--) { \
- GetBits; \
- StoreBits0 FirstStep StoreBits(1) Step \
- StoreBits(2) Step StoreBits(3) Step \
- StoreBits(4) \
- Loop \
- } \
- break; \
- case 6: \
- while (hTmp--) { \
- GetBits; \
- StoreBits0 FirstStep StoreBits(1) Step \
- StoreBits(2) Step StoreBits(3) Step \
- StoreBits(4) Step StoreBits(5) \
- Loop \
- } \
- break; \
- case 7: \
- while (hTmp--) { \
- GetBits; \
- StoreBits0 FirstStep StoreBits(1) Step \
- StoreBits(2) Step StoreBits(3) Step \
- StoreBits(4) Step StoreBits(5) Step \
- StoreBits(6) \
- Loop \
- } \
- break; \
- case 8: \
- while (hTmp--) { \
- GetBits; \
- StoreBits0 FirstStep StoreBits(1) Step \
- StoreBits(2) Step StoreBits(3) Step \
- StoreBits(4) Step StoreBits(5) Step \
- StoreBits(6) Step StoreBits(7) \
- Loop \
- } \
- break; \
- }
-
-#ifdef FAST_CONSTANT_OFFSET_MODE
-#define StorePixels(o,p) dst[o] = p
-#define Loop dst += widthDst;
-#else
-#define StorePixels(o,p) do { *dst = (p); dst++; } while (0)
-#define Loop dst += widthLeft;
-#endif
-
-#define Step NextBitGroup(c);
-
-#if (BITMAP_BIT_ORDER == MSBFirst)
-#define StoreBits(o) StorePixels(o,GetPixelGroup(c));
-#define FirstStep Step
-#else
-#if PGSZ == 64
-#define StoreBits(o) StorePixels(o,cfb8Pixels[(c) & PGSZBMSK]);
-#define FirstStep Step
-#else /* PGSZ == 32 */
-#define StoreBits(o) StorePixels(o,*((CfbBits *) (((char *) cfb8Pixels) + (c & 0x3c))));
-#define FirstStep c = BitLeft (c, 2);
-#endif /* PGSZ */
-#endif /* BITMAP_BIT_ORDER */
-
-
-void
-CFBTEGBLT8 (pDrawable, pGC, xInit, yInit, nglyph, ppci, pglyphBase)
- DrawablePtr pDrawable;
- GC *pGC;
- int xInit, yInit;
- unsigned int nglyph;
- CharInfoPtr *ppci; /* array of character info */
- pointer pglyphBase; /* start of array of glyphs */
-{
- register CfbBits c;
- register CfbBits *dst;
- register CfbBits leftMask, rightMask;
- register int hTmp;
- register int xoff1;
- register glyphPointer char1;
- register glyphPointer char2;
-#if NGLYPHS >= 3
- register glyphPointer char3;
-#endif
-#if NGLYPHS >= 4
- register glyphPointer char4;
-#endif
-#if NGLYPHS >= 5
- register glyphPointer char5;
-#endif
-#ifdef ALL_LEFTBITS
- int xoff2, xoff3, xoff4, xoff5;
-#endif
-
- FontPtr pfont = pGC->font;
- CfbBits *dstLine;
- glyphPointer oldRightChar;
- CfbBits *pdstBase;
- glyphPointer leftChar;
- int widthDst;
-#ifndef FAST_CONSTANT_OFFSET_MODE
- int widthLeft;
-#endif
- int widthGlyph;
- int h;
- int ew;
- int x, y;
- BoxRec bbox; /* for clipping */
- int lshift;
- int widthGlyphs;
-#ifdef USE_LEFTBITS
- register CfbBits glyphMask;
- register CfbBits tmpSrc;
- register int glyphBytes;
-#endif
-
- widthGlyph = FONTMAXBOUNDS(pfont,characterWidth);
- h = FONTASCENT(pfont) + FONTDESCENT(pfont);
- if (!h)
- return;
- x = xInit + FONTMAXBOUNDS(pfont,leftSideBearing) + pDrawable->x;
- y = yInit - FONTASCENT(pfont) + pDrawable->y;
- bbox.x1 = x;
- bbox.x2 = x + (widthGlyph * nglyph);
- bbox.y1 = y;
- bbox.y2 = y + h;
-
- switch (RECT_IN_REGION(pGC->pScreen, cfbGetCompositeClip(pGC), &bbox))
- {
- case rgnPART:
- cfbImageGlyphBlt8(pDrawable, pGC, xInit, yInit, nglyph, ppci, pglyphBase);
- case rgnOUT:
- return;
- }
-
- if (!cfb8CheckPixels (pGC->fgPixel, pGC->bgPixel))
- cfb8SetPixels (pGC->fgPixel, pGC->bgPixel);
-
- leftChar = 0;
-
- cfbGetLongWidthAndPointer(pDrawable, widthDst, pdstBase)
-
-#if NGLYPHS == 2
- widthGlyphs = widthGlyph << 1;
-#else
-#if NGLYPHS == 4
- widthGlyphs = widthGlyph << 2;
-#else
- widthGlyphs = widthGlyph * NGLYPHS;
-#endif
-#endif
-
-#ifdef USE_LEFTBITS
- glyphMask = mfbGetendtab(widthGlyph);
- glyphBytes = GLYPHWIDTHBYTESPADDED(*ppci);
-#endif
-
- pdstBase += y * widthDst;
-#ifdef DO_COMMON
- if (widthGlyphs <= 32)
-#endif
- while (nglyph >= NGLYPHS)
- {
- nglyph -= NGLYPHS;
- hTmp = h;
- dstLine = pdstBase + (x >> PWSH);
- xoff1 = x & PIM;
- char1 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++);
- char2 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++);
-#ifdef ALL_LEFTBITS
- xoff2 = xoff1 + widthGlyph;
-#endif
-#if NGLYPHS >= 3
- char3 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++);
-#ifdef ALL_LEFTBITS
- xoff3 = xoff2 + widthGlyph;
-#endif
-#endif
-#if NGLYPHS >= 4
- char4 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++);
-#ifdef ALL_LEFTBITS
- xoff4 = xoff3 + widthGlyph;
-#endif
-#endif
-#if NGLYPHS >= 5
- char5 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++);
-#ifdef ALL_LEFTBITS
- xoff5 = xoff4 + widthGlyph;
-#endif
-#endif
- oldRightChar = LastChar;
- dst = dstLine;
- if (xoff1)
- {
- ew = ((widthGlyphs - (PGSZB - xoff1)) >> PWSH) + 1;
-#ifndef FAST_CONSTANT_OFFSET_MODE
- widthLeft = widthDst - ew;
-#endif
- if (!leftChar)
- {
- leftMask = cfbendtab[xoff1];
- rightMask = cfbstarttab[xoff1];
-
-#define StoreBits0 StorePixels (0, (dst[0] & leftMask) | \
- (GetPixelGroup(c) & rightMask));
-#define GetBits GetBitsNS
-
- SwitchEm
-
-#undef GetBits
-#undef StoreBits0
-
- }
- else
- {
- lshift = widthGlyph - xoff1;
-
-#define StoreBits0 StorePixels (0,GetPixelGroup(c));
-#define GetBits GetBitsNL
-
- SwitchEm
-
-#undef GetBits
-#undef StoreBits0
-
- }
- }
- else
- {
-#if NGLYPHS == 4 && PGSZ == 32
- ew = widthGlyph; /* widthGlyphs >> 2 */
-#else
- ew = widthGlyphs >> PWSH;
-#endif
-#ifndef FAST_CONSTANT_OFFSET_MODE
- widthLeft = widthDst - ew;
-#endif
-
-#define StoreBits0 StorePixels (0,GetPixelGroup(c));
-#define GetBits GetBitsNU
-
- SwitchEm
-
-#undef GetBits
-#undef StoreBits0
-
- }
- x += widthGlyphs;
- leftChar = oldRightChar;
- }
- while (nglyph--)
- {
- xoff1 = x & PIM;
- char1 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++);
- hTmp = h;
- dstLine = pdstBase + (x >> PWSH);
- oldRightChar = char1;
- dst = dstLine;
- if (xoff1)
- {
- ew = ((widthGlyph - (PGSZB - xoff1)) >> PWSH) + 1;
-#ifndef FAST_CONSTANT_OFFSET_MODE
- widthLeft = widthDst - ew;
-#endif
- if (!leftChar)
- {
- leftMask = cfbendtab[xoff1];
- rightMask = cfbstarttab[xoff1];
-
-#define StoreBits0 StorePixels (0, (dst[0] & leftMask) | \
- (GetPixelGroup(c) & rightMask));
-#define GetBits WGetBits1S
-
- SwitchEm
-#undef GetBits
-#undef StoreBits0
-
- }
- else
- {
- lshift = widthGlyph - xoff1;
-
-#define StoreBits0 StorePixels (0,GetPixelGroup(c));
-#define GetBits WGetBits1L
-
- SwitchEm
-#undef GetBits
-#undef StoreBits0
-
- }
- }
- else
- {
- ew = widthGlyph >> PWSH;
-
-#ifndef FAST_CONSTANT_OFFSET_MODE
- widthLeft = widthDst - ew;
-#endif
-
-#define StoreBits0 StorePixels (0,GetPixelGroup(c));
-#define GetBits WGetBits1U
-
- SwitchEm
-
-#undef GetBits
-#undef StoreBits0
-
- }
- x += widthGlyph;
- leftChar = oldRightChar;
- }
- /*
- * draw the tail of the last character
- */
- xoff1 = x & PIM;
- if (xoff1)
- {
- rightMask = cfbstarttab[xoff1];
- leftMask = cfbendtab[xoff1];
- lshift = widthGlyph - xoff1;
- dst = pdstBase + (x >> PWSH);
- hTmp = h;
- while (hTmp--)
- {
- GetBitsL;
- *dst = (*dst & rightMask) | (GetPixelGroup(c) & leftMask);
- dst += widthDst;
- }
- }
-}
-#endif /* PSZ == 8 */
diff --git a/cfb/cfbtegblt.c b/cfb/cfbtegblt.c
deleted file mode 100644
index f04ee3faf..000000000
--- a/cfb/cfbtegblt.c
+++ /dev/null
@@ -1,218 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 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.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <X11/Xproto.h>
-#include "cfb.h"
-#include <X11/fonts/fontstruct.h>
-#include "dixfontstr.h"
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "regionstr.h"
-#include "cfbmskbits.h"
-#include "mi.h"
-#define MFB_CONSTS_ONLY
-#include "maskbits.h"
-
-/*
- this works for fonts with glyphs <= 32 bits wide, on an
- arbitrarily deep display. Use cfbTEGlyphBlt8 for 8 bit displays.
-
- This should be called only with a terminal-emulator font;
-this means that the FIXED_METRICS flag is set, and that
-glyphbounds == charbounds.
-
- in theory, this goes faster; even if it doesn't, it reduces the
-flicker caused by writing a string over itself with image text (since
-the background gets repainted per character instead of per string.)
-this seems to be important for some converted X10 applications.
-
- Image text looks at the bits in the glyph and the fg and bg in the
-GC. it paints a rectangle, as defined in the protocol dcoument,
-and the paints the characters.
-
-*/
-
-void
-cfbTEGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
- DrawablePtr pDrawable;
- GC *pGC;
- int x, y;
- unsigned int nglyph;
- CharInfoPtr *ppci; /* array of character info */
- pointer pglyphBase; /* start of array of glyphs */
-{
- FontPtr pfont = pGC->font;
- int widthDst;
- CfbBits *pdstBase; /* pointer to longword with top row
- of current glyph */
-
- int w; /* width of glyph and char */
- int h; /* height of glyph and char */
- register int xpos=x; /* current x%32 */
- int ypos=y; /* current y%32 */
- register unsigned char *pglyph;
- int widthGlyph;
-
- register CfbBits *pdst;/* pointer to current longword in dst */
- int hTmp; /* counter for height */
- BoxRec bbox; /* for clipping */
-
- register int wtmp,xtemp,width;
- CfbBits bgfill,fgfill,*ptemp,tmpDst1,tmpDst2,*pdtmp;
-#if PSZ != 24
- int tmpx;
-#endif
-
- xpos += pDrawable->x;
- ypos += pDrawable->y;
-
- cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase)
-
- wtmp = FONTMAXBOUNDS(pfont,characterWidth);
- h = FONTASCENT(pfont) + FONTDESCENT(pfont);
- widthGlyph = GLYPHWIDTHBYTESPADDED(*ppci);
-
- xpos += FONTMAXBOUNDS(pfont,leftSideBearing);
- ypos -= FONTASCENT(pfont);
-
- bbox.x1 = xpos;
- bbox.x2 = xpos + (wtmp * nglyph);
- bbox.y1 = ypos;
- bbox.y2 = ypos + h;
-
- fgfill = PFILL(pGC->fgPixel);
- bgfill = PFILL(pGC->bgPixel);
-
- switch (RECT_IN_REGION(pGC->pScreen, cfbGetCompositeClip(pGC), &bbox))
- {
- case rgnOUT:
- break;
- case rgnPART:
- /* this is the WRONG thing to do, but it works.
- calling the non-terminal text is easy, but slow, given
- what we know about the font.
-
- the right thing to do is something like:
- for each clip rectangle
- compute at which row the glyph starts to be in it,
- and at which row the glyph ceases to be in it
- compute which is the first glyph inside the left
- edge, and the last one inside the right edge
- draw a fractional first glyph, using only
- the rows we know are in
- draw all the whole glyphs, using the appropriate rows
- draw any pieces of the last glyph, using the right rows
-
- this way, the code would take advantage of knowing that
- all glyphs are the same height and don't overlap.
-
- one day...
- */
- cfbImageGlyphBlt8(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
- break;
- case rgnIN:
-
- pdtmp = pdstBase + (widthDst * ypos);
- while(nglyph--)
- {
-
- pglyph = FONTGLYPHBITS(pglyphBase, *ppci++);
- pdst = pdtmp;
- hTmp = h;
-
- while (hTmp--)
- {
- x = xpos;
- width = wtmp;
- xtemp = 0;
-
- while (width > 0)
- {
-#if PSZ == 24
- w = 1;
- ptemp = (CfbBits *)(pglyph + ((xtemp *3)>> 2));
- getstipplepixels24(ptemp,xtemp,0,&bgfill,&tmpDst1, xtemp);
- getstipplepixels24(ptemp,xtemp,1,&fgfill,&tmpDst2, xtemp);
-#else
- tmpx = x & PIM;
- w = min(width, PPW - tmpx);
- w = min(w, (PGSZ - xtemp));
- ptemp = (CfbBits *)(pglyph + (xtemp >> MFB_PWSH));
- getstipplepixels(ptemp,xtemp,w,0,&bgfill,&tmpDst1);
- getstipplepixels(ptemp,xtemp,w,1,&fgfill,&tmpDst2);
-#endif
-
- {
- CfbBits tmpDst = tmpDst1 | tmpDst2;
-#if PSZ == 24
- CfbBits *pdsttmp = pdst + ((x*3) >> 2);
- putbits24(tmpDst,w,pdsttmp,pGC->planemask,x);
-#else
- CfbBits *pdsttmp = pdst + (x >> PWSH);
- putbits(tmpDst,tmpx,w,pdsttmp,pGC->planemask);
-#endif
- }
- x += w;
- xtemp += w;
- width -= w;
- }
- pglyph += widthGlyph;
- pdst += widthDst;
- }
- xpos += wtmp;
- }
- break;
- }
-}
diff --git a/cfb/cfbtile32.c b/cfb/cfbtile32.c
deleted file mode 100644
index be016a70a..000000000
--- a/cfb/cfbtile32.c
+++ /dev/null
@@ -1,517 +0,0 @@
-/*
- * Fill 32 bit tiled rectangles. Used by PolyFillRect.
- * no depth dependencies.
- */
-
-/*
-
-Copyright 1989, 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.
-*/
-
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include "servermd.h"
-#include "gcstruct.h"
-#include "window.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-#include "windowstr.h"
-
-#include "cfb.h"
-#include "cfbmskbits.h"
-#include "cfb8bit.h"
-
-#include "mergerop.h"
-
-#include "mi.h"
-#include "mispans.h"
-
-#ifdef sparc
-#define SHARED_IDCACHE
-#endif
-
-#if PSZ == 24
-#define STORE(p) (*(p) = MROP_PREBUILT_SOLID(srcpix,*(p)))
-/*#define STORE24(p,index) {\
- register int idx = ((index) & 3)<< 1; \
- *(p) = (((MROP_PREBUILT_SOLID(srcpix,*(p))<<cfb24Shift[idx])&cfbmask[idx])| \
- (*(p)&cfbrmask[idx])); \
- idx++; \
- (p)++; \
- *(p) = (((MROP_PREBUILT_SOLID(srcpix,*(p))>>cfb24Shift[idx])&cfbmask[idx])| \
- (*(p)&cfbrmask[idx])); \
- (p)--; \
- }*/
-#define STORE24(p,index) MROP_PREBUILT_SOLID24(srcpix, (p), index)
-
-#define STORE_MASK(p,mask) (*(p) = MROP_PREBUILT_MASK(srcpix,*(p),(mask)))
-#define QSTORE(p) ((*(p) = MROP_PREBUILT_SOLID(((srcpix<<24)|srcpix),*(p))), \
- (p)++,(*(p) = MROP_PREBUILT_SOLID(((srcpix<<16)|(srcpix>>8)),*(p))), \
- (p)++,(*(p) = MROP_PREBUILT_SOLID(((srcpix<<8)|(srcpix>>16)),*(p))))
-
-#if (MROP == Mcopy) && defined(FAST_CONSTANT_OFFSET_MODE) && defined(SHARED_IDCACHE)
-# define Expand(left,right) {\
- int part = nlwMiddle & ((PGSZB*2)-1); \
- nlwMiddle *= 3; \
- nlwMiddle >>= PWSH + 3; \
- while (h--) { \
- srcpix = psrc[srcy]; \
- MROP_PREBUILD(srcpix); \
- ++srcy; \
- if (srcy == tileHeight) \
- srcy = 0; \
- left \
- p += part; \
- switch (part) { \
- case 7: \
- STORE24(p - 7, xtmp - 7); \
- case 6: \
- STORE24(p - 6, xtmp - 6); \
- case 5: \
- STORE24(p - 5, xtmp - 5); \
- case 4: \
- STORE24(p - 4, xtmp - 4); \
- case 3: \
- STORE24(p - 3, xtmp - 3); \
- case 2: \
- STORE24(p - 2, xtmp - 2); \
- case 1: \
- STORE24(p - 1, xtmp - 1); \
- } \
- nlw = nlwMiddle; \
- while (nlw) { \
- STORE24 (p + 0, xtmp + 0); \
- STORE24 (p + 1, xtmp + 1); \
- STORE24 (p + 2, xtmp + 2); \
- STORE24 (p + 3, xtmp + 3); \
- STORE24 (p + 4, xtmp + 4); \
- STORE24 (p + 5, xtmp + 5); \
- STORE24 (p + 6, xtmp + 6); \
- STORE24 (p + 7, xtmp + 7); \
- p += 8; \
- xtmp += 8; \
- nlw--; \
- } \
- right \
- p += nlwExtra; \
- } \
-}
-#else
-#define Expand(left,right) {\
- while (h--) { \
- srcpix = psrc[srcy]; \
- MROP_PREBUILD(srcpix); \
- ++srcy; \
- if (srcy == tileHeight) \
- srcy = 0; \
- left \
- while (nlw--) \
- { \
- STORE24(p,xtmp); \
- if(xtmp&3) p++; \
- xtmp++; \
- } \
- right \
- p += nlwExtra; \
- } \
-}
-#endif
-#else /*PSZ != 24*/
-#define STORE(p) (*(p) = MROP_PREBUILT_SOLID(srcpix,*(p)))
-
-#if (MROP == Mcopy) && defined(FAST_CONSTANT_OFFSET_MODE) && defined(SHARED_IDCACHE)
-# define Expand(left,right) {\
- int part = nlwMiddle & ((PGSZB*2)-1); \
- nlwMiddle >>= PWSH + 1; \
- while (h--) { \
- srcpix = psrc[srcy]; \
- MROP_PREBUILD(srcpix); \
- ++srcy; \
- if (srcy == tileHeight) \
- srcy = 0; \
- left \
- p += part; \
- switch (part) { \
- case 7: \
- STORE(p - 7); \
- case 6: \
- STORE(p - 6); \
- case 5: \
- STORE(p - 5); \
- case 4: \
- STORE(p - 4); \
- case 3: \
- STORE(p - 3); \
- case 2: \
- STORE(p - 2); \
- case 1: \
- STORE(p - 1); \
- } \
- nlw = nlwMiddle; \
- while (nlw) { \
- STORE (p + 0); \
- STORE (p + 1); \
- STORE (p + 2); \
- STORE (p + 3); \
- STORE (p + 4); \
- STORE (p + 5); \
- STORE (p + 6); \
- STORE (p + 7); \
- p += 8; \
- nlw--; \
- } \
- right \
- p += nlwExtra; \
- } \
-}
-#else
-#define Expand(left,right) {\
- while (h--) { \
- srcpix = psrc[srcy]; \
- MROP_PREBUILD(srcpix); \
- ++srcy; \
- if (srcy == tileHeight) \
- srcy = 0; \
- left \
- nlw = nlwMiddle; \
- while (nlw--) \
- { \
- STORE(p); \
- p++; \
- } \
- right \
- p += nlwExtra; \
- } \
-}
-#endif
-#endif /*PSZ == 24*/
-
-void
-MROP_NAME(cfbFillRectTile32) (pDrawable, pGC, nBox, pBox)
- DrawablePtr pDrawable;
- GCPtr pGC;
- int nBox; /* number of boxes to fill */
- BoxPtr pBox; /* pointer to list of boxes to fill */
-{
- register CfbBits srcpix;
- CfbBits *psrc; /* pointer to bits in tile, if needed */
- int tileHeight; /* height of the tile */
-
- int nlwDst; /* width in longwords of the dest pixmap */
- int w; /* width of current box */
- register int h; /* height of current box */
- register CfbBits startmask;
- register CfbBits endmask; /* masks for reggedy bits at either end of line */
- int nlwMiddle; /* number of longwords between sides of boxes */
- int nlwExtra; /* to get from right of box to left of next span */
- register int nlw = 0; /* loop version of nlwMiddle */
- register CfbBits *p; /* pointer to bits we're writing */
- int y; /* current scan line */
- int srcy; /* current tile position */
-
- CfbBits *pbits;/* pointer to start of pixmap */
- PixmapPtr tile; /* rotated, expanded tile */
-#if MROP == 0 && PSZ == 24
- DeclareMergeRop()
-#else
- MROP_DECLARE_REG()
-#endif
- MROP_PREBUILT_DECLARE()
-#if PSZ == 24
- CfbBits xtmp;
-#endif
-
- tile = pGC->pRotatedPixmap;
- tileHeight = tile->drawable.height;
- psrc = (CfbBits *)tile->devPrivate.ptr;
-
-#if MROP == 0 && PSZ == 24
- InitializeMergeRop(pGC->alu, pGC->planemask);
-#else
- MROP_INITIALIZE(pGC->alu, pGC->planemask);
-#endif
-
- cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits)
-
- while (nBox--)
- {
- w = pBox->x2 - pBox->x1;
- h = pBox->y2 - pBox->y1;
- y = pBox->y1;
-#if PSZ == 24
- xtmp = pBox->x1;
- p = pbits + (y * nlwDst) + ((pBox->x1*3) >> 2);
-/* p = pbits + (y * nlwDst) + ((pBox->x1>> 2)*3);*/
-#else
- p = pbits + (y * nlwDst) + (pBox->x1 >> PWSH);
-#endif
- srcy = y % tileHeight;
-
-#if PSZ == 24
- if (w == 1 && ((pBox->x1 & 3) == 0 || (pBox->x1 & 3) == 3))
-#else
- if ( ((pBox->x1 & PIM) + w) <= PPW)
-#endif
- {
- maskpartialbits(pBox->x1, w, startmask);
- nlwExtra = nlwDst;
- while (h--)
- {
- srcpix = psrc[srcy];
- MROP_PREBUILD(srcpix);
- ++srcy;
- if (srcy == tileHeight)
- srcy = 0;
- *p = MROP_PREBUILT_MASK (srcpix, *p, startmask);
- p += nlwExtra;
- }
- }
- else
- {
- maskbits(pBox->x1, w, startmask, endmask, nlwMiddle);
- nlwExtra = nlwDst - nlwMiddle;
-
- if (startmask)
- {
- nlwExtra -= 1;
- if (endmask)
- {
- Expand(*p = MROP_PREBUILT_MASK(srcpix, *p, startmask); p++;,
- *p = MROP_PREBUILT_MASK(srcpix, *p, endmask);)
- }
- else
- {
- Expand(*p = MROP_PREBUILT_MASK(srcpix, *p, startmask); p++;,
- ;)
- }
- }
- else
- {
- if (endmask)
- {
- Expand(;,
- *p = MROP_PREBUILT_MASK(srcpix, *p, endmask);)
- }
- else
- {
- Expand(;,
- ;)
- }
- }
- }
- pBox++;
- }
-}
-
-void
-MROP_NAME(cfbTile32FS)(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
- DrawablePtr pDrawable;
- GCPtr pGC;
- int nInit; /* number of spans to fill */
- DDXPointPtr pptInit; /* pointer to list of start points */
- int *pwidthInit; /* pointer to list of n widths */
- int fSorted;
-{
- /* next three parameters are post-clip */
- int n; /* number of spans to fill */
- DDXPointPtr ppt; /* pointer to list of start points */
- int *pwidth;/* pointer to list of n widths */
- CfbBits *pbits; /* pointer to start of bitmap */
- int nlwDst; /* width in longwords of bitmap */
- register CfbBits *p; /* pointer to current longword in bitmap */
- register int w; /* current span width */
- register int nlw;
- register int x;
- register CfbBits startmask;
- register CfbBits endmask;
- register CfbBits srcpix;
- int y;
- int *pwidthFree;/* copies of the pointers to free */
- DDXPointPtr pptFree;
- PixmapPtr tile;
- CfbBits *psrc; /* pointer to bits in tile */
- int tileHeight;/* height of the tile */
-#if MROP == 0 && PSZ == 24
- DeclareMergeRop()
-#else
- MROP_DECLARE_REG()
-#endif
- MROP_PREBUILT_DECLARE()
-#if PSZ == 24
- CfbBits xtmp;
-#endif
-
- n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) );
- pwidthFree = (int *)xalloc(n * sizeof(int));
- pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
- if(!pptFree || !pwidthFree)
- {
- if (pptFree) xfree(pptFree);
- if (pwidthFree) xfree(pwidthFree);
- return;
- }
- pwidth = pwidthFree;
- ppt = pptFree;
- n = miClipSpans( cfbGetCompositeClip(pGC),
- pptInit, pwidthInit, nInit,
- ppt, pwidth, fSorted);
-
- tile = pGC->pRotatedPixmap;
- tileHeight = tile->drawable.height;
- psrc = (CfbBits *)tile->devPrivate.ptr;
-
-#if MROP == 0 && PSZ == 24
- InitializeMergeRop(pGC->alu, pGC->planemask);
-#else
- MROP_INITIALIZE(pGC->alu, pGC->planemask);
-#endif
-
- cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits)
-
-#if MROP == Mcopy
- if (!(tileHeight & (tileHeight-1)))
- {
- tileHeight--;
- while (n--)
- {
- x = ppt->x;
- y = ppt->y;
- ++ppt;
- w = *pwidth++;
-#if PSZ == 24
-/* p = pbits + (y * nlwDst) + ((x*3) >> 2);*/
- xtmp = x;
- p = pbits + (y * nlwDst) + ((x >> 2)*3);
-#else
- p = pbits + (y * nlwDst) + (x >> PWSH);
-#endif
- srcpix = psrc[y & tileHeight];
- MROP_PREBUILD(srcpix);
-
-#if PSZ == 24
- if ((x & 3) + w < 5)
-#else
- if ((x & PIM) + w < PPW)
-#endif
- {
- maskpartialbits(x, w, startmask);
- *p = MROP_PREBUILT_MASK (srcpix, *p, startmask);
- }
- else
- {
- maskbits(x, w, startmask, endmask, nlw);
- if (startmask)
- {
- *p = MROP_PREBUILT_MASK(srcpix, *p, startmask);
-#if PSZ == 24
- if(xtmp&3) p++;
- xtmp++;
-#else
- p++;
-#endif
- }
- while (nlw--)
- {
-#if PSZ == 24
- STORE24(p,xtmp);
- if(xtmp&3) p++;
- ++xtmp;
-#else
- STORE(p);
- ++p;
-#endif
- }
- if (endmask)
- {
- *p = MROP_PREBUILT_MASK(srcpix, *p, endmask);
- }
- }
- }
- }
- else
-#endif
- {
- while (n--)
- {
- x = ppt->x;
- y = ppt->y;
- ++ppt;
- w = *pwidth++;
-#if PSZ == 24
-/* p = pbits + (y * nlwDst) + ((x *3)>> 2);*/
- p = pbits + (y * nlwDst) + ((x >> 2)*3);
- xtmp = x;
-#else
- p = pbits + (y * nlwDst) + (x >> PWSH);
-#endif
- srcpix = psrc[y % tileHeight];
- MROP_PREBUILD(srcpix);
-
-#if PSZ == 24
- if ((x & 3) + w < 5)
-#else
- if ((x & PIM) + w < PPW)
-#endif
- {
- maskpartialbits(x, w, startmask);
- *p = MROP_PREBUILT_MASK (srcpix, *p, startmask);
- }
- else
- {
- maskbits(x, w, startmask, endmask, nlw);
- if (startmask)
- {
- *p = MROP_PREBUILT_MASK(srcpix, *p, startmask);
-#if PSZ == 24
- if(xtmp&3)p++;
- xtmp++;
-#else
- p++;
-#endif
- }
- while (nlw--)
- {
-#if PSZ == 24
- STORE24(p,xtmp);
- if(xtmp&3)p++;
- xtmp++;
-#else
- STORE(p);
- ++p;
-#endif
- }
- if (endmask)
- {
- *p = MROP_PREBUILT_MASK(srcpix, *p, endmask);
- }
- }
- }
- }
- xfree(pptFree);
- xfree(pwidthFree);
-}
diff --git a/cfb/cfbtileodd.c b/cfb/cfbtileodd.c
deleted file mode 100644
index 86a3fa5b5..000000000
--- a/cfb/cfbtileodd.c
+++ /dev/null
@@ -1,1245 +0,0 @@
-/*
- * Fill odd tiled rectangles and spans.
- * no depth dependencies.
- */
-
-/*
-
-Copyright 1989, 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.
-*/
-
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include "servermd.h"
-#include "gcstruct.h"
-#include "window.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-#include "windowstr.h"
-
-#include "cfb.h"
-#include "cfbmskbits.h"
-#include "cfb8bit.h"
-
-#include "mergerop.h"
-
-#if PSZ == 24
-#define LEFTSHIFT_AMT (3)
-#else /* PSZ != 24 */
-#define LEFTSHIFT_AMT (5 - PWSH)
-#endif /* PSZ == 24*/
-
-#define LastTileBits {\
- tmp = bits; \
- if (tileEndPart) \
- bits = (*pSrc & tileEndMask) | BitRight (*pSrcLine, tileEndLeftShift); \
- else \
- bits = *pSrc; \
-}
-
-#if PSZ == 24
-#define ResetTileBits {\
- pSrc = pSrcLine; \
- nlwSrc = widthSrc;\
- if (tileEndPart) { \
- if (4 - xoff + tileEndPart <= 4) {\
- bits = *pSrc++; \
- nlwSrc--; \
- } else \
- bits = BitLeft(tmp, tileEndLeftShift) | \
- BitRight(bits, tileEndRightShift); \
- xoff = (xoff + xoffStep) & 3; \
- leftShift = xoff << LEFTSHIFT_AMT; \
- rightShift = PGSZ - leftShift; \
- }\
-}
-#else
-#define ResetTileBits {\
- pSrc = pSrcLine; \
- nlwSrc = widthSrc;\
- if (tileEndPart) { \
- if (PPW - xoff + tileEndPart <= PPW) {\
- bits = *pSrc++; \
- nlwSrc--; \
- } else \
- bits = BitLeft(tmp, tileEndLeftShift) | \
- BitRight(bits, tileEndRightShift); \
- xoff = (xoff + xoffStep) & PIM; \
- leftShift = xoff << LEFTSHIFT_AMT; \
- rightShift = PGSZ - leftShift; \
- }\
-}
-#endif
-
-#define NextTileBits {\
- if (nlwSrc == 1) {\
- LastTileBits\
- } else { \
- if (nlwSrc == 0) {\
- ResetTileBits\
- } \
- if (nlwSrc == 1) {\
- LastTileBits\
- } else {\
- tmp = bits; \
- bits = *pSrc++; \
- }\
- }\
- nlwSrc--; \
-}
-
-void
-MROP_NAME(cfbFillBoxTileOdd) (pDrawable, nBox, pBox, tile, xrot, yrot, alu, planemask)
- DrawablePtr pDrawable;
- int nBox; /* number of boxes to fill */
- register BoxPtr pBox; /* pointer to list of boxes to fill */
- PixmapPtr tile; /* tile */
- int xrot, yrot;
- int alu;
- unsigned long planemask;
-{
- int tileWidth; /* width of tile in pixels */
- int tileHeight; /* height of the tile */
- int widthSrc;
-
- int widthDst; /* width in longwords of the dest pixmap */
- int w; /* width of current box */
- int h; /* height of current box */
- CfbBits startmask;
- CfbBits endmask;/* masks for reggedy bits at either end of line */
- int nlwMiddle; /* number of longwords between sides of boxes */
- int nlwSrc; /* number of whole longwords in source */
-
- register int nlw; /* loop version of nlwMiddle */
- int srcy; /* current tile y position */
- int srcx; /* current tile x position */
- int xoffDst, xoffSrc;
- int leftShift, rightShift;
-
-#if MROP == 0 && PSZ == 24
- DeclareMergeRop24()
-#else
- MROP_DECLARE_REG()
-#endif
-
- CfbBits *pdstBase; /* pointer to start of dest */
- CfbBits *pDstLine; /* poitner to start of dest box */
- CfbBits *pSrcBase; /* pointer to start of source */
- CfbBits *pSrcLine; /* pointer to start of source line */
- register CfbBits *pDst;
- register CfbBits *pSrc;
- register CfbBits bits, tmp = 0;
- int xoffStart, xoff;
- int leftShiftStart, rightShiftStart, nlwSrcStart;
- CfbBits tileEndMask;
- int tileEndLeftShift, tileEndRightShift;
- int xoffStep;
- int tileEndPart;
- int needFirst;
- CfbBits narrow[2];
- CfbBits narrowMask = 0;
- int narrowShift = 0;
- Bool narrowTile;
-
-#if MROP == 0 && PSZ == 24
- InitializeMergeRop24 (alu, planemask)
-#else
- MROP_INITIALIZE (alu, planemask)
-#endif
-
- tileHeight = tile->drawable.height;
- tileWidth = tile->drawable.width;
- widthSrc = tile->devKind / PGSZB;
- narrowTile = FALSE;
- if (widthSrc == 1)
- {
- narrowShift = tileWidth;
- narrowMask = cfbendpartial [tileWidth];
- tileWidth *= 2;
- widthSrc = 2;
- narrowTile = TRUE;
- }
- pSrcBase = (CfbBits *)tile->devPrivate.ptr;
-
- cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase)
-
-#if PSZ == 24
- tileEndPart = (4 - tileWidth) & 3;
- tileEndMask = cfbendpartial[tileWidth & 3];
-#else
- tileEndPart = tileWidth & PIM;
- tileEndMask = cfbendpartial[tileEndPart];
-#endif /* PSZ == 24 */
- tileEndLeftShift = (tileEndPart) << LEFTSHIFT_AMT;
- tileEndRightShift = PGSZ - tileEndLeftShift;
-#if PSZ == 24
- xoffStep = 4 - tileEndPart;
-#else
- xoffStep = PPW - tileEndPart;
-#endif /* PSZ == 24 */
- /*
- * current assumptions: tile > 32 bits wide.
- */
- while (nBox--)
- {
- w = pBox->x2 - pBox->x1;
- h = pBox->y2 - pBox->y1;
- modulus (pBox->x1 - xrot, tileWidth, srcx);
- modulus (pBox->y1 - yrot, tileHeight, srcy);
-#if PSZ == 24
- xoffDst = (4 - pBox->x1) & 3;
- if (w == 1 && (xoffDst == 0 || xoffDst == 1))
-#else
- xoffDst = pBox->x1 & PIM;
- if (xoffDst + w < PPW)
-#endif
- {
- maskpartialbits(pBox->x1, w, startmask);
- endmask = 0;
- nlwMiddle = 0;
- }
- else
- {
- maskbits (pBox->x1, w, startmask, endmask, nlwMiddle)
- }
-#if PSZ == 24
- pDstLine = pdstBase + (pBox->y1 * widthDst) + ((pBox->x1*3) >> 2);
-#else
- pDstLine = pdstBase + (pBox->y1 * widthDst) + (pBox->x1 >> PWSH);
-#endif
- pSrcLine = pSrcBase + (srcy * widthSrc);
-#if PSZ == 24
- xoffSrc = (4 - srcx) & 3;
-#else
- xoffSrc = srcx & PIM;
-#endif
- if (xoffSrc >= xoffDst)
- {
- xoffStart = xoffSrc - xoffDst;
- needFirst = 1;
- }
- else
- {
-#if PSZ == 24
- xoffStart = 4 - (xoffDst - xoffSrc);
-#else
- xoffStart = PPW - (xoffDst - xoffSrc);
-#endif
- needFirst = 0;
- }
- leftShiftStart = (xoffStart) << LEFTSHIFT_AMT;
- rightShiftStart = PGSZ - leftShiftStart;
-#if PSZ == 24
- nlwSrcStart = widthSrc - ((srcx*3) >> 2);
-#else
- nlwSrcStart = widthSrc - (srcx >> PWSH);
-#endif
- while (h--)
- {
- /* XXX only works when narrowShift >= PPW/2 */
- if (narrowTile)
- {
- tmp = pSrcBase[srcy] & narrowMask; /* source width == 1 */
- narrow[0] = tmp | SCRRIGHT (tmp, narrowShift);
-#if PSZ == 24
- narrow[1] = BitLeft (tmp, 8) |
- BitRight(tmp, 16);
-#else
- narrow[1] = SCRLEFT (tmp, PPW - narrowShift) |
- SCRRIGHT(tmp, 2 * narrowShift - PPW);
-#endif
- pSrcLine = narrow;
- }
- xoff = xoffStart;
- leftShift = leftShiftStart;
- rightShift = rightShiftStart;
- nlwSrc = nlwSrcStart;
-#if PSZ == 24
- pSrc = pSrcLine + ((srcx * 3) >> 2);
-#else
- pSrc = pSrcLine + (srcx >> PWSH);
-#endif
- pDst = pDstLine;
- bits = 0;
- if (needFirst)
- {
- NextTileBits
- }
- if (startmask)
- {
- NextTileBits
- tmp = BitLeft(tmp, leftShift);
- if (rightShift != PGSZ)
- tmp |= BitRight(bits,rightShift);
- *pDst = MROP_MASK (tmp, *pDst, startmask);
- ++pDst;
- }
- nlw = nlwMiddle;
- while (nlw)
- {
-#if MROP == Mcopy
- if (nlwSrc > 1)
- {
- int nlwPart = nlw;
-
- if (nlwPart >= nlwSrc)
- nlwPart = nlwSrc - 1;
- nlw -= nlwPart;
- nlwSrc -= nlwPart;
- if (rightShift != PGSZ)
- {
- while (nlwPart--)
- {
- tmp = bits;
- bits = *pSrc++;
- *pDst = MROP_SOLID(BitLeft(tmp, leftShift) |
- BitRight (bits, rightShift),
- *pDst);
- ++pDst;
- }
- }
- else
- {
- if (nlwPart)
- {
- *pDst = MROP_SOLID (bits, *pDst);
- ++pDst;
- nlwPart--;
- while (nlwPart--)
- {
- *pDst = MROP_SOLID(*pSrc, *pDst);
- ++pDst; ++pSrc;
- }
- bits = *pSrc++;
- }
- }
- }
- else
-#endif
- {
- NextTileBits
- if (rightShift != PGSZ)
- {
- *pDst = MROP_SOLID(BitLeft(tmp, leftShift) |
- BitRight(bits, rightShift),
- *pDst);
- }
- else
- {
- *pDst = MROP_SOLID (tmp, *pDst);
- }
- ++pDst;
- nlw--;
- }
- }
- if (endmask)
- {
- NextTileBits
- if (rightShift == PGSZ)
- bits = 0;
- *pDst = MROP_MASK (BitLeft(tmp, leftShift) |
- BitRight(bits,rightShift),
- *pDst, endmask);
- }
- pDstLine += widthDst;
- pSrcLine += widthSrc;
- if (++srcy == tileHeight)
- {
- srcy = 0;
- pSrcLine = pSrcBase;
- }
- }
- pBox++;
- }
-}
-
-void
-MROP_NAME(cfbFillSpanTileOdd) (pDrawable, n, ppt, pwidth, tile, xrot, yrot, alu, planemask)
- DrawablePtr pDrawable;
- int n;
- DDXPointPtr ppt;
- int *pwidth;
- PixmapPtr tile;
- int xrot, yrot;
- int alu;
- unsigned long planemask;
-{
- int tileWidth; /* width of tile in pixels */
- int tileHeight; /* height of the tile */
- int widthSrc;
-
- int widthDst; /* width in longwords of the dest pixmap */
- int w; /* width of current span */
- CfbBits startmask;
- CfbBits endmask; /* masks for reggedy bits at either end of line */
- int nlwSrc; /* number of whole longwords in source */
-
- register int nlw; /* loop version of nlwMiddle */
- int srcy; /* current tile y position */
- int srcx; /* current tile x position */
- int xoffDst, xoffSrc;
- int leftShift, rightShift;
-
-#if MROP == 0 && PSZ == 24
- DeclareMergeRop24()
-#else
- MROP_DECLARE_REG()
-#endif
-
- CfbBits *pdstBase; /* pointer to start of dest */
- CfbBits *pDstLine; /* poitner to start of dest box */
- CfbBits *pSrcBase; /* pointer to start of source */
- CfbBits *pSrcLine; /* pointer to start of source line */
- register CfbBits *pDst;
- register CfbBits *pSrc;
- register CfbBits bits, tmp = 0;
- int xoffStart, xoff;
- int leftShiftStart, rightShiftStart, nlwSrcStart;
- CfbBits tileEndMask;
- int tileEndLeftShift, tileEndRightShift;
- int xoffStep;
- int tileEndPart;
- int needFirst;
- CfbBits narrow[2];
- CfbBits narrowMask = 0;
- int narrowShift = 0;
- Bool narrowTile;
-
-#if MROP == 0 && PSZ == 24
- InitializeMergeRop24 (alu, planemask)
-#else
- MROP_INITIALIZE (alu, planemask)
-#endif
-
- tileHeight = tile->drawable.height;
- tileWidth = tile->drawable.width;
- widthSrc = tile->devKind / PGSZB;
- narrowTile = FALSE;
- if (widthSrc == 1)
- {
- narrowShift = tileWidth;
- narrowMask = cfbendpartial [tileWidth];
- tileWidth *= 2;
- widthSrc = 2;
- narrowTile = TRUE;
- }
- pSrcBase = (CfbBits *)tile->devPrivate.ptr;
-
- cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase)
-
-#if PSZ == 24
- tileEndPart = (4 - tileWidth) & 3;
- tileEndMask = cfbendpartial[tileWidth & 3];
-#else
- tileEndPart = tileWidth & PIM;
- tileEndMask = cfbendpartial[tileEndPart];
-#endif
- tileEndLeftShift = (tileEndPart) << LEFTSHIFT_AMT;
- tileEndRightShift = PGSZ - tileEndLeftShift;
-#if PSZ == 24
- xoffStep = 4 - tileEndPart;
-#else
- xoffStep = PPW - tileEndPart;
-#endif
- while (n--)
- {
- w = *pwidth++;
- modulus (ppt->x - xrot, tileWidth, srcx);
- modulus (ppt->y - yrot, tileHeight, srcy);
-#if PSZ == 24
- xoffDst = (4 - ppt->x) & 3;
- if (w == 1 && (xoffDst == 0 || xoffDst == 1))
-#else
- xoffDst = ppt->x & PIM;
- if (xoffDst + w < PPW)
-#endif
- {
- maskpartialbits(ppt->x, w, startmask);
- endmask = 0;
- nlw = 0;
- }
- else
- {
- maskbits (ppt->x, w, startmask, endmask, nlw)
- }
-#if PSZ == 24
- pDstLine = pdstBase + (ppt->y * widthDst) + ((ppt->x *3)>> 2);
-#else
- pDstLine = pdstBase + (ppt->y * widthDst) + (ppt->x >> PWSH);
-#endif
- pSrcLine = pSrcBase + (srcy * widthSrc);
-#if PSZ == 24
- xoffSrc = (4 - srcx) & 3;
-#else
- xoffSrc = srcx & PIM;
-#endif
- if (xoffSrc >= xoffDst)
- {
- xoffStart = xoffSrc - xoffDst;
- needFirst = 1;
- }
- else
- {
-#if PSZ == 24
- xoffStart = 4 - (xoffDst - xoffSrc);
-#else
- xoffStart = PPW - (xoffDst - xoffSrc);
-#endif
- needFirst = 0;
- }
- leftShiftStart = (xoffStart) << LEFTSHIFT_AMT;
- rightShiftStart = PGSZ - leftShiftStart;
-#if PSZ == 24
- nlwSrcStart = widthSrc - ((srcx*3) >> 2);
-#else
- nlwSrcStart = widthSrc - (srcx >> PWSH);
-#endif
- /* XXX only works when narrowShift >= PPW/2 */
- if (narrowTile)
- {
- tmp = pSrcBase[srcy] & narrowMask; /* source width == 1 */
- narrow[0] = tmp | SCRRIGHT (tmp, narrowShift);
-#if PSZ == 24
- narrow[1] = BitLeft (tmp, 8) |
- BitRight(tmp, 16);
-#else
- narrow[1] = SCRLEFT (tmp, PPW - narrowShift) |
- SCRRIGHT(tmp, 2 * narrowShift - PPW);
-#endif
- pSrcLine = narrow;
- }
- xoff = xoffStart;
- leftShift = leftShiftStart;
- rightShift = rightShiftStart;
- nlwSrc = nlwSrcStart;
-#if PSZ == 24
- pSrc = pSrcLine + ((srcx * 3) >> 2);
-#else
- pSrc = pSrcLine + (srcx >> PWSH);
-#endif
- pDst = pDstLine;
- bits = 0;
- if (needFirst)
- {
- NextTileBits
- }
- if (startmask)
- {
- NextTileBits
- tmp = BitLeft(tmp, leftShift);
- if (rightShift != PGSZ)
- tmp |= BitRight(bits,rightShift);
- *pDst = MROP_MASK (tmp, *pDst, startmask);
- ++pDst;
- }
- while (nlw)
- {
-#if MROP == Mcopy
- if (nlwSrc > 1)
- {
- int nlwPart = nlw;
-
- if (nlwPart >= nlwSrc)
- nlwPart = nlwSrc - 1;
- nlw -= nlwPart;
- nlwSrc -= nlwPart;
- if (rightShift != PGSZ)
- {
- while (nlwPart--)
- {
- tmp = bits;
- bits = *pSrc++;
- *pDst = MROP_SOLID(BitLeft(tmp, leftShift) |
- BitRight (bits, rightShift),
- *pDst);
- ++pDst;
- }
- }
- else
- {
- if (nlwPart)
- {
- *pDst = MROP_SOLID (bits, *pDst);
- ++pDst;
- nlwPart--;
- while (nlwPart--)
- {
- *pDst = MROP_SOLID(*pSrc, *pDst);
- ++pDst; ++pSrc;
- }
- bits = *pSrc++;
- }
- }
- }
- else
-#endif
- {
- NextTileBits
- if (rightShift != PGSZ)
- {
- *pDst = MROP_SOLID(BitLeft(tmp, leftShift) |
- BitRight(bits, rightShift),
- *pDst);
- ++pDst;
- }
- else
- {
- *pDst = MROP_SOLID (tmp, *pDst);
- ++pDst;
- }
- nlw--;
- }
- }
- if (endmask)
- {
- NextTileBits
- if (rightShift == PGSZ)
- bits = 0;
- *pDst = MROP_MASK (BitLeft(tmp, leftShift) |
- BitRight(bits,rightShift),
- *pDst, endmask);
- }
- ppt++;
- }
-}
-
-# include "fastblt.h"
-
-#define IncSrcPtr psrc++; if (!--srcRemaining) { srcRemaining = widthSrc; psrc = psrcStart; }
-
-void
-MROP_NAME(cfbFillBoxTile32s) (pDrawable, nBox, pBox, tile, xrot, yrot, alu, planemask)
- DrawablePtr pDrawable;
- int nBox; /* number of boxes to fill */
- register BoxPtr pBox; /* pointer to list of boxes to fill */
- PixmapPtr tile; /* tile */
- int xrot, yrot;
- int alu;
- unsigned long planemask;
-{
- int tileWidth; /* width of tile */
- int tileHeight; /* height of the tile */
- int widthSrc; /* width in longwords of the source tile */
-
- int widthDst; /* width in longwords of the dest pixmap */
- int w; /* width of current box */
- int h; /* height of current box */
- CfbBits startmask;
- CfbBits endmask;/* masks for reggedy bits at either end of line */
- int nlMiddle; /* number of longwords between sides of boxes */
-
- register int nl; /* loop version of nlMiddle */
- int srcy; /* current tile y position */
- int srcx; /* current tile x position */
- int srcRemaining; /* number of longwords remaining in source */
- int xoffDst, xoffSrc;
- int srcStart; /* number of longwords source offset at left of box */
- int leftShift, rightShift;
-
-#if MROP == 0 && PSZ == 24
- DeclareMergeRop24()
-#else
- MROP_DECLARE_REG()
-#endif
-
- CfbBits *pdstBase; /* pointer to start of dest */
- CfbBits *pdstLine; /* poitner to start of dest box */
- CfbBits *psrcBase; /* pointer to start of source */
- CfbBits *psrcLine; /* pointer to fetch point of source */
- CfbBits *psrcStart; /* pointer to start of source line */
- register CfbBits *pdst;
- register CfbBits *psrc;
- register CfbBits bits, bits1;
- register int nlTemp;
-
-#if MROP == 0 && PSZ == 24
- InitializeMergeRop24 (alu, planemask)
-#else
- MROP_INITIALIZE (alu, planemask)
-#endif
-
- psrcBase = (CfbBits *)tile->devPrivate.ptr;
- tileHeight = tile->drawable.height;
- tileWidth = tile->drawable.width;
-#if PSZ == 24
- widthSrc = tile->devKind / PGSZB;
-#else
- widthSrc = tileWidth >> PWSH;
-#endif
-
- cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase)
-
- while (nBox--)
- {
- w = pBox->x2 - pBox->x1;
- h = pBox->y2 - pBox->y1;
-
- /* set up source */
- modulus (pBox->x1 - xrot, tileWidth, srcx);
- modulus (pBox->y1 - yrot, tileHeight, srcy);
-#if PSZ == 24
- xoffSrc = (4 - srcx) & 3;
- srcStart = (srcx * 3) >> 2;
-#else
- xoffSrc = srcx & PIM;
- srcStart = (srcx >> PWSH);
-#endif
- psrcStart = psrcBase + (srcy * widthSrc);
- psrcLine = psrcStart + srcStart;
-
- /* set up dest */
-#if PSZ == 24
- xoffDst = (4 - pBox->x1) & 3;
- pdstLine = pdstBase + (pBox->y1 * widthDst) + ((pBox->x1*3) >> 2);
-#else
- xoffDst = pBox->x1 & PIM;
- pdstLine = pdstBase + (pBox->y1 * widthDst) + (pBox->x1 >> PWSH);
-#endif
- /* set up masks */
-#if PSZ == 24
- if (w == 1 && (xoffDst == 0 || xoffDst == 1))
-#else
- if (xoffDst + w < PPW)
-#endif
- {
- maskpartialbits(pBox->x1, w, startmask);
- endmask = 0;
- nlMiddle = 0;
- }
- else
- {
- maskbits (pBox->x1, w, startmask, endmask, nlMiddle)
- }
- if (xoffSrc == xoffDst)
- {
- while (h--)
- {
- psrc = psrcLine;
- pdst = pdstLine;
- srcRemaining = widthSrc - srcStart;
- if (startmask)
- {
- *pdst = MROP_MASK (*psrc, *pdst, startmask);
- pdst++;
- IncSrcPtr
- }
- nlTemp = nlMiddle;
- while (nlTemp)
- {
- nl = nlTemp;
- if (nl > srcRemaining)
- nl = srcRemaining;
-
- nlTemp -= nl;
- srcRemaining -= nl;
-
-#if MROP == Mcopy
-#ifdef LARGE_INSTRUCTION_CACHE
-#ifdef FAST_CONSTANT_OFFSET_MODE
-
- psrc += nl & (UNROLL-1);
- pdst += nl & (UNROLL-1);
-
-#define BodyOdd(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]);
-#define BodyEven(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]);
-
-#define LoopReset \
-pdst += UNROLL; \
-psrc += UNROLL;
-
-#else
-
-#define BodyOdd(n) *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++;
-#define BodyEven(n) BodyOdd(n)
-
-#define LoopReset ;
-
-#endif
- PackedLoop
-
-#undef BodyOdd
-#undef BodyEven
-#undef LoopReset
-
-#else
- DuffL(nl, label1,
- *pdst = MROP_SOLID (*psrc, *pdst);
- pdst++; psrc++;)
-#endif
-#else
- while (nl--) {
- *pdst = MROP_SOLID (*psrc, *pdst);
- pdst++; psrc++;
- }
-#endif
- if (!srcRemaining)
- {
- srcRemaining = widthSrc;
- psrc = psrcStart;
- }
- }
- if (endmask)
- {
- *pdst = MROP_MASK (*psrc, *pdst, endmask);
- }
- pdstLine += widthDst;
- psrcLine += widthSrc;
- psrcStart += widthSrc;
- if (++srcy == tileHeight)
- {
- psrcStart = psrcBase;
- psrcLine = psrcStart + srcStart;
- srcy = 0;
- }
- }
- }
- else
- {
- if (xoffSrc > xoffDst)
- {
- leftShift = (xoffSrc - xoffDst) << LEFTSHIFT_AMT;
- rightShift = PGSZ - leftShift;
- }
- else
- {
- rightShift = (xoffDst - xoffSrc) << LEFTSHIFT_AMT;
- leftShift = PGSZ - rightShift;
- }
- while (h--)
- {
- psrc = psrcLine;
- pdst = pdstLine;
- bits = 0;
- srcRemaining = widthSrc - srcStart;
- if (xoffSrc > xoffDst)
- {
- bits = *psrc;
- IncSrcPtr
- }
- if (startmask)
- {
- bits1 = BitLeft(bits,leftShift);
- bits = *psrc;
- IncSrcPtr
- bits1 |= BitRight(bits,rightShift);
- *pdst = MROP_MASK(bits1, *pdst, startmask);
- pdst++;
- }
- nlTemp = nlMiddle;
- while (nlTemp)
- {
- nl = nlTemp;
- if (nl > srcRemaining)
- nl = srcRemaining;
-
- nlTemp -= nl;
- srcRemaining -= nl;
-
-#if MROP == Mcopy
-#ifdef LARGE_INSTRUCTION_CACHE
- bits1 = bits;
-
-#ifdef FAST_CONSTANT_OFFSET_MODE
-
- psrc += nl & (UNROLL-1);
- pdst += nl & (UNROLL-1);
-
-#define BodyOdd(n) \
- bits = psrc[-n]; \
- pdst[-n] = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), pdst[-n]);
-
-#define BodyEven(n) \
- bits1 = psrc[-n]; \
- pdst[-n] = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), pdst[-n]);
-
-#define LoopReset \
- pdst += UNROLL; \
- psrc += UNROLL;
-
-#else
-
-#define BodyOdd(n) \
- bits = *psrc++; \
- *pdst = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), *pdst); \
- pdst++;
-
-#define BodyEven(n) \
- bits1 = *psrc++; \
- *pdst = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), *pdst); \
- pdst++;
-
-#define LoopReset ;
-
-#endif /* !FAST_CONSTANT_OFFSET_MODE */
-
- PackedLoop
-
-#undef BodyOdd
-#undef BodyEven
-#undef LoopReset
-
-#else
- DuffL (nl,label2,
- bits1 = BitLeft(bits, leftShift);
- bits = *psrc++;
- *pdst = MROP_SOLID (bits1 | BitRight(bits, rightShift), *pdst);
- pdst++;
- )
-#endif
-#else
- while (nl--) {
- bits1 = BitLeft(bits, leftShift);
- bits = *psrc++;
- *pdst = MROP_SOLID (bits1 | BitRight(bits, rightShift), *pdst);
- pdst++;
- }
-#endif
- if (!srcRemaining)
- {
- srcRemaining = widthSrc;
- psrc = psrcStart;
- }
- }
-
- if (endmask)
- {
- bits1 = BitLeft(bits, leftShift);
- if (BitLeft(endmask, rightShift))
- {
- bits = *psrc;
- bits1 |= BitRight(bits, rightShift);
- }
- *pdst = MROP_MASK (bits1, *pdst, endmask);
- }
- pdstLine += widthDst;
- psrcLine += widthSrc;
- psrcStart += widthSrc;
- if (++srcy == tileHeight)
- {
- psrcStart = psrcBase;
- psrcLine = psrcStart + srcStart;
- srcy = 0;
- }
- }
- }
- pBox++;
- }
-}
-
-void
-MROP_NAME(cfbFillSpanTile32s) (pDrawable, n, ppt, pwidth, tile, xrot, yrot, alu, planemask)
- DrawablePtr pDrawable;
- int n;
- DDXPointPtr ppt;
- int *pwidth;
- PixmapPtr tile;
- int xrot, yrot;
- int alu;
- unsigned long planemask;
-{
- int tileWidth; /* width of tile */
- int tileHeight; /* height of the tile */
- int widthSrc; /* width in longwords of the source tile */
-
- int widthDst; /* width in longwords of the dest pixmap */
- int w; /* width of current box */
- CfbBits startmask;
- CfbBits endmask;/* masks for reggedy bits at either end of line */
- int nlMiddle; /* number of longwords between sides of boxes */
-
- register int nl; /* loop version of nlMiddle */
- int srcy; /* current tile y position */
- int srcx; /* current tile x position */
- int srcRemaining; /* number of longwords remaining in source */
- int xoffDst, xoffSrc;
- int srcStart; /* number of longwords source offset at left of box */
- int leftShift, rightShift;
-
-#if MROP == 0 && PSZ == 24
- DeclareMergeRop24()
-#else
- MROP_DECLARE_REG()
-#endif
-
- CfbBits *pdstBase; /* pointer to start of dest */
- CfbBits *pdstLine; /* poitner to start of dest box */
- CfbBits *psrcBase; /* pointer to start of source */
- CfbBits *psrcLine; /* pointer to fetch point of source */
- CfbBits *psrcStart; /* pointer to start of source line */
- register CfbBits *pdst;
- register CfbBits *psrc;
- register CfbBits bits, bits1;
- register int nlTemp;
-
-#if MROP == 0 && PSZ == 24
- InitializeMergeRop24 (alu, planemask)
-#else
- MROP_INITIALIZE (alu, planemask)
-#endif
-
- psrcBase = (CfbBits *)tile->devPrivate.ptr;
- tileHeight = tile->drawable.height;
- tileWidth = tile->drawable.width;
-#if PSZ == 24
- widthSrc = tile->devKind / PGSZB;
-#else
- widthSrc = tileWidth >> PWSH;
-#endif
-
- cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase)
-
- while (n--)
- {
- w = *pwidth++;
-
- /* set up source */
- modulus (ppt->x - xrot, tileWidth, srcx);
- modulus (ppt->y - yrot, tileHeight, srcy);
-#if PSZ == 24
- xoffSrc = (4 - srcx) & 3;
- srcStart = (srcx * 3) >> 2;
-#else
- xoffSrc = srcx & PIM;
- srcStart = (srcx >> PWSH);
-#endif
- psrcStart = psrcBase + (srcy * widthSrc);
- psrcLine = psrcStart + srcStart;
-
- /* set up dest */
-#if PSZ == 24
- xoffDst = (4 - ppt->x) & 3;
- pdstLine = pdstBase + (ppt->y * widthDst) + ((ppt->x *3) >> 2);
- /* set up masks */
- if (w == 1 && (xoffDst == 0 || xoffDst == 1))
-#else
- xoffDst = ppt->x & PIM;
- pdstLine = pdstBase + (ppt->y * widthDst) + (ppt->x >> PWSH);
- /* set up masks */
- if (xoffDst + w < PPW)
-#endif
- {
- maskpartialbits(ppt->x, w, startmask);
- endmask = 0;
- nlMiddle = 0;
- }
- else
- {
- maskbits (ppt->x, w, startmask, endmask, nlMiddle)
- }
-
- if (xoffSrc == xoffDst)
- {
- psrc = psrcLine;
- pdst = pdstLine;
- srcRemaining = widthSrc - srcStart;
- if (startmask)
- {
- *pdst = MROP_MASK (*psrc, *pdst, startmask);
- pdst++;
- IncSrcPtr
- }
- nlTemp = nlMiddle;
- while (nlTemp)
- {
- nl = nlTemp;
- if (nl > srcRemaining)
- nl = srcRemaining;
-
- nlTemp -= nl;
- srcRemaining -= nl;
-
-#if MROP == Mcopy
-#ifdef LARGE_INSTRUCTION_CACHE
-#ifdef FAST_CONSTANT_OFFSET_MODE
-
- psrc += nl & (UNROLL-1);
- pdst += nl & (UNROLL-1);
-
-#define BodyOdd(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]);
-#define BodyEven(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]);
-
-#define LoopReset \
-pdst += UNROLL; \
-psrc += UNROLL;
-
-#else
-
-#define BodyOdd(n) *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++;
-#define BodyEven(n) BodyOdd(n)
-
-#define LoopReset ;
-
-#endif
- PackedLoop
-
-#undef BodyOdd
-#undef BodyEven
-#undef LoopReset
-
-#else
- DuffL(nl, label1,
- *pdst = MROP_SOLID (*psrc, *pdst);
- pdst++; psrc++;)
-#endif
-#else
- while (nl--) {
- *pdst = MROP_SOLID (*psrc, *pdst);
- pdst++; psrc++;
- }
-#endif
- if (!srcRemaining)
- {
- srcRemaining = widthSrc;
- psrc = psrcStart;
- }
- }
- if (endmask)
- {
- *pdst = MROP_MASK (*psrc, *pdst, endmask);
- }
- }
- else
- {
- if (xoffSrc > xoffDst)
- {
- leftShift = (xoffSrc - xoffDst) << LEFTSHIFT_AMT;
- rightShift = PGSZ - leftShift;
- }
- else
- {
- rightShift = (xoffDst - xoffSrc) << LEFTSHIFT_AMT;
- leftShift = PGSZ - rightShift;
- }
- psrc = psrcLine;
- pdst = pdstLine;
- bits = 0;
- srcRemaining = widthSrc - srcStart;
- if (xoffSrc > xoffDst)
- {
- bits = *psrc;
- IncSrcPtr
- }
- if (startmask)
- {
- bits1 = BitLeft(bits,leftShift);
- bits = *psrc;
- IncSrcPtr
- bits1 |= BitRight(bits,rightShift);
- *pdst = MROP_MASK(bits1, *pdst, startmask);
- pdst++;
- }
- nlTemp = nlMiddle;
- while (nlTemp)
- {
- nl = nlTemp;
- if (nl > srcRemaining)
- nl = srcRemaining;
-
- nlTemp -= nl;
- srcRemaining -= nl;
-
-#if MROP == Mcopy
-#ifdef LARGE_INSTRUCTION_CACHE
- bits1 = bits;
-
-#ifdef FAST_CONSTANT_OFFSET_MODE
-
- psrc += nl & (UNROLL-1);
- pdst += nl & (UNROLL-1);
-
-#define BodyOdd(n) \
-bits = psrc[-n]; \
-pdst[-n] = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), pdst[-n]);
-
-#define BodyEven(n) \
-bits1 = psrc[-n]; \
-pdst[-n] = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), pdst[-n]);
-
-#define LoopReset \
-pdst += UNROLL; \
-psrc += UNROLL;
-
-#else
-
-#define BodyOdd(n) \
-bits = *psrc++; \
-*pdst = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), *pdst); \
-pdst++;
-
-#define BodyEven(n) \
-bits1 = *psrc++; \
-*pdst = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), *pdst); \
-pdst++;
-
-#define LoopReset ;
-
-#endif /* !FAST_CONSTANT_OFFSET_MODE */
-
- PackedLoop
-
-#undef BodyOdd
-#undef BodyEven
-#undef LoopReset
-
-#else
- DuffL (nl,label2,
- bits1 = BitLeft(bits, leftShift);
- bits = *psrc++;
- *pdst = MROP_SOLID (bits1 | BitRight(bits, rightShift), *pdst);
- pdst++;
- )
-#endif
-#else
- while (nl--) {
- bits1 = BitLeft(bits,leftShift);
- bits = *psrc++;
- *pdst = MROP_SOLID(bits1|BitRight(bits,rightShift), *pdst);
- pdst++;
- }
-#endif
- if (!srcRemaining)
- {
- srcRemaining = widthSrc;
- psrc = psrcStart;
- }
- }
-
- if (endmask)
- {
- bits1 = BitLeft(bits, leftShift);
- if (BitLeft(endmask, rightShift))
- {
- bits = *psrc;
- bits1 |= BitRight(bits, rightShift);
- }
- *pdst = MROP_MASK (bits1, *pdst, endmask);
- }
- }
- ppt++;
- }
-}
diff --git a/cfb/cfbunmap.h b/cfb/cfbunmap.h
deleted file mode 100644
index db9889217..000000000
--- a/cfb/cfbunmap.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * 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 cfbClearVisualTypes
-#undef cfbCloseScreen
-#undef cfbCreateDefColormap
-#undef cfbCopyArea
-#undef cfbCopyImagePlane
-#undef cfbCopyPixmap
-#undef cfbCopyPlane
-#undef cfbCopyPlaneReduce
-#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 cfbExpandDirectColors
-#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 cfbGCPrivateKey
-#undef cfbGetImage
-#undef cfbGetScreenPixmap
-#undef cfbGetSpans
-#undef cfbHorzS
-#undef cfbImageGlyphBlt8
-#undef cfbInitializeColormap
-#undef cfbInitVisuals
-#undef cfbInstallColormap
-#undef cfbLineSD
-#undef cfbLineSS
-#undef cfbListInstalledColormaps
-#undef cfbMapWindow
-#undef cfbMatchCommon
-#undef cfbNonTEOps
-#undef cfbNonTEOps1Rect
-#undef cfbPadPixmap
-#undef cfbPolyFillArcSolidCopy
-#undef cfbPolyFillArcSolidGeneral
-#undef cfbPolyFillRect
-#undef cfbPolyGlyphBlt8
-#undef cfbPolyGlyphRop8
-#undef cfbPolyPoint
-#undef cfbPositionWindow
-#undef cfbPutImage
-#undef cfbReduceRasterOp
-#undef cfbResolveColor
-#undef cfbRestoreAreas
-#undef cfbSaveAreas
-#undef cfbScreenInit
-#undef cfbScreenPrivateKey
-#undef cfbSegmentSD
-#undef cfbSegmentSS
-#undef cfbSetScanline
-#undef cfbSetScreenPixmap
-#undef cfbSetSpans
-#undef cfbSetVisualTypes
-#undef cfbSetupScreen
-#undef cfbSolidSpansCopy
-#undef cfbSolidSpansGeneral
-#undef cfbSolidSpansXor
-#undef cfbStippleStack
-#undef cfbStippleStackTE
-#undef cfbTEGlyphBlt
-#undef cfbTEOps
-#undef cfbTEOps1Rect
-#undef cfbTile32FSCopy
-#undef cfbTile32FSGeneral
-#undef cfbUninstallColormap
-#undef cfbUnmapWindow
-#undef cfbUnnaturalStippleFS
-#undef cfbUnnaturalTileFS
-#undef cfbValidateGC
-#undef cfbVertS
-#undef cfbWindowPrivateKey
-#undef cfbXRotatePixmap
-#undef cfbYRotatePixmap
-#undef cfbZeroPolyArcSS8Copy
-#undef cfbZeroPolyArcSS8General
-#undef cfbZeroPolyArcSS8Xor
-#undef cfbendpartial
-#undef cfbendtab
-#undef cfbmask
-#undef cfbrmask
-#undef cfbstartpartial
-#undef cfbstarttab
diff --git a/cfb/cfbwindow.c b/cfb/cfbwindow.c
deleted file mode 100644
index 50728764e..000000000
--- a/cfb/cfbwindow.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 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.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "windowstr.h"
-#include "cfb.h"
-#include "mistruct.h"
-#include "regionstr.h"
-#include "cfbmskbits.h"
-
-Bool
-cfbCreateWindow(WindowPtr pWin)
-{
-#ifdef PIXMAP_PER_WINDOW
- /* Setup pointer to Screen pixmap */
- dixSetPrivate(&pWin->devPrivates, frameWindowPrivateKey,
- cfbGetScreenPixmap(pWin->drawable.pScreen));
-#endif
-
- return TRUE;
-}
-
-Bool
-cfbDestroyWindow(WindowPtr pWin)
-{
- return(TRUE);
-}
-
-/*ARGSUSED*/
-Bool
-cfbMapWindow(pWindow)
- WindowPtr pWindow;
-{
- return(TRUE);
-}
-
-/*ARGSUSED*/
-Bool
-cfbPositionWindow(WindowPtr pWin, int x, int y)
-{
- return (TRUE);
-}
-
-/*ARGSUSED*/
-Bool
-cfbUnmapWindow(pWindow)
- WindowPtr pWindow;
-{
- return (TRUE);
-}
-
-/* UNCLEAN!
- this code calls the bitblt helper code directly.
-
- cfbCopyWindow copies only the parts of the destination that are
-visible in the source.
-*/
-
-
-void
-cfbCopyWindow(pWin, ptOldOrg, prgnSrc)
- WindowPtr pWin;
- DDXPointRec ptOldOrg;
- RegionPtr prgnSrc;
-{
- DDXPointPtr pptSrc;
- register DDXPointPtr ppt;
- RegionRec rgnDst;
- register BoxPtr pbox;
- register int dx, dy;
- register int i, nbox;
- WindowPtr pwinRoot;
-
- pwinRoot = WindowTable[pWin->drawable.pScreen->myNum];
-
- REGION_NULL(pWin->drawable.pScreen, &rgnDst);
-
- dx = ptOldOrg.x - pWin->drawable.x;
- dy = ptOldOrg.y - pWin->drawable.y;
- REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy);
- REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst, &pWin->borderClip, prgnSrc);
-
- pbox = REGION_RECTS(&rgnDst);
- nbox = REGION_NUM_RECTS(&rgnDst);
- if(!nbox || !(pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec))))
- {
- REGION_UNINIT(pWin->drawable.pScreen, &rgnDst);
- return;
- }
- ppt = pptSrc;
-
- for (i = nbox; --i >= 0; ppt++, pbox++)
- {
- ppt->x = pbox->x1 + dx;
- ppt->y = pbox->y1 + dy;
- }
-
- cfbDoBitbltCopy((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
- GXcopy, &rgnDst, pptSrc, ~0L);
- xfree(pptSrc);
- REGION_UNINIT(pWin->drawable.pScreen, &rgnDst);
-}
-
-Bool
-cfbChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
-{
- return (TRUE);
-}
-
diff --git a/cfb/cfbzerarc.c b/cfb/cfbzerarc.c
deleted file mode 100644
index 5b8879ee1..000000000
--- a/cfb/cfbzerarc.c
+++ /dev/null
@@ -1,322 +0,0 @@
-/************************************************************
-
-Copyright 1989, 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.
-
-********************************************************/
-
-
-/* Derived from:
- * "Algorithm for drawing ellipses or hyperbolae with a digital plotter"
- * by M. L. V. Pitteway
- * The Computer Journal, November 1967, Volume 10, Number 3, pp. 282-289
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <limits.h>
-
-#include <X11/X.h>
-#include <X11/Xprotostr.h>
-#include "regionstr.h"
-#include "gcstruct.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-#include "cfb.h"
-#include "cfbmskbits.h"
-#include "mizerarc.h"
-#include "cfbrrop.h"
-#include "mi.h"
-
-#ifdef PIXEL_ADDR
-
-static void
-RROP_NAME(cfbZeroArcSS8)(
- DrawablePtr pDraw,
- GCPtr pGC,
- xArc *arc)
-{
- miZeroArcRec info;
- Bool do360;
- register int x;
- PixelType *addrp;
- register PixelType *yorgp, *yorgop;
-#if PSZ == 24
- int xorg, xorg3, xorgo, xorgo3;
- register int xtmp;
-#endif
- RROP_DECLARE
- register int yoffset;
- int npwidth, dyoffset;
- register int y, a, b, d, mask;
- register int k1, k3, dx, dy;
-
- cfbGetPixelWidthAndPointer(pDraw,npwidth, addrp)
-
- RROP_FETCH_GC (pGC);
- do360 = miZeroArcSetup(arc, &info, TRUE);
- yorgp = addrp + ((info.yorg + pDraw->y) * npwidth);
- yorgop = addrp + ((info.yorgo + pDraw->y) * npwidth);
- info.xorg += pDraw->x;
- info.xorgo += pDraw->x;
-#if PSZ == 24
- xorg = info.xorg;
- xorg3 = xorg * 3;
- info.xorg = (info.xorg * 3) >> 2;
- xorgo = info.xorgo;
- xorgo3 = xorgo * 3;
- info.xorgo = (info.xorgo * 3) >> 2;
-#endif
- MIARCSETUP();
- yoffset = y ? npwidth : 0;
- dyoffset = 0;
- mask = info.initialMask;
- if (!(arc->width & 1))
- {
-#if PSZ == 24
- if (mask & 2)
- RROP_SOLID24((yorgp + info.xorgo), xorgo);
- if (mask & 8)
- RROP_SOLID24((yorgop + info.xorgo), xorgo);
-#else
- if (mask & 2)
- RROP_SOLID((yorgp + info.xorgo));
- if (mask & 8)
- RROP_SOLID((yorgop + info.xorgo));
-#endif /* PSZ == 24 */
- }
- if (!info.end.x || !info.end.y)
- {
- mask = info.end.mask;
- info.end = info.altend;
- }
- if (do360 && (arc->width == arc->height) && !(arc->width & 1))
- {
- register int xoffset = npwidth;
-#if PSZ == 24
- PixelType *yorghb = yorgp + (info.h * npwidth);
- register int tmp1, tmp2, tmp1_3, tmp2_3;
-
- tmp1 = xorg + info.h;
- tmp1_3 = tmp1 * 3;
- tmp2 = xorg - info.h;
- tmp2_3 = tmp2 * 3;
- while (1)
- {
- xtmp = (xorg3 + x * 3) >> 2;
- RROP_SOLID24(yorgp + yoffset + xtmp, xorg + x);
- RROP_SOLID24(yorgop - yoffset + xtmp, xorg + x);
- xtmp = (xorg3 - x * 3) >> 2;
- RROP_SOLID24(yorgp + yoffset + xtmp, xorg - x);
- RROP_SOLID24(yorgop - yoffset + xtmp, xorg - x);
- if (a < 0)
- break;
- xtmp = (tmp1_3 - y * 3) >> 2;
- RROP_SOLID24(yorghb - xoffset + xtmp, tmp1 - y);
- RROP_SOLID24(yorghb + xoffset + xtmp, tmp1 - y);
- xtmp = (tmp2_3 + y * 3) >> 2;
- RROP_SOLID24(yorghb - xoffset + xtmp, tmp2 + y);
- RROP_SOLID24(yorghb + xoffset + xtmp, tmp2 + y);
- xoffset += npwidth;
- MIARCCIRCLESTEP(yoffset += npwidth;);
- }
-#else
- PixelType *yorghb = yorgp + (info.h * npwidth) + info.xorg;
- PixelType *yorgohb = yorghb - info.h;
-
- yorgp += info.xorg;
- yorgop += info.xorg;
- yorghb += info.h;
- while (1)
- {
- RROP_SOLID(yorgp + yoffset + x);
- RROP_SOLID(yorgp + yoffset - x);
- RROP_SOLID(yorgop - yoffset - x);
- RROP_SOLID(yorgop - yoffset + x);
- if (a < 0)
- break;
- RROP_SOLID(yorghb - xoffset - y);
- RROP_SOLID(yorgohb - xoffset + y);
- RROP_SOLID(yorgohb + xoffset + y);
- RROP_SOLID(yorghb + xoffset - y);
- xoffset += npwidth;
- MIARCCIRCLESTEP(yoffset += npwidth;);
- }
- yorgp -= info.xorg;
- yorgop -= info.xorg;
-#endif /* PSZ == 24 */
- x = info.w;
- yoffset = info.h * npwidth;
- }
- else if (do360)
- {
- while (y < info.h || x < info.w)
- {
- MIARCOCTANTSHIFT(dyoffset = npwidth;);
-#if PSZ == 24
- xtmp = (xorg3 + x * 3) >> 2;
- RROP_SOLID24(yorgp + yoffset + xtmp, xorg + x);
- RROP_SOLID24(yorgop - yoffset + xtmp, xorg + x);
- xtmp = (xorgo3 - x * 3) >> 2;
- RROP_SOLID24(yorgp + yoffset + xtmp, xorgo - x);
- RROP_SOLID24(yorgop - yoffset + xtmp, xorgo - x);
-#else
- RROP_SOLID(yorgp + yoffset + info.xorg + x);
- RROP_SOLID(yorgp + yoffset + info.xorgo - x);
- RROP_SOLID(yorgop - yoffset + info.xorgo - x);
- RROP_SOLID(yorgop - yoffset + info.xorg + x);
-#endif
- MIARCSTEP(yoffset += dyoffset;, yoffset += npwidth;);
- }
- }
- else
- {
- while (y < info.h || x < info.w)
- {
- MIARCOCTANTSHIFT(dyoffset = npwidth;);
- if ((x == info.start.x) || (y == info.start.y))
- {
- mask = info.start.mask;
- info.start = info.altstart;
- }
-#if PSZ == 24
- if (mask & 1){
- xtmp = (xorg3 + x * 3) >> 2;
- RROP_SOLID24(yorgp + yoffset + xtmp, xorg + x);
- }
- if (mask & 2){
- xtmp = (xorgo3 - x * 3) >> 2;
- RROP_SOLID24(yorgp + yoffset + xtmp, xorgo - x);
- }
- if (mask & 4){
- xtmp = (xorgo3 - x * 3) >> 2;
- RROP_SOLID24(yorgop - yoffset + xtmp, xorgo - x);
- }
- if (mask & 8){
- xtmp = (xorg3 + x * 3) >> 2;
- RROP_SOLID24(yorgop - yoffset + xtmp, xorg + x);
- }
-#else
- if (mask & 1)
- RROP_SOLID(yorgp + yoffset + info.xorg + x);
- if (mask & 2)
- RROP_SOLID(yorgp + yoffset + info.xorgo - x);
- if (mask & 4)
- RROP_SOLID(yorgop - yoffset + info.xorgo - x);
- if (mask & 8)
- RROP_SOLID(yorgop - yoffset + info.xorg + x);
-#endif /* PSZ == 24 */
- if ((x == info.end.x) || (y == info.end.y))
- {
- mask = info.end.mask;
- info.end = info.altend;
- }
- MIARCSTEP(yoffset += dyoffset;, yoffset += npwidth;);
- }
- }
- if ((x == info.start.x) || (y == info.start.y))
- mask = info.start.mask;
-#if PSZ == 24
- if (mask & 1){
- xtmp = (xorg3 + x * 3) >> 2;
- RROP_SOLID24(yorgp + yoffset + xtmp, xorg + x);
- }
- if (mask & 4){
- xtmp = (xorgo3 - x * 3) >> 2;
- RROP_SOLID24(yorgop - yoffset + xtmp, xorgo - x);
- }
-#else
- if (mask & 1)
- RROP_SOLID(yorgp + yoffset + info.xorg + x);
- if (mask & 4)
- RROP_SOLID(yorgop - yoffset + info.xorgo - x);
-#endif /* PSZ == 24 */
- if (arc->height & 1)
- {
-#if PSZ == 24
- if (mask & 2){
- xtmp = (xorgo3 - x * 3) >> 2;
- RROP_SOLID24(yorgp + yoffset + xtmp, xorgo - x);
- }
- if (mask & 8){
- xtmp = (xorg3 + x * 3) >> 2;
- RROP_SOLID24(yorgop - yoffset + xtmp, xorg + x);
- }
-#else
- if (mask & 2)
- RROP_SOLID(yorgp + yoffset + info.xorgo - x);
- if (mask & 8)
- RROP_SOLID(yorgop - yoffset + info.xorg + x);
-#endif /* PSZ == 24 */
- }
- RROP_UNDECLARE
-}
-
-void
-RROP_NAME (cfbZeroPolyArcSS8) (pDraw, pGC, narcs, parcs)
- register DrawablePtr pDraw;
- GCPtr pGC;
- int narcs;
- xArc *parcs;
-{
- register xArc *arc;
- register int i;
- BoxRec box;
- int x2, y2;
- RegionPtr cclip;
-
- cclip = cfbGetCompositeClip(pGC);
- for (arc = parcs, i = narcs; --i >= 0; arc++)
- {
- if (miCanZeroArc(arc))
- {
- box.x1 = arc->x + pDraw->x;
- box.y1 = arc->y + pDraw->y;
- /*
- * Because box.x2 and box.y2 get truncated to 16 bits, and the
- * RECT_IN_REGION test treats the resulting number as a signed
- * integer, the RECT_IN_REGION test alone can go the wrong way.
- * This can result in a server crash because the rendering
- * routines in this file deal directly with cpu addresses
- * of pixels to be stored, and do not clip or otherwise check
- * that all such addresses are within their respective pixmaps.
- * So we only allow the RECT_IN_REGION test to be used for
- * values that can be expressed correctly in a signed short.
- */
- x2 = box.x1 + (int)arc->width + 1;
- box.x2 = x2;
- y2 = box.y1 + (int)arc->height + 1;
- box.y2 = y2;
- if ( (x2 <= SHRT_MAX) && (y2 <= SHRT_MAX) &&
- (RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN) )
- RROP_NAME (cfbZeroArcSS8) (pDraw, pGC, arc);
- else
- miZeroPolyArc(pDraw, pGC, 1, arc);
- }
- else
- miPolyArc(pDraw, pGC, 1, arc);
- }
-}
-
-#endif
diff --git a/cfb/stip68kgnu.h b/cfb/stip68kgnu.h
deleted file mode 100644
index 2da27b4dd..000000000
--- a/cfb/stip68kgnu.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- *
-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
- */
-
-/*
- * Stipple stack macro for 68k GCC
- */
-
-#define STIPPLE(addr,stipple,value,width,count,shift) \
- __asm volatile ( \
- "lea 5f,%/a1\n\
- moveq #28,%/d2\n\
- addl %2,%/d2\n\
- moveq #28,%/d3\n\
- subql #4,%2\n\
- negl %2\n\
-1:\n\
- movel %0,%/a0\n\
- addl %6,%0\n\
- movel %3@+,%/d1\n\
- jeq 3f\n\
- movel %/d1,%/d0\n\
- lsrl %/d2,%/d0\n\
- lsll #5,%/d0\n\
- lsll %2,%/d1\n\
- jmp %/a1@(%/d0:l)\n\
-2:\n\
- addl #4,%/a0\n\
- movel %/d1,%/d0\n\
- lsrl %/d3,%/d0\n\
- lsll #5,%/d0\n\
- lsll #4,%/d1\n\
- jmp %/a1@(%/d0:l)\n\
-5:\n\
- jne 2b ; dbra %1,1b ; jra 4f\n\
- . = 5b + 0x20\n\
- moveb %5,%/a0@(3)\n\
- andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f\n\
- . = 5b + 0x40\n\
- moveb %5,%/a0@(2)\n\
- andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f\n\
- . = 5b + 0x60\n\
- movew %5,%/a0@(2)\n\
- andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f\n\
- . = 5b + 0x80\n\
- moveb %5,%/a0@(1)\n\
- andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
- . = 5b + 0xa0\n\
- moveb %5,%/a0@(3) ; moveb %5,%/a0@(1)\n\
- andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
- . = 5b + 0xc0\n\
- movew %5,%/a0@(1)\n\
- andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
- . = 5b + 0xe0\n\
- movew %5,%/a0@(2) ; moveb %5,%/a0@(1)\n\
- andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
- . = 5b + 0x100\n\
- moveb %5,%/a0@\n\
- andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
- . = 5b + 0x120\n\
- moveb %5,%/a0@(3) ; moveb %5,%/a0@\n\
- andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
- . = 5b + 0x140\n\
- moveb %5,%/a0@(2) ; moveb %5,%/a0@\n\
- andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
- . = 5b + 0x160\n\
- movew %5,%/a0@(2) ; moveb %5,%/a0@\n\
- andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
- . = 5b + 0x180\n\
- movew %5,%/a0@\n\
- andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
- . = 5b + 0x1a0\n\
- moveb %5,%/a0@(3) ; movew %5,%/a0@\n\
- andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
- . = 5b + 0x1c0\n\
- moveb %5,%/a0@(2) ; movew %5,%/a0@\n\
- andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\
- . = 5b + 0x1e0\n\
- movel %5,%/a0@\n\
- andl %/d1,%/d1 ; jne 2b ; \n\
-3: dbra %1,1b ; \n\
-4:\n"\
- : "=a" (addr), /* %0 */ \
- "=d" (count), /* %1 */ \
- "=d" (shift), /* %2 */ \
- "=a" (stipple) /* %3 */ \
- : "0" (addr), /* %4 */ \
- "d" (value), /* %5 */ \
- "a" (width), /* %6 */ \
- "1" (count-1), /* %7 */ \
- "2" (shift), /* %8 */ \
- "3" (stipple) /* %9 */ \
- : /* ctemp */ "d0", \
- /* c */ "d1", \
- /* lshift */ "d2", \
- /* rshift */ "d3", \
- /* atemp */ "a0", \
- /* case */ "a1")
diff --git a/cfb/stipmips.s b/cfb/stipmips.s
deleted file mode 100644
index c42d9b5ae..000000000
--- a/cfb/stipmips.s
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * $Xorg: stipmips.s,v 1.4 2001/02/09 02:04:39 xorgcvs Exp $
- *
-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
- */
-
-/*
- * MIPS assembly code for optimized text rendering.
- *
- * Other stippling could be done in assembly, but the payoff is
- * not nearly as large. Mostly because large areas are heavily
- * optimized already.
- */
-
-#ifdef MIPSEL
-# define BitsR sll
-# define BitsL srl
-# define BO(o) o
-# define HO(o) o
-# define WO(o) o
-# define FourBits(dest,bits) and dest, bits, 0xf
-#else
-# define BitsR srl
-# define BitsL sll
-# define BO(o) 3-o
-# define HO(o) 2-o
-# define WO(o) o
-# define FourBits(dest,bits) srl dest, bits, 28
-#endif
-
-/* reordering instructions would be fatal here */
- .set noreorder
-
-
-/*
- * cfbStippleStack(addr, stipple, value, stride, Count, Shift)
- * 4 5 6 7 16(sp) 20(sp)
- *
- * Apply successive 32-bit stipples starting at addr, addr+stride, ...
- *
- * Used for text rendering, but only when no data could be lost
- * when the stipple is shifted left by Shift bits
- */
-/* arguments */
-#define addr $4
-#define stipple $5
-#define value $6
-#define stride $7
-#define Count 16($sp)
-#define Shift 20($sp)
-
-/* local variables */
-#define count $14
-#define shift $13
-#define atemp $12
-#define bits $11
-#define lshift $9
-#define sbase $8
-#define stemp $2
-
-#define CASE_SIZE 5 /* case blocks are 2^5 bytes each */
-#define CASE_MASK 0x1e0 /* first case mask */
-
-#define ForEachLine $200
-#define NextLine $201
-#define NextLine1 $202
-#define CaseBegin $203
-#define ForEachBits $204
-#define ForEachBits1 $205
-#define NextBits $206
-
-#ifdef TETEXT
-#define cfbStippleStack cfbStippleStackTE
-#endif
-
- .globl cfbStippleStack
- .ent cfbStippleStack 2
-cfbStippleStack:
- .frame $sp, 0, $31
- lw count, Count /* fetch stack params */
- la sbase,CaseBegin /* load up switch table */
- lw shift, Shift
- li lshift, 4 /* compute offset within */
- subu lshift, lshift, shift /* stipple of remaining bits */
-#ifdef MIPSEL
- addu shift, shift, CASE_SIZE /* first shift for LSB */
-#else
- addu shift, shift, 28-CASE_SIZE /* first shift for MSB */
-#endif
- /* do ... while (--count > 0); */
-ForEachLine:
- lw bits, 0(stipple) /* get stipple bits */
- move atemp, addr /* set up for this line */
-#ifdef TETEXT
- /* Terminal emulator fonts are expanded and have many 0 rows */
- beqz bits, NextLine /* skip out early on 0 */
-#endif
- addu addr, addr, stride /* step for the loop */
- BitsR stemp, bits, shift /* get first bits */
- and stemp, stemp, CASE_MASK /* compute first branch */
- addu stemp, stemp, sbase /* ... */
- j stemp /* ... */
- BitsL bits, bits, lshift /* set remaining bits */
-
-ForEachBits:
- addu atemp, atemp, 4
-ForEachBits1:
- FourBits(stemp, bits) /* compute jump for */
- sll stemp, stemp, CASE_SIZE /* next four bits */
- addu stemp, stemp, sbase /* ... */
- j stemp /* ... */
- BitsL bits, bits, 4 /* step for remaining bits */
-CaseBegin:
- bnez bits, ForEachBits1 /* 0 */
- addu atemp, atemp, 4
-NextLine:
- addu count, count, -1
- bnez count, ForEachLine
- addu stipple, stipple, 4
- j $31
- nop
- nop
-
- bnez bits, ForEachBits /* 1 */
- sb value, BO(0)(atemp)
- addu count, count, -1
- bnez count, ForEachLine
- addu stipple, stipple, 4
- j $31
- nop
- nop
-
- bnez bits, ForEachBits /* 2 */
- sb value, BO(1)(atemp)
- addu count, count, -1
- bnez count, ForEachLine
- addu stipple, stipple, 4
- j $31
- nop
- nop
-
- bnez bits, ForEachBits /* 3 */
- sh value, HO(0)(atemp)
- addu count, count, -1
- bnez count, ForEachLine
- addu stipple, stipple, 4
- j $31
- nop
- nop
-
- bnez bits, ForEachBits /* 4 */
- sb value, BO(2)(atemp)
- addu count, count, -1
- bnez count, ForEachLine
- addu stipple, stipple, 4
- j $31
- nop
- nop
-
- sb value, BO(0)(atemp) /* 5 */
- bnez bits, ForEachBits
- sb value, BO(2)(atemp)
- addu count, count, -1
- bnez count, ForEachLine
- addu stipple, stipple, 4
- j $31
- nop
-
- sb value, BO(1)(atemp) /* 6 */
- bnez bits, ForEachBits
- sb value, BO(2)(atemp)
- addu count, count, -1
- bnez count, ForEachLine
- addu stipple, stipple, 4
- j $31
- nop
-
- bnez bits, ForEachBits /* 7 */
- swl value, BO(2)(atemp) /* untested on MSB */
- addu count, count, -1
- bnez count, ForEachLine
- addu stipple, stipple, 4
- j $31
- nop
- nop
-
- bnez bits, ForEachBits /* 8 */
- sb value, BO(3)(atemp)
- addu count, count, -1
- bnez count, ForEachLine
- addu stipple, stipple, 4
- j $31
- nop
- nop
-
- sb value, BO(0)(atemp) /* 9 */
- bnez bits, ForEachBits
- sb value, BO(3)(atemp)
- addu count, count, -1
- bnez count, ForEachLine
- addu stipple, stipple, 4
- j $31
- nop
-
- sb value, BO(1)(atemp) /* a */
- bnez bits, ForEachBits
- sb value, BO(3)(atemp)
- addu count, count, -1
- bnez count, ForEachLine
- addu stipple, stipple, 4
- j $31
- nop
-
- sh value, HO(0)(atemp) /* b */
- bnez bits, ForEachBits
- sb value, BO(3)(atemp)
- addu count, count, -1
- bnez count, ForEachLine
- addu stipple, stipple, 4
- j $31
- nop
-
- bnez bits, ForEachBits /* c */
- sh value, HO(2)(atemp)
- addu count, count, -1
- bnez count, ForEachLine
- addu stipple, stipple, 4
- j $31
- nop
- nop
-
- sb value, BO(0)(atemp) /* d */
- bnez bits, ForEachBits
- sh value, HO(2)(atemp)
- addu count, count, -1
- bnez count, ForEachLine
- addu stipple, stipple, 4
- j $31
- nop
-
- bnez bits, ForEachBits /* e */
- swr value, BO(1)(atemp) /* untested on MSB */
- addu count, count, -1
- bnez count, ForEachLine
- addu stipple, stipple, 4
- j $31
- nop
- nop
-
- bnez bits, ForEachBits /* f */
- sw value, WO(0)(atemp)
- addu count, count, -1
- bnez count, ForEachLine
- addu stipple, stipple, 4
- j $31
- nop
- nop
-
- .end cfbStippleStack
diff --git a/cfb/stipsparc.s b/cfb/stipsparc.s
deleted file mode 100644
index dcd440b19..000000000
--- a/cfb/stipsparc.s
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
- * $Xorg: stipsparc.s,v 1.4 2001/02/09 02:04:39 xorgcvs Exp $
- * $XdotOrg: $
- *
-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/stipsparc.s,v 1.4 2001/01/17 22:36:38 dawes Exp $ */
-
-/*
- * SPARC assembly code for optimized text rendering.
- *
- * Other stippling could be done in assembly, but the payoff is
- * not nearly as large. Mostly because large areas are heavily
- * optimized already.
- */
-
-/* not that I expect to ever see an LSB SPARC, but ... */
-#ifdef LITTLE_ENDIAN
-# define BitsR sll
-# define BitsL srl
-# define BO(o) o
-# define HO(o) o
-# define WO(o) o
-# define FourBits(dest,bits) and bits, 0xf, dest
-#else
-# define BitsR srl
-# define BitsL sll
-# define BO(o) 3-o
-# define HO(o) 2-o
-# define WO(o) o
-# define FourBits(dest,bits) srl bits, 28, dest
-#endif
-
-/*
- * cfbStippleStack(addr, stipple, value, stride, Count, Shift)
- * 4 5 6 7 16(sp) 20(sp)
- *
- * Apply successive 32-bit stipples starting at addr, addr+stride, ...
- *
- * Used for text rendering, but only when no data could be lost
- * when the stipple is shifted left by Shift bits
- */
-/* arguments */
-#define addr %i0
-#define stipple %i1
-#define value %i2
-#define stride %i3
-#define count %i4
-#define shift %i5
-
-/* local variables */
-#define atemp %l0
-#define bits %l1
-#define lshift %l2
-#define sbase %l3
-#define stemp %l4
-
-#define CASE_SIZE 5 /* case blocks are 2^5 bytes each */
-#define CASE_MASK 0x1e0 /* first case mask */
-
-#define ForEachLine LY1
-#define NextLine LY2
-#define CaseBegin LY3
-#define ForEachBits LY4
-#define NextBits LY5
-
-#if defined(SVR4) || defined(__ELF__)
-#ifdef TETEXT
-#define _cfbStippleStack cfbStippleStackTE
-#else
-#define _cfbStippleStack cfbStippleStack
-#endif
-#else
-#ifdef TETEXT
-#define _cfbStippleStack _cfbStippleStackTE
-#endif
-#endif
- .seg "text"
- .proc 16
- .globl _cfbStippleStack
-_cfbStippleStack:
- save %sp,-64,%sp
-#ifdef SHAREDCODE
-1:
- call 2f
- nop
-2:
- mov %o7,sbase /* sbase = 1b(1:) */
- add sbase, CaseBegin-1b, sbase
-#else /* !SHAREDCODE */
- sethi %hi(CaseBegin),sbase /* load up switch table */
- or sbase,%lo(CaseBegin),sbase
-#endif /* SHAREDCODE */
- mov 4,lshift /* compute offset within */
- sub lshift, shift, lshift /* stipple of remaining bits */
-#ifdef LITTLE_ENDIAN
- inc CASE_SIZE, shift /* first shift for LSB */
-#else
- inc 28-CASE_SIZE, shift /* first shift for MSB */
-#endif
- /* do ... while (--count > 0); */
-ForEachLine:
- ld [stipple],bits /* get stipple bits */
- mov addr,atemp /* set up for this line */
-#ifdef TETEXT
- /* Terminal emulator fonts are expanded and have many 0 rows */
- tst bits
- bz NextLine /* skip out early on 0 */
-#endif
- add addr, stride, addr /* step for the loop */
- BitsR bits, shift, stemp /* get first bits */
- and stemp, CASE_MASK, stemp /* compute first jump */
- BitsL bits, lshift, bits /* set remaining bits */
- jmp sbase+stemp /* ... */
- tst bits
-
-ForEachBits:
- inc 4, atemp
-ForEachBits1:
- FourBits(stemp, bits) /* compute jump for */
- sll stemp, CASE_SIZE, stemp /* these four bits */
- BitsL bits, 4, bits /* step for remaining bits */
- jmp sbase+stemp /* jump */
- tst bits
-CaseBegin:
- bnz,a ForEachBits1 /* 0 */
- inc 4, atemp
-NextLine:
- deccc 1, count
- bnz,a ForEachLine
- inc 4, stipple
- ret
- restore
- nop
-
- bnz ForEachBits /* 1 */
- stb value, [atemp+BO(0)]
- deccc 1, count
- bnz,a ForEachLine
- inc 4, stipple
- ret
- restore
- nop
-
- bnz ForEachBits /* 2 */
- stb value, [atemp+BO(1)]
- deccc 1, count
- bnz,a ForEachLine
- inc 4, stipple
- ret
- restore
- nop
-
- bnz ForEachBits /* 3 */
- sth value, [atemp+HO(0)]
- deccc 1, count
- bnz,a ForEachLine
- inc 4, stipple
- ret
- restore
- nop
-
- bnz ForEachBits /* 4 */
- stb value, [atemp+BO(2)]
- deccc 1, count
- bnz,a ForEachLine
- inc 4, stipple
- ret
- restore
- nop
-
- stb value, [atemp+BO(0)] /* 5 */
- bnz ForEachBits
- stb value, [atemp+BO(2)]
- deccc 1, count
- bnz,a ForEachLine
- inc 4, stipple
- ret
- restore
-
- stb value, [atemp+BO(1)] /* 6 */
- bnz ForEachBits
- stb value, [atemp+BO(2)]
- deccc 1, count
- bnz,a ForEachLine
- inc 4, stipple
- ret
- restore
-
- sth value, [atemp+HO(0)] /* 7 */
- bnz ForEachBits
- stb value, [atemp+BO(2)]
- deccc 1, count
- bnz,a ForEachLine
- inc 4, stipple
- ret
- restore
-
- bnz ForEachBits /* 8 */
- stb value, [atemp+BO(3)]
- deccc 1, count
- bnz,a ForEachLine
- inc 4, stipple
- ret
- restore
- nop
-
- stb value, [atemp+BO(0)] /* 9 */
- bnz ForEachBits
- stb value, [atemp+BO(3)]
- deccc 1, count
- bnz,a ForEachLine
- inc 4, stipple
- ret
- restore
-
- stb value, [atemp+BO(1)] /* a */
- bnz ForEachBits
- stb value, [atemp+BO(3)]
- deccc 1, count
- bnz,a ForEachLine
- inc 4, stipple
- ret
- restore
-
- sth value, [atemp+HO(0)] /* b */
- bnz ForEachBits
- stb value, [atemp+BO(3)]
- deccc 1, count
- bnz,a ForEachLine
- inc 4, stipple
- ret
- restore
-
- bnz ForEachBits /* c */
- sth value, [atemp+HO(2)]
- deccc 1, count
- bnz,a ForEachLine
- inc 4, stipple
- ret
- restore
- nop
-
- stb value, [atemp+BO(0)] /* d */
- bnz ForEachBits
- sth value, [atemp+HO(2)]
- deccc 1, count
- bnz,a ForEachLine
- inc 4, stipple
- ret
- restore
-
- stb value, [atemp+BO(1)] /* e */
- bnz ForEachBits
- sth value, [atemp+HO(2)]
- deccc 1, count
- bnz,a ForEachLine
- inc 4, stipple
- ret
- restore
-
- bnz ForEachBits /* f */
- st value, [atemp+WO(0)]
- deccc 1, count
- bnz,a ForEachLine
- inc 4, stipple
- ret
- restore
diff --git a/cfb/stipsprc32.s b/cfb/stipsprc32.s
deleted file mode 100644
index 89b031f5a..000000000
--- a/cfb/stipsprc32.s
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * $Xorg: stipsprc32.s,v 1.4 2001/02/09 02:04:39 xorgcvs Exp $
- * $XdotOrg: $
- *
-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/stipsprc32.s,v 1.4 2001/01/17 22:36:38 dawes Exp $ */
-
-/*
- * SPARC assembly code for optimized text rendering.
- *
- * Other stippling could be done in assembly, but the payoff is
- * not nearly as large. Mostly because large areas are heavily
- * optimized already.
- */
-
-/* not that I expect to ever see an LSB SPARC, but ... */
-#ifdef LITTLE_ENDIAN
-# define BitsR sll
-# define BitsL srl
-# define WO(o) 3-o
-# define FourBits(dest,bits) and bits, 0xf, dest
-#else
-# define BitsR srl
-# define BitsL sll
-# define WO(o) o
-# define FourBits(dest,bits) srl bits, 28, dest
-#endif
-
-/*
- * cfb32StippleStack(addr, stipple, value, stride, Count, Shift)
- * 4 5 6 7 16(sp) 20(sp)
- *
- * Apply successive 32-bit stipples starting at addr, addr+stride, ...
- *
- * Used for text rendering, but only when no data could be lost
- * when the stipple is shifted left by Shift bits
- */
-/* arguments */
-#define addr %i0
-#define stipple %i1
-#define value %i2
-#define stride %i3
-#define count %i4
-#define shift %i5
-
-/* local variables */
-#define atemp %l0
-#define bits %l1
-#define lshift %l2
-#define sbase %l3
-#define stemp %l4
-
-#define CASE_SIZE 5 /* case blocks are 2^5 bytes each */
-#define CASE_MASK 0x1e0 /* first case mask */
-
-#define ForEachLine LY1
-#define NextLine LY2
-#define CaseBegin LY3
-#define ForEachBits LY4
-#define NextBits LY5
-
-#if defined(SVR4) || defined(__ELF__)
-#ifdef TETEXT
-#define _cfb32StippleStack cfb32StippleStackTE
-#else
-#define _cfb32StippleStack cfb32StippleStack
-#endif
-#else
-#ifdef TETEXT
-#define _cfb32StippleStack _cfb32StippleStackTE
-#endif
-#endif
-
- .seg "text"
- .proc 16
- .globl _cfb32StippleStack
-_cfb32StippleStack:
- save %sp,-64,%sp
-#ifdef SHAREDCODE
-1:
- call 2f
- nop
-2:
- mov %o7,sbase /* sbase = 1b(1:) */
- add sbase, CaseBegin-1b, sbase
-#else /* !SHAREDCODE */
- sethi %hi(CaseBegin),sbase /* load up switch table */
- or sbase,%lo(CaseBegin),sbase
-#endif /* !SHAREDCODE */
- mov 4,lshift /* compute offset within */
- sub lshift, shift, lshift /* stipple of remaining bits */
-#ifdef LITTLE_ENDIAN
- inc CASE_SIZE, shift /* first shift for LSB */
-#else
- inc 28-CASE_SIZE, shift /* first shift for MSB */
-#endif
- /* do ... while (--count > 0); */
-ForEachLine:
- ld [stipple],bits /* get stipple bits */
- mov addr,atemp /* set up for this line */
-#ifdef TETEXT
- /* Terminal emulator fonts are expanded and have many 0 rows */
- tst bits
- bz NextLine /* skip out early on 0 */
-#endif
- add addr, stride, addr /* step for the loop */
- BitsR bits, shift, stemp /* get first bits */
- and stemp, CASE_MASK, stemp /* compute first jump */
- BitsL bits, lshift, bits /* set remaining bits */
- jmp sbase+stemp /* ... */
- tst bits
-
-ForEachBits:
- inc 16, atemp
-ForEachBits1:
- FourBits(stemp, bits) /* compute jump for */
- sll stemp, CASE_SIZE, stemp /* these four bits */
- BitsL bits, 4, bits /* step for remaining bits */
- jmp sbase+stemp /* jump */
- tst bits
-CaseBegin:
- bnz,a ForEachBits1 /* 0 */
- inc 16, atemp
-NextLine:
- deccc 1, count
-NextLine1:
- bnz,a ForEachLine
- inc 4, stipple
- ret
- restore
- nop
-
- bnz ForEachBits /* 1 */
- st value, [atemp+WO(12)]
- deccc 1, count
- bnz,a ForEachLine
- inc 4, stipple
- ret
- restore
- nop
-
- bnz ForEachBits /* 2 */
- st value, [atemp+WO(8)]
- deccc 1, count
- bnz,a ForEachLine
- inc 4, stipple
- ret
- restore
- nop
-
- st value, [atemp+WO(8)] /* 3 */
- bnz ForEachBits
- st value, [atemp+WO(12)]
- deccc 1, count
- bnz,a ForEachLine
- inc 4, stipple
- ret
- restore
-
- bnz ForEachBits /* 4 */
- st value, [atemp+WO(4)]
- deccc 1, count
- bnz,a ForEachLine
- inc 4, stipple
- ret
- restore
- nop
-
- st value, [atemp+WO(4)] /* 5 */
- bnz ForEachBits
- st value, [atemp+WO(12)]
- deccc 1, count
- bnz,a ForEachLine
- inc 4, stipple
- ret
- restore
-
- st value, [atemp+WO(4)] /* 6 */
- bnz ForEachBits
- st value, [atemp+WO(8)]
- deccc 1, count
- bnz,a ForEachLine
- inc 4, stipple
- ret
- restore
-
- st value, [atemp+WO(4)] /* 7 */
- st value, [atemp+WO(8)]
- bnz ForEachBits
- st value, [atemp+WO(12)]
- b NextLine1
- deccc 1, count
- nop
- nop
-
- bnz ForEachBits /* 8 */
- st value, [atemp+WO(0)]
- deccc 1, count
- bnz,a ForEachLine
- inc 4, stipple
- ret
- restore
- nop
-
- st value, [atemp+WO(0)] /* 9 */
- bnz ForEachBits
- st value, [atemp+WO(12)]
- deccc 1, count
- bnz,a ForEachLine
- inc 4, stipple
- ret
- restore
-
- st value, [atemp+WO(0)] /* a */
- bnz ForEachBits
- st value, [atemp+WO(8)]
- deccc 1, count
- bnz,a ForEachLine
- inc 4, stipple
- ret
- restore
-
- st value, [atemp+WO(0)] /* b */
- st value, [atemp+WO(8)]
- bnz ForEachBits
- st value, [atemp+WO(12)]
- b NextLine1
- deccc 1, count
- nop
- nop
-
- st value, [atemp+WO(0)] /* c */
- bnz ForEachBits
- st value, [atemp+WO(4)]
- deccc 1, count
- bnz,a ForEachLine
- inc 4, stipple
- ret
- restore
-
- st value, [atemp+WO(0)] /* d */
- st value, [atemp+WO(4)]
- bnz ForEachBits
- st value, [atemp+WO(12)]
- b NextLine1
- deccc 1, count
- nop
- nop
-
- st value, [atemp+WO(0)] /* e */
- st value, [atemp+WO(4)]
- bnz ForEachBits
- st value, [atemp+WO(8)]
- b NextLine1
- deccc 1, count
- nop
- nop
-
- st value, [atemp+WO(0)] /* f */
- st value, [atemp+WO(4)]
- st value, [atemp+WO(8)]
- bnz ForEachBits
- st value, [atemp+WO(12)]
- deccc 1, count
- bnz,a ForEachLine
- inc 4, stipple
- ret
- restore
diff --git a/cfb32/Makefile.am b/cfb32/Makefile.am
deleted file mode 100644
index 681a09575..000000000
--- a/cfb32/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-noinst_LTLIBRARIES = libcfb32.la
-
-include $(top_srcdir)/cfb/Makefile.am.inc
-
-libcfb32_la_SOURCES = $(libcfb_common_sources) $(libcfb_gen_sources)
-
-INCLUDES = $(CFB_INCLUDES) $(DIX_CFLAGS) -I$(top_srcdir)/hw/xfree86/os-support -I$(top_srcdir)/hw/xfree86/common
-
-AM_CFLAGS = -DPSZ=32 $(PLATFORMDEFS)
diff --git a/configure.ac b/configure.ac
index 025b91214..d3a231705 100644
--- a/configure.ac
+++ b/configure.ac
@@ -58,6 +58,7 @@ AC_PROG_LN_S
AC_LIBTOOL_WIN32_DLL
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
+DOLT
AC_PROG_MAKE_SET
PKG_PROG_PKG_CONFIG
AC_PROG_LEX
@@ -313,6 +314,7 @@ case $host_cpu in
case $host_os in
*linux*) DEFAULT_INT10=vm86 ;;
*freebsd*) AC_DEFINE(USE_DEV_IO) ;;
+ *dragonfly*) AC_DEFINE(USE_DEV_IO) ;;
*netbsd*) AC_DEFINE(USE_I386_IOPL)
SYS_LIBS=-li386
;;
@@ -337,6 +339,7 @@ case $host_cpu in
I386_VIDEO=yes
case $host_os in
*freebsd*) AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;;
+ *dragonfly*) AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;;
*netbsd*) AC_DEFINE(USE_I386_IOPL, 1, [BSD i386 iopl])
SYS_LIBS=-lx86_64
;;
@@ -367,7 +370,7 @@ DRI2=no
KDRIVE_HW=no
dnl it would be nice to autodetect these *CONS_SUPPORTs
case $host_os in
- *freebsd*)
+ *freebsd* | *dragonfly*)
case $host_os in
kfreebsd*-gnu) ;;
*) AC_DEFINE(CSRG_BASED, 1, [System is BSD-like]) ;;
@@ -521,7 +524,7 @@ AC_ARG_ENABLE(glx-tls, AS_HELP_STRING([--enable-glx-tls], [Build GLX with
dnl Extensions.
AC_ARG_ENABLE(registry, AS_HELP_STRING([--disable-registry], [Build string registry module (default: enabled)]), [XREGISTRY=$enableval], [XREGISTRY=yes])
-AC_ARG_ENABLE(composite, AS_HELP_STRING([--disable-composite], [Build Composite extension (default: enabled)]), [COMPOSITE=$enableval], [COMPOSITE=yes])
+AC_ARG_ENABLE(composite, AS_HELP_STRING([--disable-composite], [Build Composite extension (default: enabled)]), [COMPOSITE=$enableval], [COMPOSITE=auto])
AC_ARG_ENABLE(mitshm, AS_HELP_STRING([--disable-shm], [Build SHM extension (default: enabled)]), [MITSHM=$enableval], [MITSHM=yes])
AC_ARG_ENABLE(xres, AS_HELP_STRING([--disable-xres], [Build XRes extension (default: enabled)]), [RES=$enableval], [RES=yes])
AC_ARG_ENABLE(xtrap, AS_HELP_STRING([--disable-xtrap], [Build XTrap extension (default: enabled)]), [XTRAP=$enableval], [XTRAP=yes])
@@ -541,12 +544,10 @@ AC_ARG_ENABLE(xf86misc, AS_HELP_STRING([--disable-xf86misc], [Build XF86Mi
AC_ARG_ENABLE(xace, AS_HELP_STRING([--disable-xace], [Build X-ACE extension (default: enabled)]), [XACE=$enableval], [XACE=yes])
AC_ARG_ENABLE(xselinux, AS_HELP_STRING([--disable-xselinux], [Build SELinux extension (default: disabled)]), [XSELINUX=$enableval], [XSELINUX=no])
AC_ARG_ENABLE(xcsecurity, AS_HELP_STRING([--disable-xcsecurity], [Build Security extension (default: disabled)]), [XCSECURITY=$enableval], [XCSECURITY=no])
-AC_ARG_ENABLE(appgroup, AS_HELP_STRING([--disable-appgroup], [Build XC-APPGROUP extension (default: disabled)]), [APPGROUP=$enableval], [APPGROUP=$XCSECURITY])
AC_ARG_ENABLE(xcalibrate, AS_HELP_STRING([--enable-xcalibrate], [Build XCalibrate extension (default: disabled)]), [XCALIBRATE=$enableval], [XCALIBRATE=no])
AC_ARG_ENABLE(tslib, AS_HELP_STRING([--enable-tslib], [Build kdrive tslib touchscreen support (default: disabled)]), [TSLIB=$enableval], [TSLIB=no])
AC_ARG_ENABLE(xevie, AS_HELP_STRING([--disable-xevie], [Build XEvIE extension (default: enabled)]), [XEVIE=$enableval], [XEVIE=yes])
AC_ARG_ENABLE(cup, AS_HELP_STRING([--disable-cup], [Build TOG-CUP extension (default: enabled)]), [CUP=$enableval], [CUP=yes])
-AC_ARG_ENABLE(evi, AS_HELP_STRING([--disable-evi], [Build Extended-Visual-Information extension (default: enabled)]), [EVI=$enableval], [EVI=yes])
AC_ARG_ENABLE(multibuffer, AS_HELP_STRING([--enable-multibuffer], [Build Multibuffer extension (default: disabled)]), [MULTIBUFFER=$enableval], [MULTIBUFFER=no])
AC_ARG_ENABLE(fontcache, AS_HELP_STRING([--enable-fontcache], [Build FontCache extension (default: disabled)]), [FONTCACHE=$enableval], [FONTCACHE=no])
AC_ARG_ENABLE(dbe, AS_HELP_STRING([--disable-dbe], [Build DBE extension (default: enabled)]), [DBE=$enableval], [DBE=yes])
@@ -571,9 +572,8 @@ AC_ARG_ENABLE(xgl, AS_HELP_STRING([--enable-xgl], [Build Xgl server (
AC_ARG_ENABLE(xglx, AS_HELP_STRING([--enable-xglx], [Build Xglx xgl module (default: no)]), [XGLX=$enableval], [XGLX=no])
AC_ARG_ENABLE(xegl, AS_HELP_STRING([--enable-xegl], [Build Xegl xgl module (default: no)]), [XEGL=$enableval], [XEGL=no])
dnl legacy fb support
-AC_ARG_ENABLE(mfb, AS_HELP_STRING([--enable-mfb], [Build legacy mono framebuffer support (default: enabled)]), [MFB=$enableval], [MFB=$XORG])
-AC_ARG_ENABLE(cfb, AS_HELP_STRING([--enable-cfb], [Build legacy color framebuffer support (default: enabled)]), [CFB=$enableval], [CFB=$XORG])
-AC_ARG_ENABLE(afb, AS_HELP_STRING([--enable-afb], [Build legacy advanced framebuffer support (default: enabled)]), [AFB=$enableval], [AFB=$XORG])
+AC_ARG_ENABLE(mfb, AS_HELP_STRING([--enable-mfb], [Build legacy mono framebuffer support (default: disable)]), [MFB=$enableval], [MFB=no])
+AC_ARG_ENABLE(afb, AS_HELP_STRING([--enable-afb], [Build legacy advanced framebuffer support (default: disable)]), [AFB=$enableval], [AFB=no])
dnl kdrive and its subsystems
AC_ARG_ENABLE(kdrive, AS_HELP_STRING([--enable-kdrive], [Build kdrive servers (default: no)]), [KDRIVE=$enableval], [KDRIVE=no])
AC_ARG_ENABLE(xephyr, AS_HELP_STRING([--enable-xephyr], [Build the kdrive Xephyr server (default: auto)]), [XEPHYR=$enableval], [XEPHYR=auto])
@@ -732,7 +732,7 @@ if ! test "x$have_clock_gettime" = xno; then
CPPFLAGS_SAVE="$CPPFLAGS"
if test x"$glibc" = xyes; then
- CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=199309L"
+ CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L"
fi
AC_RUN_IFELSE([
@@ -781,6 +781,18 @@ if test "x$XREGISTRY" = xyes; then
AC_DEFINE(XREGISTRY, 1, [Build registry module])
fi
+dnl XQuartz DDX Detection... Yes, it's ugly to have it here... but we need to disable COMPOSITE for
+if test "x$COMPOSITE" = xauto; then
+ case $host_os in
+ darwin*)
+ test "x$XQUARTZ" = xyes -o "x$XQUARTZ" = xauto && COMPOSITE=no
+ ;;
+ *)
+ COMPOSITE=yes
+ ;;
+ esac
+fi
+
AM_CONDITIONAL(COMPOSITE, [test "x$COMPOSITE" = xyes])
if test "x$COMPOSITE" = xyes; then
AC_DEFINE(COMPOSITE, 1, [Support Composite Extension])
@@ -917,26 +929,12 @@ if test "x$XEVIE" = xyes; then
REQUIRED_MODULES="$REQUIRED_MODULES evieproto"
fi
-AM_CONDITIONAL(APPGROUP, [test "x$APPGROUP" = xyes])
-if test "x$APPGROUP" = xyes; then
- if test "x$XACE" != xyes || test "x$XCSECURITY" != xyes; then
- AC_MSG_ERROR([cannot build APPGROUP extension without X-ACE and XC-SECURITY])
- fi
- AC_DEFINE(XAPPGROUP, 1, [Build APPGROUP extension])
-fi
-
AM_CONDITIONAL(CUP, [test "x$CUP" = xyes])
if test "x$CUP" = xyes; then
AC_DEFINE(TOGCUP, 1, [Build TOG-CUP extension])
# Requires xextproto which is always required
fi
-AM_CONDITIONAL(EVI, [test "x$EVI" = xyes])
-if test "x$EVI" = xyes; then
- AC_DEFINE(EVI, 1, [Build Extended-Visual-Information extension])
- # Requires xextproto which is always required
-fi
-
AM_CONDITIONAL(MULTIBUFFER, [test "x$MULTIBUFFER" = xyes])
if test "x$MULTIBUFFER" = xyes; then
AC_DEFINE(MULTIBUFFER, 1, [Build Multibuffer extension])
@@ -1096,12 +1094,9 @@ AC_DEFINE(NO_LIBCWRAPPER, 1, [Define to 1 if modules should avoid the libcwrappe
if test "x$DEBUGGING" = xyes; then
AC_DEFINE(DEBUG, 1, [Enable debugging code])
-else
- AC_DEFINE(NDEBUG, 1, [Disable some debugging code])
fi
AM_CONDITIONAL(DEBUG, [test "x$DEBUGGING" = xyes])
-AC_DEFINE(MITMISC, 1, [Support MIT Misc extension])
AC_DEFINE(XTEST, 1, [Support XTest extension])
AC_DEFINE(XSYNC, 1, [Support XSync extension])
AC_DEFINE(XCMISC, 1, [Support XCMisc extension])
@@ -1360,7 +1355,7 @@ if test "x$XORG" = xyes -o "x$XGL" = xyes; then
;;
esac
;;
- freebsd* | kfreebsd*-gnu)
+ freebsd* | kfreebsd*-gnu | dragonfly*)
XORG_OS="freebsd"
XORG_OS_SUBDIR="bsd"
xorg_bus_bsdpci="yes"
@@ -1555,7 +1550,11 @@ if test "x$XORG" = xyes -o "x$XGL" = xyes; then
abi_xinput=`extract_abi XINPUT`
abi_extension=`extract_abi EXTENSION`
abi_font=`extract_abi FONT`
- AC_SUBST([abi_ansic abi_videodrv abi_xinput abi_extension abi_font])
+ AC_SUBST([abi_ansic])
+ AC_SUBST([abi_videodrv])
+ AC_SUBST([abi_xinput])
+ AC_SUBST([abi_extension])
+ AC_SUBST([abi_font])
fi
AM_CONDITIONAL([XORG], [test "x$XORG" = xyes])
AM_CONDITIONAL([XORG_BUS_LINUXPCI], [test "x$xorg_bus_linuxpci" = xyes])
@@ -1576,12 +1575,10 @@ AM_CONDITIONAL([XF86VIDMODE], [test "x$XF86VIDMODE" = xyes])
dnl legacy fb support
test "x$MFB" = xauto && MFB="$XORG"
-test "x$CFB" = xauto && CFB="$XORG"
test "x$AFB" = xauto && AFB="$XORG"
AM_CONDITIONAL(MFB, [test "x$MFB" = xyes])
-AM_CONDITIONAL(CFB, [test "x$CFB" = xyes])
AM_CONDITIONAL(AFB, [test "x$AFB" = xyes])
-if test "x$MFB" = xyes -o "x$CFB" = xyes -o "x$AFB" = xyes; then
+if test "x$MFB" = xyes -o "x$AFB" = xyes; then
if test "x$XORG" != xyes; then
AC_MSG_ERROR([legacy fb support requires the Xorg server])
fi
@@ -1594,7 +1591,7 @@ AC_MSG_RESULT([$XPRINT])
if test "x$XPRINT" = xyes; then
PKG_CHECK_MODULES([XPRINTMODULES], [printproto x11 xfont $XDMCP_MODULES xau])
- XPRINT_CFLAGS="$XPRINTMODULES_CFLAGS"
+ XPRINT_CFLAGS="$XPRINTMODULES_CFLAGS -DXPRINT"
XPRINT_LIBS="$XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS $MIEXT_DAMAGE_LIB $XKB_LIB $XKB_STUB_LIB"
XPRINT_SYS_LIBS="$XPRINTMODULES_LIBS"
@@ -1730,7 +1727,8 @@ if test "X$XQUARTZ" = Xauto; then
fi
if test "x$XQUARTZ" = xyes; then
- AC_DEFINE([XQUARTZ],[1],[Have Quartz])
+ AC_DEFINE(XQUARTZ,1,[Have Quartz])
+ AC_DEFINE(ROOTLESS,1,[Build Rootless code])
#glxAGL / glxCGL don't work yet
# AC_CACHE_CHECK([for AGL framework],xorg_cv_AGL_framework,[
@@ -2094,7 +2092,9 @@ DIX_CFLAGS="-DHAVE_DIX_CONFIG_H $XSERVER_CFLAGS"
AC_SUBST([DIX_CFLAGS])
-AC_SUBST([libdir exec_prefix prefix])
+AC_SUBST([libdir])
+AC_SUBST([exec_prefix])
+AC_SUBST([prefix])
# Man page sections - used in config utils & generating man pages
XORG_MANPAGE_SECTIONS
@@ -2127,8 +2127,6 @@ fb/Makefile
record/Makefile
XTrap/Makefile
mfb/Makefile
-cfb/Makefile
-cfb32/Makefile
config/Makefile
mi/Makefile
miext/Makefile
@@ -2136,7 +2134,6 @@ miext/damage/Makefile
miext/shadow/Makefile
miext/cw/Makefile
miext/rootless/Makefile
-miext/rootless/accel/Makefile
os/Makefile
randr/Makefile
render/Makefile
@@ -2187,7 +2184,6 @@ hw/xfree86/xaa/Makefile
hw/xfree86/xf1bpp/Makefile
hw/xfree86/xf4bpp/Makefile
hw/xfree86/xf8_16bpp/Makefile
-hw/xfree86/xf8_32bpp/Makefile
hw/xfree86/utils/Makefile
hw/xfree86/utils/cvt/Makefile
hw/xfree86/utils/gtf/Makefile
diff --git a/dix/Makefile.am b/dix/Makefile.am
index 554ab83a9..c24e98530 100644
--- a/dix/Makefile.am
+++ b/dix/Makefile.am
@@ -1,4 +1,10 @@
-noinst_LTLIBRARIES = libdix.la libxpstubs.la
+standard_dix_libs = libdix.la libxpstubs.la
+
+if XPRINT
+noinst_LTLIBRARIES = $(standard_dix_libs) libXpdix.la
+else
+noinst_LTLIBRARIES = $(standard_dix_libs)
+endif
AM_CFLAGS = $(DIX_CFLAGS) \
-DVENDOR_NAME=\""@VENDOR_NAME@"\" \
@@ -40,7 +46,11 @@ libdix_la_SOURCES = \
libxpstubs_la_SOURCES = \
xpstubs.c
-INCLUDES = -I$(top_srcdir)/Xprint
+if XPRINT
+libXpdix_la_SOURCES = $(libdix_la_SOURCES)
+libXpdix_la_CPPFLAGS = -I$(top_srcdir)/hw/xprint
+libXpdix_la_CFLAGS = $(AM_CFLAGS) $(XPRINT_CFLAGS)
+endif
EXTRA_DIST = buildatoms BuiltInAtoms CHANGES Xserver.d Xserver-dtrace.h.in
diff --git a/dix/devices.c b/dix/devices.c
index fe70e7870..656707ca5 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -830,12 +830,12 @@ CloseDownDevices(void)
for (dev = inputInfo.devices; dev; dev = next)
{
next = dev->next;
- CloseDevice(dev);
+ DeleteInputDeviceRequest(dev);
}
for (dev = inputInfo.off_devices; dev; dev = next)
{
next = dev->next;
- CloseDevice(dev);
+ DeleteInputDeviceRequest(dev);
}
inputInfo.devices = NULL;
diff --git a/dix/dispatch.c b/dix/dispatch.c
index ef76dcf8c..64955d952 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -136,9 +136,6 @@ int ProcInitialConnection();
#endif
#include "privates.h"
#include "xace.h"
-#ifdef XAPPGROUP
-#include "appgroup.h"
-#endif
#ifdef XKB
#ifndef XKB_IN_SERVER
#define XKB_IN_SERVER
@@ -3517,9 +3514,6 @@ void InitClient(ClientPtr client, int i, pointer ospriv)
}
#endif
client->replyBytesRemaining = 0;
-#ifdef XAPPGROUP
- client->appgroup = NULL;
-#endif
client->fontResFunc = NULL;
#ifdef SMART_SCHEDULE
client->smart_priority = 0;
@@ -3646,9 +3640,6 @@ SendConnSetup(ClientPtr client, char *reason)
client->requestVector = client->swapped ? SwappedProcVector : ProcVector;
client->sequence = 0;
-#ifdef XAPPGROUP
- XagConnectionInfo (client, &lconnSetupPrefix, &lConnectionInfo, &numScreens);
-#endif
((xConnSetup *)lConnectionInfo)->ridBase = client->clientAsMask;
((xConnSetup *)lConnectionInfo)->ridMask = RESOURCE_ID_MASK;
#ifdef MATCH_CLIENT_ENDIAN
diff --git a/dix/dixutils.c b/dix/dixutils.c
index aaf510623..22935cead 100644
--- a/dix/dixutils.c
+++ b/dix/dixutils.c
@@ -270,7 +270,8 @@ dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client, Mask access)
*pClient = clients[clientIndex];
return Success;
bad:
- client->errorValue = rid;
+ if(client)
+ client->errorValue = rid;
*pClient = NULL;
return rc;
}
diff --git a/dix/events.c b/dix/events.c
index 093103360..7b503ac4e 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2664,6 +2664,13 @@ XYToWindow(DeviceIntPtr pDev, int x, int y)
x - pWin->drawable.x,
y - pWin->drawable.y, &box))
#endif
+#ifdef ROOTLESS
+ /* In rootless mode windows may be offscreen, even when
+ * they're in X's stack. (E.g. if the native window system
+ * implements some form of virtual desktop system).
+ */
+ && !pWin->rootlessUnhittable
+#endif
)
{
if (pSprite->spriteTraceGood >= pSprite->spriteTraceSize)
diff --git a/dix/main.c b/dix/main.c
index 6a94aaa35..f7824ee83 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -113,9 +113,6 @@ Equipment Corporation.
#include "dispatch.h" /* InitProcVectors() */
#endif
-#include <pthread.h>
-pthread_key_t threadname_key=0;
-
#ifdef DPMSExtension
#define DPMS_SERVER
#include <X11/extensions/dpms.h>
@@ -251,17 +248,6 @@ main(int argc, char *argv[], char *envp[])
char *xauthfile;
HWEventQueueType alwaysCheckForInput[2];
- if(threadname_key == 0) ErrorF("pthread_key_create returned %d\n", pthread_key_create(&threadname_key, NULL));
- ErrorF("threadname_key = %d\n", threadname_key);
- if(pthread_getspecific(threadname_key) == NULL) {
- char *nameptr = malloc(32);
- sprintf(nameptr, "main thread %d", random());
- // strcpy(nameptr, "main thread");
- ErrorF("calling: pthread_setspecific(%d, %s)=%d\n", threadname_key, nameptr, pthread_setspecific(threadname_key, nameptr));
- if (pthread_getspecific(threadname_key) != NULL) ErrorF("current thread: %s\n", (char *)pthread_getspecific(threadname_key));
- } else {
- if (pthread_getspecific(threadname_key) != NULL) ErrorF("thread was already: %s\n", (char *)pthread_getspecific(threadname_key));
- }
display = "0";
InitGlobals();
diff --git a/dix/window.c b/dix/window.c
index d3160c903..33e9752b6 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -124,9 +124,6 @@ Equipment Corporation.
#include "dixevents.h"
#include "globals.h"
-#ifdef XAPPGROUP
-#include "appgroup.h"
-#endif
#include "privates.h"
#include "xace.h"
@@ -310,6 +307,10 @@ SetWindowToDefaults(WindowPtr pWin)
sem = xcalloc(1, sizeof(FocusSemaphoresRec));
dixSetPrivate(&pWin->devPrivates, FocusPrivatesKey, sem);
+
+#ifdef ROOTLESS
+ pWin->rootlessUnhittable = FALSE;
+#endif
}
static void
@@ -632,14 +633,6 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w,
if (!ancwopt)
ancwopt = FindWindowWithOptional(pParent)->optional;
if (visual == CopyFromParent) {
-#ifdef XAPPGROUP
- VisualID ag_visual;
-
- if (client->appgroup && !pParent->parent &&
- (ag_visual = XagRootVisual (client)))
- visual = ag_visual;
- else
-#endif
visual = ancwopt->visual;
}
@@ -1339,22 +1332,6 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
pVlist++;
if (cmap == CopyFromParent)
{
-#ifdef XAPPGROUP
- Colormap ag_colormap;
- ClientPtr win_owner;
-
- /*
- * win_owner == client for CreateWindow, other clients
- * can ChangeWindowAttributes
- */
- win_owner = clients[CLIENT_ID(pWin->drawable.id)];
-
- if ( win_owner && win_owner->appgroup &&
- !pWin->parent->parent &&
- (ag_colormap = XagDefaultColormap (win_owner)))
- cmap = ag_colormap;
- else
-#endif
if (pWin->parent &&
(!pWin->optional ||
pWin->optional->visual == wVisual (pWin->parent)))
@@ -2283,10 +2260,6 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client)
h = pWin->drawable.height,
bw = pWin->borderWidth;
int rc, action, smode = Above;
-#ifdef XAPPGROUP
- ClientPtr win_owner;
- ClientPtr ag_leader = NULL;
-#endif
xEvent event;
if ((pWin->drawable.class == InputOnly) && (mask & IllegalInputOnlyConfigureMask))
@@ -2382,17 +2355,9 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client)
else
pSib = pWin->nextSib;
-#ifdef XAPPGROUP
- win_owner = clients[CLIENT_ID(pWin->drawable.id)];
- ag_leader = XagLeader (win_owner);
-#endif
if ((!pWin->overrideRedirect) &&
(RedirectSend(pParent)
-#ifdef XAPPGROUP
- || (win_owner->appgroup && ag_leader &&
- XagIsControlledRoot (client, pParent))
-#endif
))
{
event.u.u.type = ConfigureRequest;
@@ -2417,16 +2382,6 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client)
event.u.configureRequest.height = h;
event.u.configureRequest.borderWidth = bw;
event.u.configureRequest.valueMask = mask;
-#ifdef XAPPGROUP
- /* make sure if the ag_leader maps the window it goes to the wm */
- if (ag_leader && ag_leader != client &&
- XagIsControlledRoot (client, pParent)) {
- event.u.configureRequest.parent = XagId (win_owner);
- (void) TryClientEvents (ag_leader, &event, 1,
- NoEventMask, NoEventMask, NullGrab);
- return Success;
- }
-#endif
event.u.configureRequest.parent = pParent->drawable.id;
if (MaybeDeliverEventsToClient(pParent, &event, 1,
SubstructureRedirectMask, client) == 1)
@@ -2803,31 +2758,13 @@ MapWindow(WindowPtr pWin, ClientPtr client)
{
xEvent event;
Bool anyMarked;
-#ifdef XAPPGROUP
- ClientPtr win_owner = clients[CLIENT_ID(pWin->drawable.id)];
- ClientPtr ag_leader = XagLeader (win_owner);
-#endif
if ((!pWin->overrideRedirect) &&
(RedirectSend(pParent)
-#ifdef XAPPGROUP
- || (win_owner->appgroup && ag_leader &&
- XagIsControlledRoot (client, pParent))
-#endif
))
{
event.u.u.type = MapRequest;
event.u.mapRequest.window = pWin->drawable.id;
-#ifdef XAPPGROUP
- /* make sure if the ag_leader maps the window it goes to the wm */
- if (ag_leader && ag_leader != client &&
- XagIsControlledRoot (client, pParent)) {
- event.u.mapRequest.parent = XagId (win_owner);
- (void) TryClientEvents (ag_leader, &event, 1,
- NoEventMask, NoEventMask, NullGrab);
- return Success;
- }
-#endif
event.u.mapRequest.parent = pParent->drawable.id;
if (MaybeDeliverEventsToClient(pParent, &event, 1,
diff --git a/exa/exa.c b/exa/exa.c
index cbe66e875..3a6ad988e 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -224,6 +224,43 @@ exaLog2(int val)
return bits - 1;
}
+static void
+exaSetAccelBlock(ExaScreenPrivPtr pExaScr, ExaPixmapPrivPtr pExaPixmap,
+ int w, int h, int bpp)
+{
+ pExaPixmap->accel_blocked = 0;
+
+ if (pExaScr->info->maxPitchPixels) {
+ int max_pitch = pExaScr->info->maxPitchPixels * (bpp + 7) / 8;
+
+ if (pExaPixmap->fb_pitch > max_pitch)
+ pExaPixmap->accel_blocked |= EXA_RANGE_PITCH;
+ }
+
+ if (pExaScr->info->maxPitchBytes &&
+ pExaPixmap->fb_pitch > pExaScr->info->maxPitchBytes)
+ pExaPixmap->accel_blocked |= EXA_RANGE_PITCH;
+
+ if (w > pExaScr->info->maxX)
+ pExaPixmap->accel_blocked |= EXA_RANGE_WIDTH;
+
+ if (h > pExaScr->info->maxY)
+ pExaPixmap->accel_blocked |= EXA_RANGE_HEIGHT;
+}
+
+static void
+exaSetFbPitch(ExaScreenPrivPtr pExaScr, ExaPixmapPrivPtr pExaPixmap,
+ int w, int h, int bpp)
+{
+ if (pExaScr->info->flags & EXA_OFFSCREEN_ALIGN_POT && w != 1)
+ pExaPixmap->fb_pitch = (1 << (exaLog2(w - 1) + 1)) * bpp / 8;
+ else
+ pExaPixmap->fb_pitch = w * bpp / 8;
+
+ pExaPixmap->fb_pitch = EXA_ALIGN(pExaPixmap->fb_pitch,
+ pExaScr->info->pixmapPitchAlign);
+}
+
/**
* exaCreatePixmap() creates a new pixmap.
*
@@ -268,12 +305,8 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
if (paddedWidth / 4 > 32767 || h > 32767)
return NullPixmap;
- if (pExaScr->info->flags & EXA_OFFSCREEN_ALIGN_POT && w != 1)
- pExaPixmap->fb_pitch = (1 << (exaLog2(w - 1) + 1)) * bpp / 8;
- else
- pExaPixmap->fb_pitch = w * bpp / 8;
- pExaPixmap->fb_pitch = EXA_ALIGN(pExaPixmap->fb_pitch,
- pExaScr->info->pixmapPitchAlign);
+ exaSetFbPitch(pExaScr, pExaPixmap, w, h, bpp);
+
if (paddedWidth < pExaPixmap->fb_pitch)
paddedWidth = pExaPixmap->fb_pitch;
@@ -307,12 +340,7 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
pExaPixmap->offscreen = FALSE;
pExaPixmap->fb_ptr = NULL;
- if (pExaScr->info->flags & EXA_OFFSCREEN_ALIGN_POT && w != 1)
- pExaPixmap->fb_pitch = (1 << (exaLog2(w - 1) + 1)) * bpp / 8;
- else
- pExaPixmap->fb_pitch = w * bpp / 8;
- pExaPixmap->fb_pitch = EXA_ALIGN(pExaPixmap->fb_pitch,
- pExaScr->info->pixmapPitchAlign);
+ exaSetFbPitch(pExaScr, pExaPixmap, w, h, bpp);
pExaPixmap->fb_size = pExaPixmap->fb_pitch * h;
if (pExaPixmap->fb_pitch > 131071) {
@@ -339,25 +367,8 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
REGION_NULL(pScreen, &pExaPixmap->validSys);
REGION_NULL(pScreen, &pExaPixmap->validFB);
- /* Check whether this pixmap can be used for acceleration. */
- pExaPixmap->accel_blocked = 0;
-
- if (pExaScr->info->maxPitchPixels) {
- int max_pitch = pExaScr->info->maxPitchPixels * (bpp + 7) / 8;
-
- if (pExaPixmap->fb_pitch > max_pitch)
- pExaPixmap->accel_blocked |= EXA_RANGE_PITCH;
- }
-
- if (pExaScr->info->maxPitchBytes &&
- pExaPixmap->fb_pitch > pExaScr->info->maxPitchBytes)
- pExaPixmap->accel_blocked |= EXA_RANGE_PITCH;
-
- if (w > pExaScr->info->maxX)
- pExaPixmap->accel_blocked |= EXA_RANGE_WIDTH;
-
- if (h > pExaScr->info->maxY)
- pExaPixmap->accel_blocked |= EXA_RANGE_HEIGHT;
+ exaSetAccelBlock(pExaScr, pExaPixmap,
+ w, h, bpp);
return pPixmap;
}
@@ -373,12 +384,25 @@ exaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth,
if (!pPixmap)
return FALSE;
+ pExaScr = ExaGetScreenPriv(pPixmap->drawable.pScreen);
pExaPixmap = ExaGetPixmapPriv(pPixmap);
- if (pExaPixmap)
- pExaPixmap->sys_ptr = pPixData;
+ if (pExaPixmap) {
+ if (pPixData)
+ pExaPixmap->sys_ptr = pPixData;
+
+ if (devKind > 0)
+ pExaPixmap->sys_pitch = devKind;
+
+ if (width > 0 && height > 0 && bitsPerPixel > 0) {
+ exaSetFbPitch(pExaScr, pExaPixmap,
+ width, height, bitsPerPixel);
+
+ exaSetAccelBlock(pExaScr, pExaPixmap,
+ width, height, bitsPerPixel);
+ }
+ }
- pExaScr = ExaGetScreenPriv(pPixmap->drawable.pScreen);
if (pExaScr->info->ModifyPixmapHeader) {
ret = pExaScr->info->ModifyPixmapHeader(pPixmap, width, height, depth,
@@ -675,6 +699,34 @@ exaBitmapToRegion(PixmapPtr pPix)
return ret;
}
+static Bool
+exaCreateScreenResources(ScreenPtr pScreen)
+{
+ ExaScreenPriv(pScreen);
+ PixmapPtr pScreenPixmap;
+ Bool b;
+
+ pScreen->CreateScreenResources = pExaScr->SavedCreateScreenResources;
+ b = pScreen->CreateScreenResources(pScreen);
+ pScreen->CreateScreenResources = exaCreateScreenResources;
+
+ if (!b)
+ return FALSE;
+
+ pScreenPixmap = pScreen->GetScreenPixmap(pScreen);
+
+ if (pScreenPixmap) {
+ ExaPixmapPriv(pScreenPixmap);
+
+ exaSetAccelBlock(pExaScr, pExaPixmap,
+ pScreenPixmap->drawable.width,
+ pScreenPixmap->drawable.height,
+ pScreenPixmap->drawable.bitsPerPixel);
+ }
+
+ return TRUE;
+}
+
/**
* exaCloseScreen() unwraps its wrapped screen functions and tears down EXA's
* screen private, before calling down to the next CloseSccreen.
@@ -696,6 +748,7 @@ exaCloseScreen(int i, ScreenPtr pScreen)
pScreen->CopyWindow = pExaScr->SavedCopyWindow;
pScreen->ChangeWindowAttributes = pExaScr->SavedChangeWindowAttributes;
pScreen->BitmapToRegion = pExaScr->SavedBitmapToRegion;
+ pScreen->CreateScreenResources = pExaScr->SavedCreateScreenResources;
#ifdef RENDER
if (ps) {
ps->Composite = pExaScr->SavedComposite;
@@ -853,6 +906,9 @@ exaDriverInit (ScreenPtr pScreen,
pExaScr->SavedBitmapToRegion = pScreen->BitmapToRegion;
pScreen->BitmapToRegion = exaBitmapToRegion;
+ pExaScr->SavedCreateScreenResources = pScreen->CreateScreenResources;
+ pScreen->CreateScreenResources = exaCreateScreenResources;
+
#ifdef RENDER
if (ps) {
pExaScr->SavedComposite = ps->Composite;
diff --git a/exa/exa.h b/exa/exa.h
index 97ae6c0a5..256209418 100644
--- a/exa/exa.h
+++ b/exa/exa.h
@@ -64,6 +64,8 @@ struct _ExaOffscreenArea {
ExaOffscreenState state;
ExaOffscreenArea *next;
+
+ unsigned eviction_cost;
};
/**
diff --git a/exa/exa_accel.c b/exa/exa_accel.c
index c2bfdee6b..844683cfc 100644
--- a/exa/exa_accel.c
+++ b/exa/exa_accel.c
@@ -527,16 +527,36 @@ exaCopyNtoN (DrawablePtr pSrcDrawable,
pDstExaPixmap = ExaGetPixmapPriv (pDstPixmap);
/* Check whether the accelerator can use this pixmap.
- * FIXME: If it cannot, use temporary pixmaps so that the drawing
- * happens within limits.
+ * If the pitch of the pixmaps is out of range, there's nothing
+ * we can do but fall back to software rendering.
*/
- if (pSrcExaPixmap->accel_blocked || pDstExaPixmap->accel_blocked)
- {
+ if (pSrcExaPixmap->accel_blocked & EXA_RANGE_PITCH ||
+ pDstExaPixmap->accel_blocked & EXA_RANGE_PITCH)
goto fallback;
- } else {
- exaDoMigration (pixmaps, 2, TRUE);
+
+ /* If the width or the height of either of the pixmaps
+ * is out of range, check whether the boxes are actually out of the
+ * addressable range as well. If they aren't, we can still do
+ * the copying in hardware.
+ */
+ if (pSrcExaPixmap->accel_blocked || pDstExaPixmap->accel_blocked) {
+ int i;
+
+ for (i = 0; i < nbox; i++) {
+ /* src */
+ if ((pbox[i].x2 + dx + src_off_x) >= pExaScr->info->maxX ||
+ (pbox[i].y2 + dy + src_off_y) >= pExaScr->info->maxY)
+ goto fallback;
+
+ /* dst */
+ if ((pbox[i].x2 + dst_off_x) >= pExaScr->info->maxX ||
+ (pbox[i].y2 + dst_off_y) >= pExaScr->info->maxY)
+ goto fallback;
+ }
}
+ exaDoMigration (pixmaps, 2, TRUE);
+
/* Mixed directions must be handled specially if the card is lame */
if ((pExaScr->info->flags & EXA_TWO_BITBLT_DIRECTIONS) &&
reverse != upsidedown) {
diff --git a/exa/exa_offscreen.c b/exa/exa_offscreen.c
index 85b538896..4aaa2c132 100644
--- a/exa/exa_offscreen.c
+++ b/exa/exa_offscreen.c
@@ -21,11 +21,9 @@
*/
/** @file
- * This allocator allocates blocks of memory by maintaining a list of areas
- * and a score for each area. As an area is marked used, its score is
- * incremented, and periodically all of the areas have their scores decayed by
- * a fraction. When allocating, the contiguous block of areas with the minimum
- * score is found and evicted in order to make room for the new allocation.
+ * This allocator allocates blocks of memory by maintaining a list of areas.
+ * When allocating, the contiguous block of areas with the minimum eviction
+ * cost is found and evicted in order to make room for the new allocation.
*/
#include "exa_priv.h"
@@ -71,19 +69,36 @@ ExaOffscreenKickOut (ScreenPtr pScreen, ExaOffscreenArea *area)
return exaOffscreenFree (pScreen, area);
}
-#define AREA_SCORE(area) (area->size / (double)(pExaScr->offScreenCounter - area->last_use))
+static void
+exaUpdateEvictionCost(ExaOffscreenArea *area, unsigned offScreenCounter)
+{
+ unsigned age;
+
+ if (area->state == ExaOffscreenAvail)
+ return;
+
+ age = offScreenCounter - area->last_use;
+
+ /* This is unlikely to happen, but could result in a division by zero... */
+ if (age > (UINT_MAX / 2)) {
+ age = UINT_MAX / 2;
+ area->last_use = offScreenCounter - age;
+ }
+
+ area->eviction_cost = area->size / age;
+}
static ExaOffscreenArea *
exaFindAreaToEvict(ExaScreenPrivPtr pExaScr, int size, int align)
{
ExaOffscreenArea *begin, *end, *best;
- double score, best_score;
+ unsigned cost, best_cost;
int avail, real_size, tmp;
- best_score = UINT_MAX;
+ best_cost = UINT_MAX;
begin = end = pExaScr->info->offScreenAreas;
avail = 0;
- score = 0;
+ cost = 0;
best = 0;
while (end != NULL)
@@ -106,23 +121,24 @@ exaFindAreaToEvict(ExaScreenPrivPtr pExaScr, int size, int align)
if (end->state == ExaOffscreenLocked) {
/* Can't more room here, restart after this locked area */
avail = 0;
- score = 0;
+ cost = 0;
begin = end;
goto restart;
}
avail += end->size;
- score += AREA_SCORE(end);
+ exaUpdateEvictionCost(end, pExaScr->offScreenCounter);
+ cost += end->eviction_cost;
end = end->next;
}
- /* Check the score, update best */
- if (avail >= real_size && score < best_score) {
+ /* Check the cost, update best */
+ if (avail >= real_size && cost < best_cost) {
best = begin;
- best_score = score;
+ best_cost = cost;
}
avail -= begin->size;
- score -= AREA_SCORE(begin);
+ cost -= begin->eviction_cost;
begin = begin->next;
}
@@ -244,6 +260,7 @@ exaOffscreenAlloc (ScreenPtr pScreen, int size, int align,
new_area->state = ExaOffscreenAvail;
new_area->save = NULL;
new_area->last_use = 0;
+ new_area->eviction_cost = 0;
new_area->next = area->next;
area->next = new_area;
area->size = real_size;
@@ -409,6 +426,7 @@ exaOffscreenFree (ScreenPtr pScreen, ExaOffscreenArea *area)
area->state = ExaOffscreenAvail;
area->save = NULL;
area->last_use = 0;
+ area->eviction_cost = 0;
/*
* Find previous area
*/
@@ -474,6 +492,7 @@ exaOffscreenInit (ScreenPtr pScreen)
area->save = NULL;
area->next = NULL;
area->last_use = 0;
+ area->eviction_cost = 0;
/* Add it to the free areas */
pExaScr->info->offScreenAreas = area;
diff --git a/exa/exa_priv.h b/exa/exa_priv.h
index e41f46aba..0138e4a7d 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -107,6 +107,7 @@ typedef struct {
CopyWindowProcPtr SavedCopyWindow;
ChangeWindowAttributesProcPtr SavedChangeWindowAttributes;
BitmapToRegionProcPtr SavedBitmapToRegion;
+ CreateScreenResourcesProcPtr SavedCreateScreenResources;
ModifyPixmapHeaderProcPtr SavedModifyPixmapHeader;
#ifdef RENDER
CompositeProcPtr SavedComposite;
diff --git a/exa/exa_render.c b/exa/exa_render.c
index 38e2a04bd..1d7b8974c 100644
--- a/exa/exa_render.c
+++ b/exa/exa_render.c
@@ -51,6 +51,9 @@ static void exaCompositeFallbackPictDesc(PicturePtr pict, char *string, int n)
case PICT_a8r8g8b8:
snprintf(format, 20, "ARGB8888");
break;
+ case PICT_x8r8g8b8:
+ snprintf(format, 20, "XRGB8888");
+ break;
case PICT_r5g6b5:
snprintf(format, 20, "RGB565 ");
break;
@@ -650,7 +653,7 @@ exaComposite(CARD8 op,
!pSrc->transform &&
pSrc->repeatType == RepeatNormal)
{
- DDXPointRec srcOrg;
+ DDXPointRec patOrg;
/* Let's see if the driver can do the repeat in one go */
if (pExaScr->info->PrepareComposite && !pSrc->alphaMap &&
@@ -674,12 +677,14 @@ exaComposite(CARD8 op,
width, height))
goto done;
- srcOrg.x = (xSrc - xDst) % pSrc->pDrawable->width;
- srcOrg.y = (ySrc - yDst) % pSrc->pDrawable->height;
+ /* pattern origin is the point in the destination drawable
+ * corresponding to (0,0) in the source */
+ patOrg.x = xDst - xSrc;
+ patOrg.y = yDst - ySrc;
ret = exaFillRegionTiled(pDst->pDrawable, &region,
(PixmapPtr)pSrc->pDrawable,
- &srcOrg, FB_ALLONES, GXcopy);
+ &patOrg, FB_ALLONES, GXcopy);
REGION_UNINIT(pDst->pDrawable->pScreen, &region);
diff --git a/fb/Makefile.am b/fb/Makefile.am
index e34aaba10..399426933 100644
--- a/fb/Makefile.am
+++ b/fb/Makefile.am
@@ -7,7 +7,7 @@ INCLUDES = \
AM_CFLAGS = $(DIX_CFLAGS)
if XORG
-sdk_HEADERS = fb.h fbrop.h fbpseudocolor.h fboverlay.h wfbrename.h
+sdk_HEADERS = fb.h fbrop.h fboverlay.h wfbrename.h
endif
libfb_la_CFLAGS = $(AM_CFLAGS)
@@ -49,9 +49,7 @@ libfb_la_SOURCES = \
fbtile.c \
fbtrap.c \
fbutil.c \
- fbwindow.c \
- fbpseudocolor.c \
- fbpseudocolor.h
+ fbwindow.c
libwfb_la_SOURCES = $(libfb_la_SOURCES)
diff --git a/fb/fb.h b/fb/fb.h
index 01000d79c..1cd947380 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -141,7 +141,7 @@ typedef unsigned __int64 FbBits;
defined(ia64) || defined(__ia64__) || \
defined(__sparc64__) || defined(_LP64) || \
defined(__s390x__) || \
- defined(amd64) || defined (__amd64__) || \
+ defined(amd64) || defined (__amd64__) || defined(__x86_64__) || \
defined (__powerpc64__) || \
(defined(sgi) && (_MIPS_SZLONG == 64))
typedef unsigned long FbBits;
diff --git a/fb/fbpseudocolor.c b/fb/fbpseudocolor.c
deleted file mode 100644
index 06cf15992..000000000
--- a/fb/fbpseudocolor.c
+++ /dev/null
@@ -1,2248 +0,0 @@
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <string.h>
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "scrnintstr.h"
-#include "colormapst.h"
-#include "glyphstr.h"
-#include "resource.h"
-#include <X11/fonts/font.h>
-#include "dixfontstr.h"
-#include <X11/fonts/fontstruct.h>
-#include "micmap.h"
-#include "fb.h"
-#include "fbpseudocolor.h"
-
-static Bool xxCreateGC(GCPtr pGC);
-static void xxValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDraw);
-static void xxDestroyGC(GCPtr pGC);
-static void xxChangeGC (GCPtr pGC, unsigned long mask);
-static void xxCopyGC (GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
-static void xxChangeClip (GCPtr pGC, int type, pointer pvalue, int nrects);
-
-static void xxCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
-static void xxDestroyClip(GCPtr pGC);
-static void xxFillSpans(DrawablePtr pDraw, GC *pGC, int nInit,
- DDXPointPtr pptInit, int *pwidthInit, int fSorted);
-static void xxSetSpans(DrawablePtr pDraw, GCPtr pGC, char *pcharsrc,
- DDXPointPtr pptInit, int *pwidthInit, int nspans,
- int fSorted);
-static void xxPutImage(DrawablePtr pDraw, GCPtr pGC, int depth, int x, int y,
- int w, int h,int leftPad, int format, char *pImage);
-static RegionPtr xxCopyPlane(DrawablePtr pSrc,
- DrawablePtr pDst, GCPtr pGC,int srcx, int srcy,
- int width, int height, int dstx, int dsty,
- unsigned long bitPlane);
-static void xxPolyPoint(DrawablePtr pDraw, GCPtr pGC, int mode, int npt,
- xPoint *pptInit);
-static void xxPolylines(DrawablePtr pDraw, GCPtr pGC, int mode,
- int npt, DDXPointPtr pptInit);
-static void xxPolySegment(DrawablePtr pDraw, GCPtr pGC, int nseg,
- xSegment *pSeg);
-static void xxPolyRectangle(DrawablePtr pDraw, GCPtr pGC, int nRects,
- xRectangle *pRects);
-static void xxPolyArc( DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs);
-static void xxFillPolygon(DrawablePtr pDraw, GCPtr pGC, int shape,
- int mode, int count, DDXPointPtr pptInit);
-static void xxPolyFillRect(DrawablePtr pDraw, GCPtr pGC, int nRectsInit,
- xRectangle *pRectsInit);
-static RegionPtr xxCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GC *pGC,
- int srcx, int srcy, int width, int height,
- int dstx, int dsty);
-static void xxPolyFillArc(DrawablePtr pDraw, GCPtr pGC, int narcs,
- xArc *parcs);
-static int xxPolyText8(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count,
- char *chars);
-static int xxPolyText16(DrawablePtr pDraw, GCPtr pGC, int x, int y,
- int count, unsigned short *chars);
-static void xxImageText8(DrawablePtr pDraw, GCPtr pGC, int x,
- int y, int count, char *chars);
-static void xxImageText16(DrawablePtr pDraw, GCPtr pGC, int x, int y,
- int count, unsigned short *chars);
-static void xxImageGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int x, int y,
- unsigned int nglyph, CharInfoPtr *ppci,
- pointer pglyphBase);
-static void xxPolyGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int x, int y,
- unsigned int nglyph, CharInfoPtr *ppci,
- pointer pglyphBase);
-static void xxPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDraw,
- int dx, int dy, int xOrg, int yOrg);
-static void
-xxComposite (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
- INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask,
- INT16 xDst, INT16 yDst, CARD16 width, CARD16 height);
-static void
-xxGlyphs (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
- PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist,
- GlyphListPtr list, GlyphPtr *glyphs);
-
-
-typedef struct _xxCmapPrivRec {
- CARD32* cmap;
- ColormapPtr pmap;
- Bool dirty;
- struct _xxCmapPrivRec *next;
-} xxCmapPrivRec, *xxCmapPrivPtr;
-
-
-typedef struct {
- CloseScreenProcPtr CloseScreen;
- CreateScreenResourcesProcPtr CreateScreenResources;
- CreateWindowProcPtr CreateWindow;
- CopyWindowProcPtr CopyWindow;
- WindowExposuresProcPtr WindowExposures;
- CreateGCProcPtr CreateGC;
- CreateColormapProcPtr CreateColormap;
- DestroyColormapProcPtr DestroyColormap;
- InstallColormapProcPtr InstallColormap;
- UninstallColormapProcPtr UninstallColormap;
- ListInstalledColormapsProcPtr ListInstalledColormaps;
- StoreColorsProcPtr StoreColors;
-#ifdef RENDER
- CompositeProcPtr Composite;
- GlyphsProcPtr Glyphs;
-#endif
- PixmapPtr pPixmap;
- char * addr;
- pointer pBits;
- RegionRec region;
- VisualPtr bVisual;
- RegionRec bRegion;
- int myDepth;
- int depth;
- ColormapPtr baseCmap;
- ColormapPtr* InstalledCmaps;
- xxCmapPrivPtr Cmaps;
- int numInstalledColormaps;
- int colormapDirty;
- xxSyncFunc sync;
-} xxScrPrivRec, *xxScrPrivPtr;
-
-#define xxGetScrPriv(s) ((xxScrPrivPtr) \
- dixLookupPrivate(&(s)->devPrivates, xxScrPrivateKey))
-#define xxScrPriv(s) xxScrPrivPtr pScrPriv = xxGetScrPriv(s)
-
-#define xxGetCmapPriv(s) ((xxCmapPrivPtr) \
- dixLookupPrivate(&(s)->devPrivates, xxColormapPrivateKey))
-#define xxCmapPriv(s) xxCmapPrivPtr pCmapPriv = xxGetCmapPriv(s);
-
-typedef struct _xxGCPriv {
- GCOps *ops;
- GCFuncs *funcs;
-} xxGCPrivRec, *xxGCPrivPtr;
-
-#define xxGetGCPriv(pGC) ((xxGCPrivPtr) \
- dixLookupPrivate(&(pGC)->devPrivates, xxGCPrivateKey))
-#define xxGCPriv(pGC) xxGCPrivPtr pGCPriv = xxGetGCPriv(pGC)
-
-static DevPrivateKey xxScrPrivateKey = &xxScrPrivateKey;
-static DevPrivateKey xxGCPrivateKey = &xxGCPrivateKey;
-static DevPrivateKey xxColormapPrivateKey = &xxColormapPrivateKey;
-
-
-#define wrap(priv,real,mem,func) {\
- priv->mem = real->mem; \
- real->mem = func; \
-}
-
-#define unwrap(priv,real,mem) {\
- real->mem = priv->mem; \
-}
-
-#define MARK_DIRTY (1 << 31)
-
-#define MAX_NUM_XX_INSTALLED_CMAPS 255
-/* #define DEBUG */
-#ifdef DEBUG
-# define DBG ErrorF
-# define DBG_ARGS(x) ErrorF x
-# define PRINT_RECTS(rec) {\
- int i;\
- BoxPtr box;\
- ErrorF("RECTS: %i\n",REGION_NUM_RECTS(&rec));\
- if (REGION_NUM_RECTS(&rec) > 1) { \
- for (i = 0; i < REGION_NUM_RECTS(&rec); i++ ) {\
- box = REGION_BOX(&rec,i);\
- ErrorF("x1: %hi x2: %hi y1: %hi y2: %hi\n", \
- box->x1,box->x2,box->y1,box->y2);\
- }\
- } else { \
- box = &(rec.extents); \
- ErrorF("x1: %hi x2: %hi y1: %hi y2: %hi\n", \
- box->x1,box->x2,box->y1,box->y2);\
- } \
-}
-#else
-# define DBG(x)
-# define DBG_ARGS(x)
-# define PRINT_RECTS(rec)
-#endif
-
-#if 0
-static void xxCopyPseudocolorRegion(ScreenPtr pScreen, RegionPtr pReg,
- xxCmapPrivPtr pCmapPriv);
-static void xxUpdateFb(ScreenPtr pScreen);
-
-
-static void
-xxUpdateWindowImmediately(WindowPtr pWin)
-{
- xxScrPriv(pWin->drawable.pScreen);
- xxCmapPrivPtr pCmapPriv;
- ColormapPtr pmap;
-
- pmap = (ColormapPtr)LookupIDByType(wColormap(pWin),RT_COLORMAP);
-
- if (pmap && (pCmapPriv = xxGetCmapPriv(pmap)) != (pointer)-1) {
- xxCopyPseudocolorRegion(pWin->drawable.pScreen,
- &pScrPriv->region, pCmapPriv);
- }
-}
-#else
-# define xxUpdateWindowImmediately(x)
-#endif
-
-static ColormapPtr
-xxGetBaseColormap(ScreenPtr pScreen)
-{
- xxScrPriv(pScreen);
- DepthPtr pDepth = pScreen->allowedDepths;
- int i,j,k;
- ColormapPtr pDefMap
- = (ColormapPtr) LookupIDByType(pScreen->defColormap,RT_COLORMAP);
- ColormapPtr cmap = NULL;
- VisualPtr pVisual = NULL;
-
- for (i = 0; i < pScreen->numDepths; i++, pDepth++)
- if (pDepth->depth == pScrPriv->depth) {
- for (j = 0; j < pDepth->numVids; j++) {
- if (pDefMap->pVisual->vid == pDepth->vids[j]
- && pDefMap->pVisual->class == TrueColor) {
- cmap = pDefMap;
- break;
- }
- if (!pVisual) {
- for (k = 0; k < pScreen->numVisuals; k++) {
- if (pScreen->visuals[k].class == TrueColor
- && pScreen->visuals[k].vid
- == pDepth->vids[j]) {
- pVisual = &pScreen->visuals[k];
- break;
- }
- }
- }
- }
- if (cmap)
- break;
- }
-
- if (!cmap) {
- CreateColormap(FakeClientID(0),pScreen,pVisual,&cmap,AllocNone,0);
- }
-
- return cmap;
-}
-
-static Bool
-xxCreateScreenResources(ScreenPtr pScreen)
-{
- PixmapPtr pPix;
- xxScrPriv(pScreen);
- Bool ret;
- PixmapPtr pPixmap;
- BoxRec box;
- int depth = pScrPriv->myDepth;
- pointer pBits;
-
- unwrap (pScrPriv,pScreen, CreateScreenResources);
- ret = pScreen->CreateScreenResources(pScreen);
- wrap(pScrPriv,pScreen,CreateScreenResources,xxCreateScreenResources);
-
- if (!ret) return FALSE;
-
- pScrPriv->pBits = NULL;
- if (pScrPriv->addr)
- pBits = pScrPriv->addr;
- else
- pBits = xalloc(pScreen->width * pScreen->height
- * (BitsPerPixel(depth) >> 3));
- if (!pBits) return FALSE;
-
- pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, depth, 0);
- if (!pPixmap) {
- xfree(pBits);
- return FALSE;
- }
- if (!(*pScreen->ModifyPixmapHeader)(pPixmap, pScreen->width,
- pScreen->height, depth,
- BitsPerPixel(depth),
- PixmapBytePad(pScreen->width, depth),
- pBits)) {
- xfree(pBits);
- return FALSE;
- }
- if (pScreen->rootDepth == pScrPriv->myDepth) {
- pPix = (PixmapPtr)pScreen->devPrivate;
- if (!(*pScreen->ModifyPixmapHeader)(pPix, 0,0, pScrPriv->depth,
- BitsPerPixel(pScrPriv->depth),
- PixmapBytePad(pScreen->width,
- pScrPriv->depth),
- 0)) {
- xfree(pBits);
- return FALSE;
- }
- }
-
- pScrPriv->baseCmap = xxGetBaseColormap(pScreen);
-
- pScrPriv->pBits = pBits;
- pScrPriv->pPixmap = pPixmap;
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = pScreen->width;
- box.y2 = pScreen->height;
- REGION_NULL(pScreen, &pScrPriv->region);
- REGION_INIT(pScreen, &pScrPriv->bRegion, &box, 0);
-
- return TRUE;
-}
-
-static Bool
-xxCloseScreen (int iScreen, ScreenPtr pScreen)
-{
- xxScrPriv(pScreen);
- Bool ret;
-
- (*pScreen->DestroyPixmap)(pScrPriv->pPixmap);
- /* We don't need to free the baseColormap as FreeClientResourcess
- will have taken care of it. */
- REGION_UNINIT (pScreen, &pScrPriv->region);
-
- unwrap (pScrPriv,pScreen, CloseScreen);
- ret = pScreen->CloseScreen(iScreen,pScreen);
-
- xfree(pScrPriv->pBits);
- xfree(pScrPriv->InstalledCmaps);
- xfree(pScrPriv);
-
- return TRUE;
-}
-
-static Bool
-xxMyVisual(ScreenPtr pScreen, VisualID vid)
-{
- xxScrPriv(pScreen);
- DepthPtr pDepth = pScreen->allowedDepths;
- int i,j;
-
- for (i = 0; i < pScreen->numDepths; i++, pDepth++)
- if (pDepth->depth == pScrPriv->myDepth) {
- for (j = 0; j < pDepth->numVids; j++) {
- if (vid == pDepth->vids[j]) {
- return TRUE;
- }
- }
- }
- return FALSE;
-}
-
-static Bool
-xxInitColormapPrivate(ColormapPtr pmap)
-{
- xxScrPriv(pmap->pScreen);
- xxCmapPrivPtr pCmapPriv;
- pointer cmap;
-
- dixSetPrivate(&pmap->devPrivates, xxColormapPrivateKey, (pointer) -1);
-
- if (xxMyVisual(pmap->pScreen,pmap->pVisual->vid)) {
- DBG("CreateColormap\n");
- pCmapPriv = (xxCmapPrivPtr) xalloc (sizeof (xxCmapPrivRec));
- if (!pCmapPriv)
- return FALSE;
- dixSetPrivate(&pmap->devPrivates, xxColormapPrivateKey, pCmapPriv);
- cmap = xalloc(sizeof (CARD32) * (1 << pScrPriv->myDepth));
- if (!cmap)
- return FALSE;
-
- memset(cmap,0,sizeof (CARD32) * (1 << pScrPriv->myDepth));
-
- pCmapPriv->cmap = cmap;
- pCmapPriv->dirty = FALSE;
- pCmapPriv->pmap = pmap;
- pCmapPriv->next = pScrPriv->Cmaps;
- pScrPriv->Cmaps = pCmapPriv;
- }
- return TRUE;
-}
-
-
-static Bool
-xxCreateColormap(ColormapPtr pmap)
-{
- xxScrPriv(pmap->pScreen);
- Bool ret;
-
- if (!xxInitColormapPrivate(pmap)) return FALSE;
-
- unwrap(pScrPriv,pmap->pScreen, CreateColormap);
- ret = pmap->pScreen->CreateColormap(pmap);
- wrap(pScrPriv,pmap->pScreen,CreateColormap,xxCreateColormap);
-
- return ret;
-}
-
-static int
-xxCmapInstalled(ColormapPtr pmap)
-{
- xxScrPriv(pmap->pScreen);
- int i;
-
- for (i = 0; i < pScrPriv->numInstalledColormaps; i++)
- if (pScrPriv->InstalledCmaps[i] == pmap)
- break;
- if (i == pScrPriv->numInstalledColormaps) /* not installed */
- return -1;
- return i;
-}
-
-static void
-xxInstalledCmapDelete(ScreenPtr pScreen, int num)
-{
- xxScrPriv(pScreen);
- int i;
-
- pScrPriv->numInstalledColormaps--;
-
- for (i = num; i < pScrPriv->numInstalledColormaps; i++)
- pScrPriv->InstalledCmaps[i] = pScrPriv->InstalledCmaps[i+1];
-}
-
-static void
-xxDestroyColormap(ColormapPtr pmap)
-{
- xxScrPriv(pmap->pScreen);
- xxCmapPriv(pmap);
-
- if (pCmapPriv != (pointer) -1) {
- xxCmapPrivPtr tmpCmapPriv = pScrPriv->Cmaps;
- xxCmapPrivPtr *prevCmapPriv = &pScrPriv->Cmaps;
- int n;
-
- DBG("DestroyColormap\n");
-
- if ((n = xxCmapInstalled(pmap)) != -1)
- xxInstalledCmapDelete(pmap->pScreen,n);
-
- while (tmpCmapPriv) {
- if (tmpCmapPriv->pmap == pmap) {
- *prevCmapPriv = tmpCmapPriv->next;
- break;
- }
- prevCmapPriv = &tmpCmapPriv->next;
- tmpCmapPriv = tmpCmapPriv->next;
- }
-
- xfree(pCmapPriv->cmap);
- xfree(pCmapPriv);
- }
-
- unwrap(pScrPriv,pmap->pScreen, DestroyColormap);
- pmap->pScreen->DestroyColormap(pmap);
- wrap(pScrPriv,pmap->pScreen,DestroyColormap,xxDestroyColormap);
-}
-
-#define Shift(v,d) ((d) < 0 ? ((v) >> (-d)) : ((v) << (d)))
-
-static int
-xxComputeCmapShift (unsigned long mask)
-{
- int shift;
- unsigned long bit;
-
- shift = 16;
- bit = 0x80000000;
- while (!(mask & bit))
- {
- shift--;
- bit >>= 1;
- }
- return shift;
-}
-
-static void
-xxStoreColors(ColormapPtr pmap, int nColors, xColorItem *pColors)
-{
- xxScrPriv(pmap->pScreen);
- xxCmapPriv(pmap);
-
- if (pCmapPriv != (pointer) -1) {
-
- xColorItem *expanddefs;
- int i;
- VisualPtr bVisual;
- int rs, gs, bs;
-
- if (nColors == 0) return;
-
- DBG("StoreColors\n");
-
- expanddefs = xalloc(sizeof(xColorItem)
- * (1 << pScrPriv->myDepth));
- if (!expanddefs) return;
-
- bVisual = pScrPriv->bVisual;
-
- DBG("StoreColors\n");
-
- rs = xxComputeCmapShift(bVisual->redMask);
- gs = xxComputeCmapShift(bVisual->greenMask);
- bs = xxComputeCmapShift(bVisual->blueMask);
-
- if ((pmap->pVisual->class | DynamicClass) == DirectColor) {
- nColors = miExpandDirectColors(pmap, nColors, pColors, expanddefs);
- pColors = expanddefs;
- }
-
- for (i = 0; i < nColors; i++) {
- DBG_ARGS(("index: %i r 0x%x g 0x%x b 0x%x\n", pColors->pixel,
- pColors->red, pColors->green, pColors->blue));
- pCmapPriv->cmap[pColors->pixel] = MARK_DIRTY
- | (Shift(pColors->red, rs) & bVisual->redMask)
- | (Shift(pColors->green, gs) & bVisual->greenMask)
- | (Shift(pColors->blue, bs) & bVisual->blueMask);
- pColors++;
- }
-
- xfree(expanddefs);
-
- pCmapPriv->dirty = TRUE;
- pScrPriv->colormapDirty = TRUE;
-
- return;
- }
-
- unwrap(pScrPriv,pmap->pScreen, StoreColors);
- pmap->pScreen->StoreColors(pmap,nColors,pColors);
- wrap(pScrPriv,pmap->pScreen,StoreColors,xxStoreColors);
-}
-
-static void
-xxInstallColormap(ColormapPtr pmap)
-{
- int i;
- xxScrPriv(pmap->pScreen);
- xxCmapPriv(pmap);
-
- if (pCmapPriv != (pointer) -1) {
- Pixel *pixels;
- xrgb *colors;
- int i;
- VisualPtr pVisual;
- xColorItem *defs;
-
- DBG("InstallColormap\n");
-
- if (xxCmapInstalled(pmap) != -1)
- return;
-
- if (!pScrPriv->numInstalledColormaps) {
- unwrap(pScrPriv,pmap->pScreen, InstallColormap);
- pmap->pScreen->InstallColormap(pScrPriv->baseCmap);
- wrap(pScrPriv,pmap->pScreen,InstallColormap,xxInstallColormap);
- }
-
- pixels = xalloc(sizeof(Pixel) * (1 << pScrPriv->myDepth));
- colors = xalloc(sizeof(xrgb) * (1 << pScrPriv->myDepth));
- defs = xalloc(sizeof(xColorItem) * (1 << pScrPriv->myDepth));
-
- if (!pixels || !colors)
- return;
-
- /* if we have more than max installed delete the oldest */
- if (pScrPriv->numInstalledColormaps == MAX_NUM_XX_INSTALLED_CMAPS)
- xxInstalledCmapDelete(pmap->pScreen,0);
-
- pScrPriv->InstalledCmaps[pScrPriv->numInstalledColormaps] = pmap;
- pScrPriv->numInstalledColormaps++;
-
- pVisual = pScrPriv->bVisual;
-
- for (i = 0; i < (1 << pScrPriv->myDepth); i++)
- pixels[i] = i;
-
- QueryColors (pmap, (1 << pScrPriv->myDepth), pixels, colors);
-
- for (i = 0; i < (1 << pScrPriv->myDepth); i++) {
- defs[i].pixel = pixels[i];
- defs[i].red = colors[i].red;
- defs[i].green = colors[i].green;
- defs[i].blue = colors[i].blue;
- defs[i].flags = DoRed|DoGreen|DoBlue;
- }
- xxStoreColors(pmap,(1 << pScrPriv->myDepth),defs);
-
- xfree(pixels);
- xfree(colors);
- xfree(defs);
-
- return;
- }
-
- for (i = pScrPriv->numInstalledColormaps; i ; i--)
- WalkTree(pmap->pScreen, TellLostMap,
- (char *)&pScrPriv->InstalledCmaps[i-1]->mid);
-
- pScrPriv->numInstalledColormaps = 0;
-
- unwrap(pScrPriv,pmap->pScreen, InstallColormap);
- pmap->pScreen->InstallColormap(pmap);
- wrap(pScrPriv,pmap->pScreen,InstallColormap,xxInstallColormap);
-}
-
-static void
-xxUninstallColormap(ColormapPtr pmap)
-{
- xxScrPriv(pmap->pScreen);
- xxCmapPriv(pmap);
-
- if (pCmapPriv != (pointer) -1) {
- int num;
-
- if ((num = xxCmapInstalled(pmap)) == -1)
- return;
-
- DBG("UninstallColormap\n");
- xxInstalledCmapDelete(pmap->pScreen,num);
-
- return;
- }
-
- unwrap(pScrPriv,pmap->pScreen, UninstallColormap);
- pmap->pScreen->UninstallColormap(pmap);
- wrap(pScrPriv,pmap->pScreen,UninstallColormap,xxUninstallColormap);
-
-}
-
-static int
-xxListInstalledColormaps(ScreenPtr pScreen, Colormap *pCmapIds)
-{
- int n,i;
- xxScrPriv(pScreen);
-
- unwrap(pScrPriv,pScreen, ListInstalledColormaps);
- n = pScreen->ListInstalledColormaps(pScreen, pCmapIds);
- wrap (pScrPriv,pScreen,ListInstalledColormaps,xxListInstalledColormaps);
-
- pCmapIds += n;
-
- for (i = 0; i < pScrPriv->numInstalledColormaps; i++) {
- *pCmapIds++ = pScrPriv->InstalledCmaps[i]->mid;
- n++;
- }
-
- return n;
-}
-
-static Bool
-xxCreateWindow(WindowPtr pWin)
-{
- xxScrPriv(pWin->drawable.pScreen);
-
- if (pWin->drawable.class != InputOutput
- || pScrPriv->myDepth != pWin->drawable.depth) {
- Bool ret;
- DBG("CreateWindow NoPseudo\n");
- unwrap (pScrPriv, pWin->drawable.pScreen, CreateWindow);
- ret = pWin->drawable.pScreen->CreateWindow(pWin);
- wrap(pScrPriv, pWin->drawable.pScreen, CreateWindow, xxCreateWindow);
-
- return ret;
- }
-
- DBG("CreateWindow\n");
-
- dixSetPrivate(&pWin->devPrivates, fbGetWinPrivateKey(), pScrPriv->pPixmap);
- PRINT_RECTS(pScrPriv->region);
- if (!pWin->parent) {
- REGION_EMPTY (pWin->drawable.pScreen, &pScrPriv->region);
- }
- PRINT_RECTS(pScrPriv->region);
-
- return TRUE;
-}
-
-static void
-xxWalkChildren(WindowPtr pWin, RegionPtr pReg, PixmapPtr pPixmap)
-{
-
- WindowPtr pCurWin = pWin;
-
- do {
- if (fbGetWindowPixmap(pCurWin) == pPixmap) {
- DBG("WalkWindow Add\n");
- REGION_UNION(pWin->drawable.pScreen,pReg,pReg,
- &pCurWin->borderClip);
- } else {
- DBG("WalkWindow Sub\n");
- REGION_SUBTRACT(pWin->drawable.pScreen,pReg,pReg,
- &pCurWin->borderClip);
- }
- if (pCurWin->lastChild)
- xxWalkChildren(pCurWin->lastChild,pReg, pPixmap);
- } while ((pCurWin = pCurWin->prevSib));
-}
-
-static void
-xxPickMyWindows(WindowPtr pWin, RegionPtr pRgn)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- xxScrPriv(pScreen);
-
- if (fbGetWindowPixmap(pWin) == pScrPriv->pPixmap) {
- REGION_UNION(pWin->drawable.pScreen,pRgn,pRgn,&pWin->borderClip);
- }
- if (pWin->lastChild)
- xxWalkChildren(pWin->lastChild,pRgn,pScrPriv->pPixmap);
-}
-
-static void
-xxCopyWindow(WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- xxScrPriv(pScreen);
- RegionRec rgn;
- RegionRec rgn_new;
- int dx, dy;
- PixmapPtr pPixmap = fbGetWindowPixmap(pWin);
-
- DBG("xxCopyWindow\n");
-
- dx = ptOldOrg.x - pWin->drawable.x;
- dy = ptOldOrg.y - pWin->drawable.y;
-
- REGION_NULL(pScreen, &rgn_new);
- REGION_UNION(pScreen, &rgn_new,&rgn_new,prgnSrc);
- REGION_TRANSLATE(pScreen,&rgn_new,-dx,-dy);
-
- REGION_NULL(pScreen, &rgn);
- xxPickMyWindows(pWin,&rgn);
-
- unwrap (pScrPriv, pScreen, CopyWindow);
- dixSetPrivate(&pWin->devPrivates, fbGetWinPrivateKey(),
- fbGetScreenPixmap(pScreen));
- pScreen->CopyWindow(pWin, ptOldOrg, prgnSrc);
- dixSetPrivate(&pWin->devPrivates, fbGetWinPrivateKey(), pPixmap);
- wrap(pScrPriv, pScreen, CopyWindow, xxCopyWindow);
-
- REGION_INTERSECT(pScreen,&rgn,&rgn,&rgn_new);
- if (REGION_NOTEMPTY (pScreen,&rgn)) {
- fbCopyRegion(&pScrPriv->pPixmap->drawable,&pScrPriv->pPixmap->drawable,
- 0,&rgn,dx,dy,fbCopyWindowProc,0,(void*)0);
- REGION_TRANSLATE(pScreen,&rgn,dx,dy);
- REGION_INTERSECT(pScreen,&rgn_new,&pScrPriv->region,&rgn);
- REGION_SUBTRACT(pScreen,&pScrPriv->region,&pScrPriv->region,&rgn);
- REGION_TRANSLATE(pScreen,&rgn_new,-dx,-dy);
- REGION_UNION(pScreen,&pScrPriv->region,&pScrPriv->region,&rgn_new);
- }
-#if 1
- REGION_UNINIT(pScreen,&rgn_new);
- REGION_UNINIT(pScreen,&rgn);
-#endif
-}
-
-static void
-xxWindowExposures (WindowPtr pWin,
- RegionPtr prgn,
- RegionPtr other_exposed)
-{
- xxScrPriv(pWin->drawable.pScreen);
-
- if (fbGetWindowPixmap(pWin) == pScrPriv->pPixmap) {
- DBG("WindowExposures\n");
- PRINT_RECTS(pScrPriv->region);
- REGION_UNION(pWin->drawable.pScreen,&pScrPriv->region,
- &pScrPriv->region,
- prgn);
- PRINT_RECTS(pScrPriv->region);
- } else {
- DBG("WindowExposures NonPseudo\n");
- PRINT_RECTS(pScrPriv->region);
- REGION_SUBTRACT(pWin->drawable.pScreen,&pScrPriv->region,
- &pScrPriv->region,
- prgn);
- PRINT_RECTS(pScrPriv->region);
- }
- unwrap (pScrPriv, pWin->drawable.pScreen, WindowExposures);
- pWin->drawable.pScreen->WindowExposures(pWin, prgn, other_exposed);
- wrap(pScrPriv, pWin->drawable.pScreen, WindowExposures, xxWindowExposures);
-}
-
-static void
-xxCopyPseudocolorRegion(ScreenPtr pScreen, RegionPtr pReg,
- xxCmapPrivPtr pCmapPriv)
-{
- xxScrPriv(pScreen);
- CARD32 mask = (1 << pScrPriv->myDepth) - 1;
- int num = REGION_NUM_RECTS(pReg);
- BoxPtr pbox = REGION_RECTS(pReg);
- int width, height;
- CARD8 *src;
- CARD16 *dst, *dst_base;
- int dst_stride;
- register CARD32 *cmap = pCmapPriv->cmap;
- register CARD8 *s;
- register CARD16 *d;
- int w;
-
- fbPrepareAccess((DrawablePtr)pScreen->devPrivate);
-
- dst_base = (CARD16*) ((PixmapPtr)pScreen->devPrivate)->devPrivate.ptr;
- dst_stride = (int)((PixmapPtr)pScreen->devPrivate)->devKind
- / sizeof (CARD16);
-
- while (num--) {
- height = pbox->y2 - pbox->y1;
- width = pbox->x2 - pbox->x1;
-
- src = (unsigned char *) pScrPriv->pBits
- + (pbox->y1 * pScreen->width) + pbox->x1;
- dst = dst_base + (pbox->y1 * dst_stride) + pbox->x1;
- while (height--) {
- w = width;
- s = src;
- d = dst;
-
- while(w--) {
- *(d++) = (CARD16)*(cmap + ((*(s++)) & mask));
- }
- src += pScreen->width;
- dst += dst_stride;
- }
- pbox++;
- }
-
- fbFinishAccess(&((PixmapPtr)pScreen->devPrivate)->drawable);
-}
-
-static void
-xxUpdateCmapPseudocolorRegion(ScreenPtr pScreen, RegionPtr pReg,
- xxCmapPrivPtr pCmapPriv)
-{
- xxScrPriv(pScreen);
- CARD32 mask = (1 << pScrPriv->myDepth) - 1;
- int num = REGION_NUM_RECTS(pReg);
- BoxPtr pbox = REGION_RECTS(pReg);
- int width, height;
- CARD8 *src;
- CARD16 *dst, *dst_base;
- int dst_stride;
- register CARD32 val;
- register CARD32 *cmap = pCmapPriv->cmap;
- register CARD8 *s;
- register CARD16 *d;
- int w;
-
- dst_base = (CARD16*) ((PixmapPtr)pScreen->devPrivate)->devPrivate.ptr;
- dst_stride = (int)((PixmapPtr)pScreen->devPrivate)->devKind
- / sizeof (CARD16);
-
- while (num--) {
-
- height = pbox->y2 - pbox->y1;
- width = pbox->x2 - pbox->x1;
-
- src = (unsigned char *) pScrPriv->pBits
- + (pbox->y1 * pScreen->width) + pbox->x1;
- dst = dst_base + (pbox->y1 * dst_stride) + pbox->x1;
- while (height--) {
- w = width;
- s = src;
- d = dst;
- while(w--) {
- val = *(cmap + ((*(s++)) & mask));
- if (val & MARK_DIRTY) {
- *d = (CARD16) val;
- }
- d++;
- }
- src += pScreen->width;
- dst += dst_stride;
- }
- pbox++;
- }
-}
-
-static void
-xxGetWindowRegion(WindowPtr pWin,RegionPtr winreg)
-{
- REGION_NULL(pWin->drawable.pScreen,winreg);
- /* get visible part of the border ...Argh */
- REGION_SUBTRACT(pWin->drawable.pScreen,winreg,&pWin->borderSize,
- &pWin->winSize);
- REGION_INTERSECT(pWin->drawable.pScreen,winreg,winreg,
- &pWin->borderClip);
- /* add window interior excluding children */
- REGION_UNION(pWin->drawable.pScreen,winreg,winreg,
- &pWin->clipList);
-}
-
-static int
-xxUpdateRegion(WindowPtr pWin, pointer unused)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- xxScrPriv(pScreen);
- ColormapPtr pmap = (pointer) -1;
- RegionRec winreg, rgni;
-
- if (pScrPriv->myDepth == pWin->drawable.depth) {
- xxCmapPrivPtr pCmapPriv = (pointer)-1;
- xxGetWindowRegion(pWin,&winreg);
-
- if (pScrPriv->colormapDirty) {
-
- pmap = (ColormapPtr)LookupIDByType(wColormap(pWin),RT_COLORMAP);
- if (!pmap)
- goto CONTINUE; /* return ? */
-
- pCmapPriv = xxGetCmapPriv(pmap);
- if (pCmapPriv == (pointer) -1)
- return WT_WALKCHILDREN;
- if (!pCmapPriv->dirty)
- goto CONTINUE;
-
- REGION_NULL (pScreen, &rgni);
- /* This will be taken care of when damaged regions are updated */
- REGION_SUBTRACT(pScreen, &rgni, &winreg, &pScrPriv->region);
- if (REGION_NOTEMPTY (pScreen,&rgni))
- xxUpdateCmapPseudocolorRegion(pScreen,&rgni, pCmapPriv);
- }
- CONTINUE:
-
- REGION_NULL (pScreen, &rgni);
- REGION_INTERSECT (pScreen, &rgni, &winreg, &pScrPriv->region);
-
- if (REGION_NOTEMPTY (pScreen,&rgni)) {
- if (pmap == (pointer) -1) {
- pmap =
- (ColormapPtr)LookupIDByType(wColormap(pWin),RT_COLORMAP);
- if (!pmap) /* return ? */
- pmap = (ColormapPtr)LookupIDByType(pScreen->defColormap,
- RT_COLORMAP);
- pCmapPriv = xxGetCmapPriv(pmap);
- }
-
- if (pCmapPriv != (pointer)-1)
- xxCopyPseudocolorRegion(pScreen,&rgni, pCmapPriv);
- REGION_SUBTRACT(pScreen, &pScrPriv->region, &pScrPriv->region,
- &rgni);
- }
-#if 1
- REGION_UNINIT(pScreen,&rgni);
- REGION_UNINIT(pScreen,&winreg);
-#endif
- }
- return WT_WALKCHILDREN;
-}
-
-
-static void
-xxUpdateFb(ScreenPtr pScreen)
-{
- xxScrPriv(pScreen);
-
- DBG("Update FB\n");
- PRINT_RECTS(pScrPriv->region);
-
- if (pScrPriv->sync)
- pScrPriv->sync(pScreen); /*@!@*/
-
- WalkTree(pScreen,xxUpdateRegion,NULL);
-#if 0
- if (REGION_NOTEMPTY (pScreen,&pScrPriv->region)) {
- ColormapPtr pmap = (pointer) -1;
- xxCmapPrivPtr pCmapPriv;
-
- pmap = (ColormapPtr)LookupIDByType(pScreen->defColormap,
- RT_COLORMAP);
- pCmapPriv = xxGetCmapPriv(pmap);
- if (pCmapPriv != (pointer)-1)
- xxCopyPseudocolorRegion(pScreen,&pScrPriv->region, pCmapPriv);
- REGION_SUBTRACT(pScreen, &pScrPriv->region, &pScrPriv->region,
- &pScrPriv->region);
- }
-#endif
- if (pScrPriv->colormapDirty) {
- xxCmapPrivPtr pCmap = pScrPriv->Cmaps;
-
- while (pCmap) {
- int j;
-
- if (pCmap->dirty) {
- for (j = 0; j < (1 << pScrPriv->myDepth); j++)
- pCmap->cmap[j] &= ~MARK_DIRTY;
- pCmap->dirty = FALSE;
- }
- pCmap = pCmap->next;
- }
- pScrPriv->colormapDirty = FALSE;
- }
-}
-
-static void
-xxBlockHandler (pointer data,
- OSTimePtr pTimeout,
- pointer pRead)
-{
- ScreenPtr pScreen = (ScreenPtr) data;
- xxScrPriv(pScreen);
-
- if (REGION_NOTEMPTY (pScreen,&pScrPriv->region) || pScrPriv->colormapDirty)
- xxUpdateFb (pScreen);
-}
-
-static void
-xxWakeupHandler (pointer data, int i, pointer LastSelectMask)
-{
-}
-
-Bool
-xxSetup(ScreenPtr pScreen, int myDepth, int baseDepth, char* addr, xxSyncFunc sync)
-{
- xxScrPrivPtr pScrPriv;
- DepthPtr pDepths;
- ColormapPtr pDefMap;
- int i,j,k;
-
-#ifdef RENDER
- PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
-#endif
-
- if (!dixRequestPrivate(xxGCPrivateKey, sizeof (xxGCPrivRec)))
- return FALSE;
-
- pScrPriv = (xxScrPrivPtr) xalloc (sizeof (xxScrPrivRec));
- if (!pScrPriv)
- return FALSE;
-
- if (baseDepth)
- pScrPriv->depth = baseDepth;
- else {
- pDepths = pScreen->allowedDepths;
- for (i = 0; i < pScreen->numDepths; i++, pDepths++)
- if (pDepths->depth != myDepth)
- pScrPriv->depth = pDepths->depth;
- }
- if (!pScrPriv->depth)
- return FALSE;
-
- pDepths = pScreen->allowedDepths;
- for (i = 0; i < pScreen->numDepths; i++, pDepths++)
- if (pDepths->depth == pScrPriv->depth) {
- for (j = 0; i < pDepths->numVids; j++) {
- for (k = 0; k < pScreen->numVisuals; k++) {
- if (pScreen->visuals[k].vid
- == pDepths[i].vids[j]
- && pScreen->visuals[k].class == TrueColor) {
- pScrPriv->bVisual = &pScreen->visuals[k];
- goto DONE;
- }
- }
- }
- }
-
- DONE:
- if (!pScrPriv->bVisual)
- return FALSE;
-
- pScrPriv->myDepth = myDepth;
- pScrPriv->numInstalledColormaps = 0;
- pScrPriv->colormapDirty = FALSE;
- pScrPriv->Cmaps = NULL;
- pScrPriv->sync = sync;
-
- pScreen->maxInstalledCmaps += MAX_NUM_XX_INSTALLED_CMAPS;
- pScrPriv->InstalledCmaps = xcalloc(MAX_NUM_XX_INSTALLED_CMAPS,
- sizeof(ColormapPtr));
- if (!pScrPriv->InstalledCmaps)
- return FALSE;
-
-
- if (!RegisterBlockAndWakeupHandlers (xxBlockHandler,
- xxWakeupHandler,
- (pointer) pScreen))
- return FALSE;
-
- wrap (pScrPriv, pScreen, CloseScreen, xxCloseScreen);
- wrap (pScrPriv, pScreen, CreateScreenResources, xxCreateScreenResources);
- wrap (pScrPriv, pScreen, CreateWindow, xxCreateWindow);
- wrap (pScrPriv, pScreen, CopyWindow, xxCopyWindow);
-#if 0 /* can we leave this out even with backing store enabled ? */
- wrap (pScrPriv, pScreen, WindowExposures, xxWindowExposures);
-#endif
- wrap (pScrPriv, pScreen, CreateGC, xxCreateGC);
- wrap (pScrPriv, pScreen, CreateColormap, xxCreateColormap);
- wrap (pScrPriv, pScreen, DestroyColormap, xxDestroyColormap);
- wrap (pScrPriv, pScreen, InstallColormap, xxInstallColormap);
- wrap (pScrPriv, pScreen, UninstallColormap, xxUninstallColormap);
- wrap (pScrPriv, pScreen, ListInstalledColormaps, xxListInstalledColormaps);
- wrap (pScrPriv, pScreen, StoreColors, xxStoreColors);
-#ifdef RENDER
- if (ps) {
- wrap (pScrPriv, ps, Glyphs, xxGlyphs);
- wrap (pScrPriv, ps, Composite, xxComposite);
- }
-#endif
- pScrPriv->addr = addr;
- dixSetPrivate(&pScreen->devPrivates, xxScrPrivateKey, pScrPriv);
-
- pDefMap = (ColormapPtr) LookupIDByType(pScreen->defColormap, RT_COLORMAP);
- if (!xxInitColormapPrivate(pDefMap))
- return FALSE;
-
- return TRUE;
-}
-
-GCFuncs xxGCFuncs = {
- xxValidateGC, xxChangeGC, xxCopyGC, xxDestroyGC,
- xxChangeClip, xxDestroyClip, xxCopyClip
-};
-
-static GCOps xxGCOps = {
- xxFillSpans, xxSetSpans,
- xxPutImage, xxCopyArea,
- xxCopyPlane, xxPolyPoint,
- xxPolylines, xxPolySegment,
- xxPolyRectangle, xxPolyArc,
- xxFillPolygon, xxPolyFillRect,
- xxPolyFillArc, xxPolyText8,
- xxPolyText16, xxImageText8,
- xxImageText16, xxImageGlyphBlt,
- xxPolyGlyphBlt, xxPushPixels,
- {NULL} /* devPrivate */
-};
-
-#define IS_VISIBLE(pDraw) (pDraw->type == DRAWABLE_WINDOW \
- && (fbGetWindowPixmap((WindowPtr) pDraw) == pScrPriv->pPixmap))
-
-#define TRANSLATE_BOX(box, pDraw) { \
- box.x1 += pDraw->x; \
- box.x2 += pDraw->x; \
- box.y1 += pDraw->y; \
- box.y2 += pDraw->y; \
- }
-
-#define TRIM_BOX(box, pGC) { \
- BoxPtr extents = &pGC->pCompositeClip->extents;\
- if(box.x1 < extents->x1) box.x1 = extents->x1; \
- if(box.x2 > extents->x2) box.x2 = extents->x2; \
- if(box.y1 < extents->y1) box.y1 = extents->y1; \
- if(box.y2 > extents->y2) box.y2 = extents->y2; \
- }
-
-#define BOX_NOT_EMPTY(box) \
- (((box.x2 - box.x1) > 0) && ((box.y2 - box.y1) > 0))
-
-
-#define _ADD_BOX(box,pGC) {\
- if (BOX_NOT_EMPTY(box)) { \
- RegionRec region; \
- ScreenPtr pScreen = pGC->pScreen;\
- REGION_INIT (pScreen, &region, &box, 1); \
- REGION_INTERSECT(pScreen,&region,&region,\
- (pGC)->pCompositeClip);\
- if (REGION_NOTEMPTY(pScreen,&region)) { \
- xxScrPriv(pScreen);\
- PRINT_RECTS(pScrPriv->region);\
- REGION_UNION(pScreen,&pScrPriv->region,&pScrPriv->region,&region);\
- PRINT_RECTS(pScrPriv->region);\
- REGION_UNINIT(pScreen,&region);\
- }\
- }\
-}
-
-#define TRANSLATE_AND_ADD_BOX(box,pGC) {\
- TRANSLATE_BOX(box,pDraw); \
- TRIM_BOX(box,pGC); \
- _ADD_BOX(box,pGC); \
-}
-
-#define ADD_BOX(box,pGC) { \
- TRIM_BOX(box,pGC); \
- _ADD_BOX(box,pGC); \
-}
-
-#define XX_GC_FUNC_PROLOGUE(pGC) \
- xxGCPriv(pGC); \
- unwrap(pGCPriv, pGC, funcs); \
- if (pGCPriv->ops) unwrap(pGCPriv, pGC, ops)
-
-#define XX_GC_FUNC_EPILOGUE(pGC) \
- wrap(pGCPriv, pGC, funcs, &xxGCFuncs); \
- if (pGCPriv->ops) wrap(pGCPriv, pGC, ops, &xxGCOps)
-
-static Bool
-xxCreateGC(GCPtr pGC)
-{
- ScreenPtr pScreen = pGC->pScreen;
- xxScrPriv(pScreen);
- xxGCPriv(pGC);
- Bool ret;
-
- unwrap (pScrPriv, pScreen, CreateGC);
- if((ret = (*pScreen->CreateGC) (pGC))) {
- pGCPriv->ops = NULL;
- pGCPriv->funcs = pGC->funcs;
- pGC->funcs = &xxGCFuncs;
- }
- wrap (pScrPriv, pScreen, CreateGC, xxCreateGC);
-
- return ret;
-}
-
-static void
-xxValidateGC(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw
-){
- XX_GC_FUNC_PROLOGUE (pGC);
- (*pGC->funcs->ValidateGC)(pGC, changes, pDraw);
- if(pDraw->type == DRAWABLE_WINDOW)
- pGCPriv->ops = pGC->ops; /* just so it's not NULL */
- else
- pGCPriv->ops = NULL;
- XX_GC_FUNC_EPILOGUE (pGC);
-}
-
-static void
-xxDestroyGC(GCPtr pGC)
-{
- XX_GC_FUNC_PROLOGUE (pGC);
- (*pGC->funcs->DestroyGC)(pGC);
- XX_GC_FUNC_EPILOGUE (pGC);
-}
-
-static void
-xxChangeGC (
- GCPtr pGC,
- unsigned long mask
-){
- XX_GC_FUNC_PROLOGUE (pGC);
- (*pGC->funcs->ChangeGC) (pGC, mask);
- XX_GC_FUNC_EPILOGUE (pGC);
-}
-
-static void
-xxCopyGC (
- GCPtr pGCSrc,
- unsigned long mask,
- GCPtr pGCDst
-){
- XX_GC_FUNC_PROLOGUE (pGCDst);
- (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
- XX_GC_FUNC_EPILOGUE (pGCDst);
-}
-
-static void
-xxChangeClip (
- GCPtr pGC,
- int type,
- pointer pvalue,
- int nrects
-){
- XX_GC_FUNC_PROLOGUE (pGC);
- (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
- XX_GC_FUNC_EPILOGUE (pGC);
-}
-
-static void
-xxCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
-{
- XX_GC_FUNC_PROLOGUE (pgcDst);
- (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
- XX_GC_FUNC_EPILOGUE (pgcDst);
-}
-
-static void
-xxDestroyClip(GCPtr pGC)
-{
- XX_GC_FUNC_PROLOGUE (pGC);
- (* pGC->funcs->DestroyClip)(pGC);
- XX_GC_FUNC_EPILOGUE (pGC);
-}
-
-#define XX_GC_OP_PROLOGUE(pGC,pDraw) \
- xxScrPriv(pDraw->pScreen); \
- xxGCPriv(pGC); \
- GCFuncs *oldFuncs = pGC->funcs; \
- unwrap(pGCPriv, pGC, funcs); \
- unwrap(pGCPriv, pGC, ops); \
-
-#define XX_GC_OP_EPILOGUE(pGC,pDraw) \
- wrap(pGCPriv, pGC, funcs, oldFuncs); \
- wrap(pGCPriv, pGC, ops, &xxGCOps)
-
-static void
-xxFillSpans(
- DrawablePtr pDraw,
- GC *pGC,
- int nInit,
- DDXPointPtr pptInit,
- int *pwidthInit,
- int fSorted
-){
- XX_GC_OP_PROLOGUE(pGC, pDraw);
-
- if(IS_VISIBLE(pDraw) && nInit) {
- DDXPointPtr ppt = pptInit;
- int *pwidth = pwidthInit;
- int i = nInit;
- BoxRec box;
-
- DBG("FillSpans\n");
- box.x1 = ppt->x;
- box.x2 = box.x1 + *pwidth;
- box.y2 = box.y1 = ppt->y;
-
- while(--i) {
- ppt++;
- pwidthInit++;
- if(box.x1 > ppt->x) box.x1 = ppt->x;
- if(box.x2 < (ppt->x + *pwidth))
- box.x2 = ppt->x + *pwidth;
- if(box.y1 > ppt->y) box.y1 = ppt->y;
- else if(box.y2 < ppt->y) box.y2 = ppt->y;
- }
-
- box.y2++;
-
- (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted);
-
-
- TRANSLATE_AND_ADD_BOX(box, pGC);
- } else
- (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted);
-
- XX_GC_OP_EPILOGUE(pGC, pDraw);
-}
-
-static void
-xxSetSpans(
- DrawablePtr pDraw,
- GCPtr pGC,
- char *pcharsrc,
- DDXPointPtr pptInit,
- int *pwidthInit,
- int nspans,
- int fSorted
-){
- XX_GC_OP_PROLOGUE(pGC, pDraw);
-
- if(IS_VISIBLE(pDraw) && nspans) {
- DDXPointPtr ppt = pptInit;
- int *pwidth = pwidthInit;
- int i = nspans;
- BoxRec box;
-
- DBG("SetSpans\n");
- box.x1 = ppt->x;
- box.x2 = box.x1 + *pwidth;
- box.y2 = box.y1 = ppt->y;
-
- while(--i) {
- ppt++;
- pwidth++;
- if(box.x1 > ppt->x) box.x1 = ppt->x;
- if(box.x2 < (ppt->x + *pwidth))
- box.x2 = ppt->x + *pwidth;
- if(box.y1 > ppt->y) box.y1 = ppt->y;
- else if(box.y2 < ppt->y) box.y2 = ppt->y;
- }
-
- box.y2++;
-
- (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, pptInit,
- pwidthInit, nspans, fSorted);
-
- TRANSLATE_AND_ADD_BOX(box, pGC);
- } else
- (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, pptInit,
- pwidthInit, nspans, fSorted);
-
- XX_GC_OP_EPILOGUE(pGC, pDraw);
-}
-
-static void
-xxPutImage(
- DrawablePtr pDraw,
- GCPtr pGC,
- int depth,
- int x, int y, int w, int h,
- int leftPad,
- int format,
- char *pImage
-){
- XX_GC_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->PutImage)(pDraw, pGC, depth, x, y, w, h,
- leftPad, format, pImage);
- XX_GC_OP_EPILOGUE(pGC, pDraw);
- if(IS_VISIBLE(pDraw)) {
- BoxRec box;
-
- DBG("PutImage\n");
- box.x1 = x + pDraw->x;
- box.x2 = box.x1 + w;
- box.y1 = y + pDraw->y;
- box.y2 = box.y1 + h;
-
- ADD_BOX(box, pGC);
- }
-}
-
-static RegionPtr
-xxCopyArea(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GC *pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty
-){
- RegionPtr ret;
- XX_GC_OP_PROLOGUE(pGC, pDst);
- DBG("xxCopyArea\n");
- ret = (*pGC->ops->CopyArea)(pSrc, pDst,
- pGC, srcx, srcy, width, height, dstx, dsty);
- XX_GC_OP_EPILOGUE(pGC, pDst);
-
- if(IS_VISIBLE(pDst)) {
- BoxRec box;
-
- DBG("CopyArea\n");
- box.x1 = dstx + pDst->x;
- box.x2 = box.x1 + width;
- box.y1 = dsty + pDst->y;
- box.y2 = box.y1 + height;
-
- ADD_BOX(box, pGC);
- }
-
- return ret;
-}
-
-static RegionPtr
-xxCopyPlane(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty,
- unsigned long bitPlane
-){
- RegionPtr ret;
- XX_GC_OP_PROLOGUE(pGC, pDst);
- ret = (*pGC->ops->CopyPlane)(pSrc, pDst,
- pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
- XX_GC_OP_EPILOGUE(pGC, pDst);
-
- if(IS_VISIBLE(pDst)) {
- BoxRec box;
-
- DBG("CopyPlane\n");
- box.x1 = dstx + pDst->x;
- box.x2 = box.x1 + width;
- box.y1 = dsty + pDst->y;
- box.y2 = box.y1 + height;
-
- ADD_BOX(box, pGC);
- }
-
- return ret;
-}
-
-static void
-xxPolyPoint(
- DrawablePtr pDraw,
- GCPtr pGC,
- int mode,
- int npt,
- xPoint *pptInit
-){
- XX_GC_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->PolyPoint)(pDraw, pGC, mode, npt, pptInit);
- XX_GC_OP_EPILOGUE(pGC, pDraw);
-
- if(IS_VISIBLE(pDraw) && npt) {
- BoxRec box;
-
- DBG("PolyPoint\n");
- box.x2 = box.x1 = pptInit->x;
- box.y2 = box.y1 = pptInit->y;
-
- /* this could be slow if the points were spread out */
-
- while(--npt) {
- pptInit++;
- if(box.x1 > pptInit->x) box.x1 = pptInit->x;
- else if(box.x2 < pptInit->x) box.x2 = pptInit->x;
- if(box.y1 > pptInit->y) box.y1 = pptInit->y;
- else if(box.y2 < pptInit->y) box.y2 = pptInit->y;
- }
-
- box.x2++;
- box.y2++;
-
- TRANSLATE_AND_ADD_BOX(box, pGC);
- }
-}
-
-static void
-xxPolylines(
- DrawablePtr pDraw,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr pptInit
-){
- XX_GC_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->Polylines)(pDraw, pGC, mode, npt, pptInit);
- XX_GC_OP_EPILOGUE(pGC, pDraw);
-
-
- if(IS_VISIBLE(pDraw) && npt) {
- BoxRec box;
- int extra = pGC->lineWidth >> 1;
-
- DBG("PolyLine\n");
- box.x2 = box.x1 = pptInit->x;
- box.y2 = box.y1 = pptInit->y;
-
- if(npt > 1) {
- if(pGC->joinStyle == JoinMiter)
- extra = 6 * pGC->lineWidth;
- else if(pGC->capStyle == CapProjecting)
- extra = pGC->lineWidth;
- }
-
- if(mode == CoordModePrevious) {
- int x = box.x1;
- int y = box.y1;
- while(--npt) {
- pptInit++;
- x += pptInit->x;
- y += pptInit->y;
- if(box.x1 > x) box.x1 = x;
- else if(box.x2 < x) box.x2 = x;
- if(box.y1 > y) box.y1 = y;
- else if(box.y2 < y) box.y2 = y;
- }
- } else {
- while(--npt) {
- pptInit++;
- if(box.x1 > pptInit->x) box.x1 = pptInit->x;
- else if(box.x2 < pptInit->x) box.x2 = pptInit->x;
- if(box.y1 > pptInit->y) box.y1 = pptInit->y;
- else if(box.y2 < pptInit->y) box.y2 = pptInit->y;
- }
- }
-
- box.x2++;
- box.y2++;
-
- if(extra) {
- box.x1 -= extra;
- box.x2 += extra;
- box.y1 -= extra;
- box.y2 += extra;
- }
-
- TRANSLATE_AND_ADD_BOX(box, pGC);
- }
-}
-
-static void
-xxPolySegment(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nseg,
- xSegment *pSeg
- ){
- XX_GC_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->PolySegment)(pDraw, pGC, nseg, pSeg);
- XX_GC_OP_EPILOGUE(pGC, pDraw);
-
- if(IS_VISIBLE(pDraw) && nseg) {
- BoxRec box;
- int extra = pGC->lineWidth;
-
- DBG("PolySegment\n");
- if(pGC->capStyle != CapProjecting)
- extra >>= 1;
-
- if(pSeg->x2 > pSeg->x1) {
- box.x1 = pSeg->x1;
- box.x2 = pSeg->x2;
- } else {
- box.x2 = pSeg->x1;
- box.x1 = pSeg->x2;
- }
-
- if(pSeg->y2 > pSeg->y1) {
- box.y1 = pSeg->y1;
- box.y2 = pSeg->y2;
- } else {
- box.y2 = pSeg->y1;
- box.y1 = pSeg->y2;
- }
-
- while(--nseg) {
- pSeg++;
- if(pSeg->x2 > pSeg->x1) {
- if(pSeg->x1 < box.x1) box.x1 = pSeg->x1;
- if(pSeg->x2 > box.x2) box.x2 = pSeg->x2;
- } else {
- if(pSeg->x2 < box.x1) box.x1 = pSeg->x2;
- if(pSeg->x1 > box.x2) box.x2 = pSeg->x1;
- }
- if(pSeg->y2 > pSeg->y1) {
- if(pSeg->y1 < box.y1) box.y1 = pSeg->y1;
- if(pSeg->y2 > box.y2) box.y2 = pSeg->y2;
- } else {
- if(pSeg->y2 < box.y1) box.y1 = pSeg->y2;
- if(pSeg->y1 > box.y2) box.y2 = pSeg->y1;
- }
- }
-
- box.x2++;
- box.y2++;
-
- if(extra) {
- box.x1 -= extra;
- box.x2 += extra;
- box.y1 -= extra;
- box.y2 += extra;
- }
-
- TRANSLATE_AND_ADD_BOX(box, pGC);
- }
-}
-
-static void
-xxPolyRectangle(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nRects,
- xRectangle *pRects
-){
- XX_GC_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->PolyRectangle)(pDraw, pGC, nRects, pRects);
- XX_GC_OP_EPILOGUE(pGC, pDraw);
-
- if(IS_VISIBLE(pDraw) && nRects)
- {
- BoxRec box;
- int offset1, offset2, offset3;
-
- DBG("PolyRectangle\n");
- offset2 = pGC->lineWidth;
- if(!offset2) offset2 = 1;
- offset1 = offset2 >> 1;
- offset3 = offset2 - offset1;
-
- while(nRects--)
- {
- box.x1 = pRects->x - offset1;
- box.y1 = pRects->y - offset1;
- box.x2 = box.x1 + pRects->width + offset2;
- box.y2 = box.y1 + offset2;
- TRANSLATE_AND_ADD_BOX(box, pGC);
- box.x1 = pRects->x - offset1;
- box.y1 = pRects->y + offset3;
- box.x2 = box.x1 + offset2;
- box.y2 = box.y1 + pRects->height - offset2;
- TRANSLATE_AND_ADD_BOX(box, pGC);
- box.x1 = pRects->x + pRects->width - offset1;
- box.y1 = pRects->y + offset3;
- box.x2 = box.x1 + offset2;
- box.y2 = box.y1 + pRects->height - offset2;
- TRANSLATE_AND_ADD_BOX(box, pGC);
- box.x1 = pRects->x - offset1;
- box.y1 = pRects->y + pRects->height - offset1;
- box.x2 = box.x1 + pRects->width + offset2;
- box.y2 = box.y1 + offset2;
- TRANSLATE_AND_ADD_BOX(box, pGC);
-
- pRects++;
- }
- }
-}
-
-static void
-xxPolyArc(
- DrawablePtr pDraw,
- GCPtr pGC,
- int narcs,
- xArc *parcs
-){
- XX_GC_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->PolyArc)(pDraw, pGC, narcs, parcs);
- XX_GC_OP_EPILOGUE(pGC, pDraw);
-
- if(IS_VISIBLE(pDraw) && narcs) {
- int extra = pGC->lineWidth >> 1;
- BoxRec box;
-
- DBG("PolyArc\n");
- box.x1 = parcs->x;
- box.x2 = box.x1 + parcs->width;
- box.y1 = parcs->y;
- box.y2 = box.y1 + parcs->height;
-
- /* should I break these up instead ? */
-
- while(--narcs) {
- parcs++;
- if(box.x1 > parcs->x) box.x1 = parcs->x;
- if(box.x2 < (parcs->x + parcs->width))
- box.x2 = parcs->x + parcs->width;
- if(box.y1 > parcs->y) box.y1 = parcs->y;
- if(box.y2 < (parcs->y + parcs->height))
- box.y2 = parcs->y + parcs->height;
- }
-
- if(extra) {
- box.x1 -= extra;
- box.x2 += extra;
- box.y1 -= extra;
- box.y2 += extra;
- }
-
- box.x2++;
- box.y2++;
-
- TRANSLATE_AND_ADD_BOX(box, pGC);
- }
-}
-
-static void
-xxFillPolygon(
- DrawablePtr pDraw,
- GCPtr pGC,
- int shape,
- int mode,
- int count,
- DDXPointPtr pptInit
-){
- XX_GC_OP_PROLOGUE(pGC, pDraw);
-
- if(IS_VISIBLE(pDraw) && (count > 2)) {
- DDXPointPtr ppt = pptInit;
- int i = count;
- BoxRec box;
-
- DBG("FillPolygon\n");
- box.x2 = box.x1 = ppt->x;
- box.y2 = box.y1 = ppt->y;
-
- if(mode != CoordModeOrigin) {
- int x = box.x1;
- int y = box.y1;
- while(--i) {
- ppt++;
- x += ppt->x;
- y += ppt->y;
- if(box.x1 > x) box.x1 = x;
- else if(box.x2 < x) box.x2 = x;
- if(box.y1 > y) box.y1 = y;
- else if(box.y2 < y) box.y2 = y;
- }
- } else {
- while(--i) {
- ppt++;
- if(box.x1 > ppt->x) box.x1 = ppt->x;
- else if(box.x2 < ppt->x) box.x2 = ppt->x;
- if(box.y1 > ppt->y) box.y1 = ppt->y;
- else if(box.y2 < ppt->y) box.y2 = ppt->y;
- }
- }
-
- box.x2++;
- box.y2++;
-
- (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, pptInit);
-
- TRANSLATE_AND_ADD_BOX(box, pGC);
- } else
- (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, pptInit);
-
- XX_GC_OP_EPILOGUE(pGC, pDraw);
-}
-
-static void
-xxPolyFillRect(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nRectsInit,
- xRectangle *pRectsInit
-){
- XX_GC_OP_PROLOGUE(pGC, pDraw);
-
- if(IS_VISIBLE(pDraw) && nRectsInit) {
- BoxRec box;
- xRectangle *pRects = pRectsInit;
- int nRects = nRectsInit;
-
- DBG("PolyFillRect\n");
- box.x1 = pRects->x;
- box.x2 = box.x1 + pRects->width;
- box.y1 = pRects->y;
- box.y2 = box.y1 + pRects->height;
-
- while(--nRects) {
- pRects++;
- if(box.x1 > pRects->x) box.x1 = pRects->x;
- if(box.x2 < (pRects->x + pRects->width))
- box.x2 = pRects->x + pRects->width;
- if(box.y1 > pRects->y) box.y1 = pRects->y;
- if(box.y2 < (pRects->y + pRects->height))
- box.y2 = pRects->y + pRects->height;
- }
-
- /* cfb messes with the pRectsInit so we have to do our
- calculations first */
-
- (*pGC->ops->PolyFillRect)(pDraw, pGC, nRectsInit, pRectsInit);
-
- TRANSLATE_AND_ADD_BOX(box, pGC);
- } else
- (*pGC->ops->PolyFillRect)(pDraw, pGC, nRectsInit, pRectsInit);
-
- XX_GC_OP_EPILOGUE(pGC, pDraw);
-}
-
-static void
-xxPolyFillArc(
- DrawablePtr pDraw,
- GCPtr pGC,
- int narcs,
- xArc *parcs
-){
- XX_GC_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->PolyFillArc)(pDraw, pGC, narcs, parcs);
- XX_GC_OP_EPILOGUE(pGC, pDraw);
-
- if(IS_VISIBLE(pDraw) && narcs) {
- BoxRec box;
-
- DBG("PolyFillArc\n");
- box.x1 = parcs->x;
- box.x2 = box.x1 + parcs->width;
- box.y1 = parcs->y;
- box.y2 = box.y1 + parcs->height;
-
- /* should I break these up instead ? */
-
- while(--narcs) {
- parcs++;
- if(box.x1 > parcs->x) box.x1 = parcs->x;
- if(box.x2 < (parcs->x + parcs->width))
- box.x2 = parcs->x + parcs->width;
- if(box.y1 > parcs->y) box.y1 = parcs->y;
- if(box.y2 < (parcs->y + parcs->height))
- box.y2 = parcs->y + parcs->height;
- }
-
- TRANSLATE_AND_ADD_BOX(box, pGC);
- }
-}
-
-static int
-xxPolyText8(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- char *chars
-){
- int width;
-
- XX_GC_OP_PROLOGUE(pGC, pDraw);
- width = (*pGC->ops->PolyText8)(pDraw, pGC, x, y, count, chars);
- XX_GC_OP_EPILOGUE(pGC, pDraw);
-
- width -= x;
-
- if(IS_VISIBLE(pDraw) && (width > 0)) {
- BoxRec box;
-
- DBG("PolyText8\n");
- /* ugh */
- box.x1 = pDraw->x + x + FONTMINBOUNDS(pGC->font, leftSideBearing);
- box.x2 = pDraw->x + x + FONTMAXBOUNDS(pGC->font, rightSideBearing);
-
- if(count > 1) {
- if(width > 0) box.x2 += width;
- else box.x1 += width;
- }
-
- box.y1 = pDraw->y + y - FONTMAXBOUNDS(pGC->font, ascent);
- box.y2 = pDraw->y + y + FONTMAXBOUNDS(pGC->font, descent);
-
- ADD_BOX(box, pGC);
- }
-
- return (width + x);
-}
-
-static int
-xxPolyText16(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- unsigned short *chars
-){
- int width;
-
- XX_GC_OP_PROLOGUE(pGC, pDraw);
- width = (*pGC->ops->PolyText16)(pDraw, pGC, x, y, count, chars);
- XX_GC_OP_EPILOGUE(pGC, pDraw);
-
- width -= x;
-
- if(IS_VISIBLE(pDraw) && (width > 0)) {
- BoxRec box;
-
- DBG("PolyText16\n");
- /* ugh */
- box.x1 = pDraw->x + x + FONTMINBOUNDS(pGC->font, leftSideBearing);
- box.x2 = pDraw->x + x + FONTMAXBOUNDS(pGC->font, rightSideBearing);
-
- if(count > 1) {
- if(width > 0) box.x2 += width;
- else box.x1 += width;
- }
-
- box.y1 = pDraw->y + y - FONTMAXBOUNDS(pGC->font, ascent);
- box.y2 = pDraw->y + y + FONTMAXBOUNDS(pGC->font, descent);
-
- ADD_BOX(box, pGC);
- }
-
- return (width + x);
-}
-
-static void
-xxImageText8(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- char *chars
-){
- XX_GC_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->ImageText8)(pDraw, pGC, x, y, count, chars);
- XX_GC_OP_EPILOGUE(pGC, pDraw);
-
- if(IS_VISIBLE(pDraw) && count) {
- int top, bot, Min, Max;
- BoxRec box;
-
- DBG("ImageText8\n");
- top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font));
- bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font));
-
- Min = count * FONTMINBOUNDS(pGC->font, characterWidth);
- if(Min > 0) Min = 0;
- Max = count * FONTMAXBOUNDS(pGC->font, characterWidth);
- if(Max < 0) Max = 0;
-
- /* ugh */
- box.x1 = pDraw->x + x + Min +
- FONTMINBOUNDS(pGC->font, leftSideBearing);
- box.x2 = pDraw->x + x + Max +
- FONTMAXBOUNDS(pGC->font, rightSideBearing);
-
- box.y1 = pDraw->y + y - top;
- box.y2 = pDraw->y + y + bot;
-
- ADD_BOX(box, pGC);
- }
-}
-
-static void
-xxImageText16(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- unsigned short *chars
-){
- XX_GC_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->ImageText16)(pDraw, pGC, x, y, count, chars);
- XX_GC_OP_EPILOGUE(pGC, pDraw);
-
- if(IS_VISIBLE(pDraw) && count) {
- int top, bot, Min, Max;
- BoxRec box;
-
- DBG("ImageText16\n");
- top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font));
- bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font));
-
- Min = count * FONTMINBOUNDS(pGC->font, characterWidth);
- if(Min > 0) Min = 0;
- Max = count * FONTMAXBOUNDS(pGC->font, characterWidth);
- if(Max < 0) Max = 0;
-
- /* ugh */
- box.x1 = pDraw->x + x + Min +
- FONTMINBOUNDS(pGC->font, leftSideBearing);
- box.x2 = pDraw->x + x + Max +
- FONTMAXBOUNDS(pGC->font, rightSideBearing);
-
- box.y1 = pDraw->y + y - top;
- box.y2 = pDraw->y + y + bot;
-
- ADD_BOX(box, pGC);
- }
-}
-
-static void
-xxImageGlyphBlt(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase
-){
- XX_GC_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, x, y, nglyph,
- ppci, pglyphBase);
- XX_GC_OP_EPILOGUE(pGC, pDraw);
-
- if(IS_VISIBLE(pDraw) && nglyph) {
- int top, bot, width = 0;
- BoxRec box;
-
- DBG("ImageGlyphBlt\n");
- top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font));
- bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font));
-
- box.x1 = ppci[0]->metrics.leftSideBearing;
- if(box.x1 > 0) box.x1 = 0;
- box.x2 = ppci[nglyph - 1]->metrics.rightSideBearing -
- ppci[nglyph - 1]->metrics.characterWidth;
- if(box.x2 < 0) box.x2 = 0;
-
- box.x2 += pDraw->x + x;
- box.x1 += pDraw->x + x;
-
- while(nglyph--) {
- width += (*ppci)->metrics.characterWidth;
- ppci++;
- }
-
- if(width > 0)
- box.x2 += width;
- else
- box.x1 += width;
-
- box.y1 = pDraw->y + y - top;
- box.y2 = pDraw->y + y + bot;
-
- ADD_BOX(box, pGC);
- }
-}
-
-static void
-xxPolyGlyphBlt(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase
-){
- XX_GC_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, x, y, nglyph,
- ppci, pglyphBase);
- XX_GC_OP_EPILOGUE(pGC, pDraw);
-
- if(IS_VISIBLE(pDraw) && nglyph) {
- BoxRec box;
-
- DBG("PolyGlyphBlt\n");
- /* ugh */
- box.x1 = pDraw->x + x + ppci[0]->metrics.leftSideBearing;
- box.x2 = pDraw->x + x + ppci[nglyph - 1]->metrics.rightSideBearing;
-
- if(nglyph > 1) {
- int width = 0;
-
- while(--nglyph) {
- width += (*ppci)->metrics.characterWidth;
- ppci++;
- }
-
- if(width > 0) box.x2 += width;
- else box.x1 += width;
- }
-
- box.y1 = pDraw->y + y - FONTMAXBOUNDS(pGC->font, ascent);
- box.y2 = pDraw->y + y + FONTMAXBOUNDS(pGC->font, descent);
-
- ADD_BOX(box, pGC);
- }
-}
-
-static void
-xxPushPixels(
- GCPtr pGC,
- PixmapPtr pBitMap,
- DrawablePtr pDraw,
- int dx, int dy, int xOrg, int yOrg
-){
- XX_GC_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->PushPixels)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
- XX_GC_OP_EPILOGUE(pGC, pDraw);
-
- if(IS_VISIBLE(pDraw)) {
- BoxRec box;
-
- DBG("PushPixels\n");
- box.x1 = xOrg + pDraw->x;
- box.x2 = box.x1 + dx;
- box.y1 = yOrg + pDraw->y;
- box.y2 = box.y1 + dy;
-
- ADD_BOX(box, pGC);
- }
-}
-
-
-#ifdef RENDER
-#define RENDER_MAKE_BOX(pDrawable,X,Y,W,H) { \
- box.x1 = X + pDrawable->x; \
- box.x2 = X + pDrawable->x + W; \
- box.y1 = Y + pDrawable->y; \
- box.y2 = Y + pDrawable->y + H; \
-}
-
-#define RENDER_ADD_BOX(pScreen,box) {\
- if (BOX_NOT_EMPTY(box)) { \
- RegionRec region; \
- xxScrPriv(pScreen);\
- ScreenPtr pScreen = pScreen;\
- REGION_INIT (pScreen, &region, &box, 1); \
- PRINT_RECTS(pScrPriv->region);\
- REGION_UNION(pScreen,&pScrPriv->region,&pScrPriv->region,&region);\
- PRINT_RECTS(pScrPriv->region);\
- REGION_UNINIT(pScreen,&region);\
- }\
-}
-
-static void
-xxComposite (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
- INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask,
- INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- xxScrPriv(pScreen);
- BoxRec box;
-
- unwrap (pScrPriv, ps, Composite);
- (*ps->Composite) (op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask,
- xDst, yDst, width, height);
- wrap (pScrPriv, ps, Composite, xxComposite);
- if (pDst->pDrawable->type == DRAWABLE_WINDOW) {
- RENDER_MAKE_BOX(pDst->pDrawable, xDst, yDst, width, height);
- RENDER_ADD_BOX(pScreen,box);
- }
-}
-
-
-static void
-xxGlyphs (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
- PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist,
- GlyphListPtr list, GlyphPtr *glyphs)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- xxScrPriv(pScreen);
- int x, y;
- int n;
- GlyphPtr glyph;
- BoxRec box;
-
- unwrap (pScrPriv, ps, Glyphs);
- (*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc,
- nlist, list, glyphs);
- wrap (pScrPriv, ps, Glyphs, xxGlyphs);
- if (pDst->pDrawable->type == DRAWABLE_WINDOW)
- {
- x = xSrc;
- y = ySrc;
- while (nlist--)
- {
- x += list->xOff;
- y += list->yOff;
- n = list->len;
- while (n--)
- {
- glyph = *glyphs++;
- RENDER_MAKE_BOX(pDst->pDrawable,
- x - glyph->info.x, y - glyph->info.y,
- glyph->info.width, glyph->info.height);
- RENDER_ADD_BOX(pScreen,box);
- x += glyph->info.xOff;
- y += glyph->info.yOff;
- }
- list++;
- }
- }
-}
-#endif
-
-void
-xxPrintVisuals(void)
-{
- int k,i,j;
- DepthPtr pDepth;
- VisualPtr pVisual;
-
- for (k = 0; k < screenInfo.numScreens; k++) {
- ScreenPtr pScreen = screenInfo.screens[k];
-
- pDepth = pScreen->allowedDepths;
- for (i = 0; i < pScreen->numDepths; i++, pDepth++)
- for (j = 0; j < pDepth->numVids; j++) {
- ErrorF("depth: %i vid: 0x%lx\n",
- pDepth->depth, pDepth->vids[j]);
- }
-
- pVisual = pScreen->visuals;
- for (i = 0; i < pScreen->numVisuals; i++, pVisual++)
- ErrorF("vid: 0x%x rm: 0x%lx gm: 0x%lx bm: 0x%lx\n",
- (unsigned int)pVisual->vid,
- pVisual->redMask,
- pVisual->greenMask,
- pVisual->blueMask);
- }
-}
-
-
diff --git a/fb/fbpseudocolor.h b/fb/fbpseudocolor.h
deleted file mode 100644
index 64de71db8..000000000
--- a/fb/fbpseudocolor.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef _FB_XX_H_
-# define _FB_XX_H_
-
-typedef void (*xxSyncFunc)(ScreenPtr);
-extern Bool xxSetup(ScreenPtr pScreen, int myDepth,
- int baseDepth, char *addr, xxSyncFunc sync);
-extern void xxPrintVisuals(void);
-
-
-#endif /* _FB_XX_H_ */
-
-
-
-
-
-
-
-
-
-
diff --git a/fb/wfbrename.h b/fb/wfbrename.h
index dc0528559..73ee510b9 100644
--- a/fb/wfbrename.h
+++ b/fb/wfbrename.h
@@ -187,12 +187,4 @@
#define fbZeroSegment wfbZeroSegment
#define free_pixman_pict wfb_free_pixman_pict
#define image_from_pict wfb_image_from_pict
-#define xxScrPrivateKey wfbxxScrPrivateKey
-#define xxGCPrivateKey wfbxxGCPrivateKey
-#define xxColormapPrivateKey wfbxxColormapPrivateKey
-#define xxGeneration wfbxxGeneration
-#define xxPrintVisuals wfbxxPrintVisuals
-#define xxGCFuncs wfbxxGCFuncs
-#define xxGCOps wfbxxGCOps
-#define xxSetup wfbxxSetup
#define composeFunctions wfbComposeFunctions
diff --git a/hw/dmx/dmx-config.h b/hw/dmx/dmx-config.h
index 343fdabf5..4a2dfe060 100644
--- a/hw/dmx/dmx-config.h
+++ b/hw/dmx/dmx-config.h
@@ -83,8 +83,6 @@
#undef XF86MISC
#undef XFreeXDGA
#undef XF86DRI
-#undef TOGCUP
-#undef MITMISC
#undef SCREENSAVER
#undef RANDR
#undef XFIXES
diff --git a/hw/dmx/dmxextension.c b/hw/dmx/dmxextension.c
index 560468c4b..aaa50d5c4 100644
--- a/hw/dmx/dmxextension.c
+++ b/hw/dmx/dmxextension.c
@@ -1350,7 +1350,6 @@ int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
* RTContext
* TagResType
* StalledResType
- * RT_APPGROUP
* SecurityAuthorizationResType
* RTEventClient
* __glXContextRes
diff --git a/hw/kdrive/ephyr/ephyr_draw.c b/hw/kdrive/ephyr/ephyr_draw.c
index 422b7c6b6..7b579c24b 100644
--- a/hw/kdrive/ephyr/ephyr_draw.c
+++ b/hw/kdrive/ephyr/ephyr_draw.c
@@ -28,7 +28,6 @@
#ifdef HAVE_CONFIG_H
#include <kdrive-config.h>
#endif
-#undef NDEBUG /* No, really. The whole point of this module is to crash. */
#include "ephyr.h"
#include "exa_priv.h"
diff --git a/hw/kdrive/ephyr/ephyrlog.h b/hw/kdrive/ephyr/ephyrlog.h
index 71f797777..a07a0a097 100644
--- a/hw/kdrive/ephyr/ephyrlog.h
+++ b/hw/kdrive/ephyr/ephyrlog.h
@@ -31,11 +31,11 @@
#include <assert.h>
#include "os.h"
-#ifdef NDEBUG
+#ifndef DEBUG
/*we are not in debug mode*/
#define EPHYR_LOG(...)
#define EPHYR_LOG_ERROR(...)
-#endif /*NDEBUG*/
+#endif /*!DEBUG*/
#define ERROR_LOG_LEVEL 3
#define INFO_LOG_LEVEL 4
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 62a82618a..c6724e487 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -1739,7 +1739,7 @@ KdClassifyInput (KdPointerInfo *pi, int type, int x, int y, int z, int b)
return keyboard;
}
-#ifndef NDEBUG
+#ifdef DEBUG
char *kdStateNames[] = {
"start",
"button_1_pend",
@@ -1772,7 +1772,7 @@ char *kdActionNames[] = {
"gen_down_2",
"gen_up_2",
};
-#endif
+#endif /* DEBUG */
static void
KdQueueEvent (DeviceIntPtr pDev, xEvent *ev)
diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index 03c2c3a3f..e6cc38a7c 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -16,20 +16,16 @@ if MFB
MFB_SUBDIR = xf1bpp xf4bpp
endif
-if CFB
-CFB_SUBDIR = xf8_32bpp
-endif
-
DOC_SUBDIR = doc
SUBDIRS = common ddc dummylib i2c x86emu int10 fbdevhw os-support parser rac \
- ramdac shadowfb vbe vgahw xaa $(MFB_SUBDIR) $(CFB_SUBDIR) \
+ ramdac shadowfb vbe vgahw xaa $(MFB_SUBDIR) \
xf8_16bpp loader dixmods exa modes \
$(DRI_SUBDIR) $(DRI2_SUBDIR) $(XF86UTILS_SUBDIR) $(DOC_SUBDIR)
DIST_SUBDIRS = common ddc dummylib i2c x86emu int10 fbdevhw os-support \
parser rac ramdac shadowfb vbe vgahw xaa xf1bpp xf4bpp \
- xf8_16bpp xf8_32bpp loader dixmods dri dri2 exa modes \
+ xf8_16bpp loader dixmods dri dri2 exa modes \
utils doc
bin_PROGRAMS = Xorg
diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index 73ca3d0ac..7b65da844 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -498,7 +498,7 @@ extern unsigned int inb(unsigned long port);
extern unsigned int inw(unsigned long port);
extern unsigned int inl(unsigned long port);
-# elif defined(linux) && defined(__amd64__)
+# elif defined(linux) && (defined(__amd64__) || defined(__x86_64__))
# include <inttypes.h>
diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
index 4b3e10463..065102fb5 100644
--- a/hw/xfree86/common/xf86.h
+++ b/hw/xfree86/common/xf86.h
@@ -71,6 +71,7 @@ extern Bool sbusSlotClaimed;
#endif
extern confDRIRec xf86ConfigDRI;
extern Bool xf86inSuspend;
+extern Bool xf86DRI2Enabled(void);
#define XF86SCRNINFO(p) ((ScrnInfoPtr)dixLookupPrivate(&(p)->devPrivates, \
xf86ScreenKey))
diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c
index 3210e4460..5ffd84702 100644
--- a/hw/xfree86/common/xf86AutoConfig.c
+++ b/hw/xfree86/common/xf86AutoConfig.c
@@ -146,7 +146,11 @@ videoPtrToDriverName(struct pci_device *dev)
switch (dev->vendor_id)
{
- case 0x1022: return "amd";
+ case 0x1022:
+ if (dev->device_id == 0x2081)
+ return "geode";
+ else
+ return NULL;
case 0x1142: return "apm";
case 0xedd8: return "ark";
case 0x1a03: return "ast";
@@ -449,7 +453,7 @@ chooseVideoDriver(void)
if (info != NULL)
chosen_driver = videoPtrToDriverName(info);
if (chosen_driver == NULL) {
-#if defined __i386__ || defined __amd64__ || defined __hurd__
+#if defined __i386__ || defined __amd64__ || defined __x86_64__ || defined __hurd__
chosen_driver = "vesa";
#elif defined __sparc__
chosen_driver = "sunffb";
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 9dcaa1930..b6e1186a6 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -766,6 +766,7 @@ typedef enum {
FLAG_AUTO_ADD_DEVICES,
FLAG_AUTO_ENABLE_DEVICES,
FLAG_GLX_VISUALS,
+ FLAG_DRI2,
} FlagValues;
static OptionInfoRec FlagOptions[] = {
@@ -837,16 +838,18 @@ static OptionInfoRec FlagOptions[] = {
{0}, FALSE },
{ FLAG_ALLOW_EMPTY_INPUT, "AllowEmptyInput", OPTV_BOOLEAN,
{0}, FALSE },
- { FLAG_IGNORE_ABI, "IgnoreABI", OPTV_BOOLEAN,
+ { FLAG_IGNORE_ABI, "IgnoreABI", OPTV_BOOLEAN,
{0}, FALSE },
- { FLAG_USE_DEFAULT_FONT_PATH, "UseDefaultFontPath", OPTV_BOOLEAN,
+ { FLAG_USE_DEFAULT_FONT_PATH, "UseDefaultFontPath", OPTV_BOOLEAN,
{0}, FALSE },
- { FLAG_AUTO_ADD_DEVICES, "AutoAddDevices", OPTV_BOOLEAN,
+ { FLAG_AUTO_ADD_DEVICES, "AutoAddDevices", OPTV_BOOLEAN,
{0}, TRUE },
- { FLAG_AUTO_ENABLE_DEVICES, "AutoEnableDevices", OPTV_BOOLEAN,
+ { FLAG_AUTO_ENABLE_DEVICES, "AutoEnableDevices", OPTV_BOOLEAN,
{0}, TRUE },
{ FLAG_GLX_VISUALS, "GlxVisuals", OPTV_STRING,
{0}, FALSE },
+ { FLAG_DRI2, "DRI2", OPTV_BOOLEAN,
+ {0}, FALSE },
{ -1, NULL, OPTV_NONE,
{0}, FALSE },
};
@@ -1179,9 +1182,23 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
xf86Msg(from, "Xinerama: enabled\n");
#endif
+#ifdef DRI2
+ xf86Info.dri2 = FALSE;
+ xf86Info.dri2From = X_DEFAULT;
+ if (xf86GetOptValBool(FlagOptions, FLAG_DRI2, &value)) {
+ xf86Info.dri2 = value;
+ xf86Info.dri2From = X_CONFIG;
+ }
+#endif
+
return TRUE;
}
+Bool xf86DRI2Enabled(void)
+{
+ return xf86Info.dri2;
+}
+
/*
* Locate the core input devices. These can be specified/located in
* the following ways, in order of priority:
@@ -1338,8 +1355,8 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
/* 5. Built-in default. */
if (!foundPointer) {
bzero(&defPtr, sizeof(defPtr));
- defPtr.inp_identifier = "<default pointer>";
- defPtr.inp_driver = "mouse";
+ defPtr.inp_identifier = strdup("<default pointer>");
+ defPtr.inp_driver = strdup("mouse");
confInput = &defPtr;
foundPointer = TRUE;
from = X_DEFAULT;
@@ -1385,8 +1402,8 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
if (!found) {
xf86Msg(X_INFO, "No default mouse found, adding one\n");
bzero(&defPtr, sizeof(defPtr));
- defPtr.inp_identifier = "<default pointer>";
- defPtr.inp_driver = "mouse";
+ defPtr.inp_identifier = strdup("<default pointer>");
+ defPtr.inp_driver = strdup("mouse");
confInput = &defPtr;
foundPointer = configInput(&Pointer, confInput, from);
if (foundPointer) {
@@ -1474,8 +1491,8 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
/* 5. Built-in default. */
if (!foundKeyboard) {
bzero(&defKbd, sizeof(defKbd));
- defKbd.inp_identifier = "<default keyboard>";
- defKbd.inp_driver = "kbd";
+ defKbd.inp_identifier = strdup("<default keyboard>");
+ defKbd.inp_driver = strdup("kbd");
confInput = &defKbd;
foundKeyboard = TRUE;
keyboardMsg = "default keyboard configuration";
diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h
index d97ca440e..8cab56ec8 100644
--- a/hw/xfree86/common/xf86Privstr.h
+++ b/hw/xfree86/common/xf86Privstr.h
@@ -149,6 +149,9 @@ typedef struct {
Bool autoAddDevices; /* Whether to succeed NIDR, or ignore. */
Bool autoEnableDevices; /* Whether to enable, or let the client
* control. */
+
+ Bool dri2;
+ MessageType dri2From;
} xf86InfoRec, *xf86InfoPtr;
#ifdef DPMSExtension
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index c2dd6004b..30e0e6bd7 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -480,11 +480,19 @@ void
DeleteInputDeviceRequest(DeviceIntPtr pDev)
{
LocalDevicePtr pInfo = (LocalDevicePtr) pDev->public.devicePrivate;
- InputDriverPtr drv = pInfo->drv;
- IDevRec *idev = pInfo->conf_idev;
+ InputDriverPtr drv;
+ IDevRec *idev;
+ if (pInfo) /* need to get these before RemoveDevice */
+ {
+ drv = pInfo->drv;
+ idev = pInfo->conf_idev;
+ }
RemoveDevice(pDev);
+ if (!pInfo) /* VCP and VCK */
+ return;
+
if(drv->UnInit)
drv->UnInit(drv, pInfo, 0);
else
diff --git a/hw/xfree86/dixmods/Makefile.am b/hw/xfree86/dixmods/Makefile.am
index dad2dd36b..67967c52d 100644
--- a/hw/xfree86/dixmods/Makefile.am
+++ b/hw/xfree86/dixmods/Makefile.am
@@ -18,10 +18,6 @@ if AFB
AFBMOD = libafb.la
endif
-if CFB
-CFBMOD = libcfb.la libcfb32.la
-endif
-
if MFB
MFBMOD = libmfb.la
endif
@@ -31,7 +27,6 @@ RECORDMOD = librecord.la
endif
module_LTLIBRARIES = $(AFBMOD) \
- $(CFBMOD) \
libfb.la \
libwfb.la \
$(MFBMOD) \
@@ -61,14 +56,6 @@ libafb_la_LDFLAGS = -avoid-version
libafb_la_LIBADD = $(top_builddir)/afb/libafb.la
libafb_la_SOURCES = afbmodule.c
-libcfb_la_LDFLAGS = -avoid-version
-libcfb_la_LIBADD = $(top_builddir)/cfb/libcfb.la
-libcfb_la_SOURCES = cfbmodule.c
-
-libcfb32_la_LDFLAGS = -avoid-version
-libcfb32_la_LIBADD = $(top_builddir)/cfb32/libcfb32.la
-libcfb32_la_SOURCES = cfb32module.c
-
libdbe_la_LDFLAGS = -avoid-version
libdbe_la_LIBADD = $(top_builddir)/dbe/libdbe.la
libdbe_la_SOURCES = dbemodule.c
diff --git a/hw/xfree86/dixmods/cfb32module.c b/hw/xfree86/dixmods/cfb32module.c
deleted file mode 100644
index 23708e4c2..000000000
--- a/hw/xfree86/dixmods/cfb32module.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Module.h"
-
-static MODULESETUPPROTO(cfb32Setup);
-
-static XF86ModuleVersionInfo VersRec =
-{
- "cfb32",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- 1, 0, 0,
- ABI_CLASS_ANSIC, /* Only need the ansic layer */
- ABI_ANSIC_VERSION,
- MOD_CLASS_NONE,
- {0,0,0,0} /* signature, to be patched into the file by a tool */
-};
-
-_X_EXPORT XF86ModuleData cfb32ModuleData = { &VersRec, cfb32Setup, NULL };
-
-static pointer
-cfb32Setup(pointer module, pointer opts, int *errmaj, int *errmin)
-{
- /* This modules requires cfb, so load it */
- return LoadSubModule(module, "cfb", NULL, NULL, NULL, NULL,
- errmaj, errmin);
-}
diff --git a/hw/xfree86/dixmods/cfbmodule.c b/hw/xfree86/dixmods/cfbmodule.c
deleted file mode 100644
index 07074c158..000000000
--- a/hw/xfree86/dixmods/cfbmodule.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Module.h"
-
-static MODULESETUPPROTO(cfbSetup);
-
-static XF86ModuleVersionInfo VersRec =
-{
- "cfb",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- 1, 0, 0,
- ABI_CLASS_ANSIC, /* Only need the ansic layer */
- ABI_ANSIC_VERSION,
- MOD_CLASS_NONE,
- {0,0,0,0} /* signature, to be patched into the file by a tool */
-};
-
-_X_EXPORT XF86ModuleData cfbModuleData = { &VersRec, cfbSetup, NULL };
-
-static pointer
-cfbSetup(pointer module, pointer opts, int *errmaj, int *errmin)
-{
- /* This modules requires mfb, so load it */
- return LoadSubModule(module, "mfb", NULL, NULL, NULL, NULL,
- errmaj, errmin);
-}
diff --git a/hw/xfree86/dixmods/extmod/Makefile.am b/hw/xfree86/dixmods/extmod/Makefile.am
index f90e144ea..77af62da4 100644
--- a/hw/xfree86/dixmods/extmod/Makefile.am
+++ b/hw/xfree86/dixmods/extmod/Makefile.am
@@ -23,7 +23,6 @@ AM_CFLAGS = @DIX_CFLAGS@ @XORG_CFLAGS@
INCLUDES = @XORG_INCS@ \
-I$(top_srcdir)/afb \
-I$(top_srcdir)/mfb \
- -I$(top_srcdir)/cfb \
-I$(top_srcdir)/dbe \
-I$(top_srcdir)/hw/xfree86/loader \
-I$(top_srcdir)/miext/shadow
diff --git a/hw/xfree86/dixmods/extmod/modinit.c b/hw/xfree86/dixmods/extmod/modinit.c
index 8c8a4ceeb..f8440f127 100644
--- a/hw/xfree86/dixmods/extmod/modinit.c
+++ b/hw/xfree86/dixmods/extmod/modinit.c
@@ -65,15 +65,6 @@ static ExtensionModule extensionModules[] = {
NULL
},
#endif
-#ifdef MITMISC
- {
- MITMiscExtensionInit,
- MITMISCNAME,
- &noMITMiscExtension,
- NULL,
- NULL
- },
-#endif
#ifdef notyet
{
XTestExtensionInit,
@@ -164,24 +155,6 @@ static ExtensionModule extensionModules[] = {
NULL
},
#endif
-#ifdef TOGCUP
- {
- XcupExtensionInit,
- XCUPNAME,
- &noXcupExtension,
- NULL,
- NULL
- },
-#endif
-#ifdef EVI
- {
- EVIExtensionInit,
- EVINAME,
- &noEVIExtension,
- NULL,
- NULL
- },
-#endif
#ifdef XV
{
XvExtensionInit,
diff --git a/hw/xfree86/dixmods/extmod/modinit.h b/hw/xfree86/dixmods/extmod/modinit.h
index 3c2e2022a..7282e6e06 100644
--- a/hw/xfree86/dixmods/extmod/modinit.h
+++ b/hw/xfree86/dixmods/extmod/modinit.h
@@ -18,12 +18,6 @@ extern void MultibufferExtensionInit(INITARGS);
#include <X11/extensions/multibufst.h>
#endif
-#ifdef MITMISC
-extern void MITMiscExtensionInit(INITARGS);
-#define _MITMISC_SERVER_
-#include <X11/extensions/mitmiscstr.h>
-#endif
-
#ifdef XTEST
extern void XTestExtensionInit(INITARGS);
#define _XTEST_SERVER_
@@ -89,18 +83,6 @@ extern void FontCacheExtensionInit(INITARGS);
#include "fontcachstr.h"
#endif
-#ifdef TOGCUP
-extern void XcupExtensionInit(INITARGS);
-#define _XCUP_SERVER_
-#include <X11/extensions/Xcupstr.h>
-#endif
-
-#ifdef EVI
-extern void EVIExtensionInit(INITARGS);
-#define _XEVI_SERVER_
-#include <X11/extensions/XEVIstr.h>
-#endif
-
#ifdef XV
extern void XvExtensionInit(INITARGS);
extern void XvMCExtensionInit(INITARGS);
@@ -135,14 +117,6 @@ extern void SecurityExtensionInit(INITARGS);
#endif
#if 1
-extern void XagExtensionInit(INITARGS);
-#endif
-
-#if 1
-extern void XpExtensionInit(INITARGS);
-#endif
-
-#if 1
extern void PanoramiXExtensionInit(int argc, char *argv[]);
#endif
diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man.pre
index 9f3980879..8b66f89a6 100644
--- a/hw/xfree86/doc/man/xorg.conf.man.pre
+++ b/hw/xfree86/doc/man/xorg.conf.man.pre
@@ -54,7 +54,7 @@ is the relative path (with no \(lq..\(rq components) specified by that
environment variable, and
.I <hostname>
is the machine's hostname as reported by
-.BR gethostname (__oslibmansuffix__).
+.BR gethostname (__libmansuffix__).
.PP
When the __xservername__ server is started by the \(lqroot\(rq user, the config file
search locations are as follows:
@@ -93,7 +93,7 @@ is the path specified by that environment variable (usually the home
directory), and
.I <hostname>
is the machine's hostname as reported by
-.BR gethostname (__oslibmansuffix__).
+.BR gethostname (__libmansuffix__).
.PP
The
.I __xconfigfile__
@@ -1624,8 +1624,8 @@ Others are driver\-independent, and will eventually be described here.
.\" XXX These should really be in an xaa man page.
.TP 7
.BI "Option \*qAccel\*q"
-Enables XAA (X Acceleration Architecture), a mechanism that makes video
-cards' 2D hardware acceleration available to the __xservername__ server.
+Enables XAA (X Acceleration Architecture), a mechanism that makes video cards'
+2D hardware acceleration available to the __xservername__ server.
This option is on by default, but it may be necessary to turn it off if
there are bugs in the driver.
There are many options to disable specific accelerated operations, listed
diff --git a/hw/xfree86/loader/dixsym.c b/hw/xfree86/loader/dixsym.c
index d6d22c4b9..61dec59c4 100644
--- a/hw/xfree86/loader/dixsym.c
+++ b/hw/xfree86/loader/dixsym.c
@@ -358,9 +358,6 @@ _X_HIDDEN void *dixLookupTab[] = {
#ifdef DPMSExtension
SYMVAR(noDPMSExtension)
#endif
-#ifdef EVI
- SYMVAR(noEVIExtension)
-#endif
#ifdef FONTCACHE
SYMVAR(noFontCacheExtension)
#endif
@@ -373,9 +370,6 @@ _X_HIDDEN void *dixLookupTab[] = {
#ifdef MITSHM
SYMVAR(noMITShmExtension)
#endif
-#ifdef MITMISC
- SYMVAR(noMITMiscExtension)
-#endif
#ifdef MULTIBUFFER
SYMVAR(noMultibufferExtension)
#endif
@@ -394,15 +388,9 @@ _X_HIDDEN void *dixLookupTab[] = {
#ifdef XSYNC
SYMVAR(noSyncExtension)
#endif
-#ifdef TOGCUP
- SYMVAR(noXcupExtension)
-#endif
#ifdef RES
SYMVAR(noResExtension)
#endif
-#ifdef XAPPGROUP
- SYMVAR(noXagExtension)
-#endif
#ifdef XCMISC
SYMVAR(noXCMiscExtension)
#endif
diff --git a/hw/xfree86/loader/loader.c b/hw/xfree86/loader/loader.c
index 774a4c4a0..a00269b70 100644
--- a/hw/xfree86/loader/loader.c
+++ b/hw/xfree86/loader/loader.c
@@ -63,7 +63,7 @@
#include <string.h>
#if defined(linux) && \
(defined(__alpha__) || defined(__powerpc__) || defined(__ia64__) \
- || defined(__amd64__))
+ || defined(__amd64__) || defined(__x86_64__))
#include <malloc.h>
#endif
#include <stdarg.h>
diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c
index 8f7d45dd6..09d00393e 100644
--- a/hw/xfree86/modes/xf86EdidModes.c
+++ b/hw/xfree86/modes/xf86EdidModes.c
@@ -93,6 +93,12 @@ static Bool quirk_prefer_large_60 (int scrnIndex, xf86MonPtr DDC)
DDC->vendor.prod_id == 638)
return TRUE;
+ /* Acer F51 */
+ if (memcmp (DDC->vendor.name, "API", 4) == 0 &&
+ DDC->vendor.prod_id == 0x7602)
+ return TRUE;
+
+
return FALSE;
}
diff --git a/hw/xfree86/os-support/bsd/Makefile.am b/hw/xfree86/os-support/bsd/Makefile.am
index 4fc270aa9..678903056 100644
--- a/hw/xfree86/os-support/bsd/Makefile.am
+++ b/hw/xfree86/os-support/bsd/Makefile.am
@@ -72,7 +72,6 @@ libbsd_la_SOURCES = \
# FIXME: Add these files to the build as needed
EXTRA_DIST = \
bsd_apm.c \
- bsd_jstk.c \
bsd_kqueue_apm.c \
bsdResource.c \
memrange.h \
diff --git a/hw/xfree86/os-support/bsd/bsdResource.c b/hw/xfree86/os-support/bsd/bsdResource.c
index fe166c845..d1ee787f1 100644
--- a/hw/xfree86/os-support/bsd/bsdResource.c
+++ b/hw/xfree86/os-support/bsd/bsdResource.c
@@ -19,7 +19,7 @@
#ifdef INCLUDE_XF86_NO_DOMAIN
-#if defined(__alpha__) || defined(__sparc64__) || defined(__amd64__)
+#if defined(__alpha__) || defined(__sparc64__) || defined(__amd64__) || defined(__x86_64__)
resPtr
xf86AccResFromOS(resPtr ret)
diff --git a/hw/xfree86/os-support/bsd/bsd_jstk.c b/hw/xfree86/os-support/bsd/bsd_jstk.c
deleted file mode 100644
index b5b91b0c7..000000000
--- a/hw/xfree86/os-support/bsd/bsd_jstk.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright 1995 by Frederic Lepied, France. <fred@sugix.frmug.fr.net>
- *
- * 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, and that the name of Frederic Lepied not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Frederic Lepied makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL FREDERIC LEPIED BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- */
-
-/* Modified for FreeBSD by David Dawes <dawes@XFree86.org> */
-
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <sys/types.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <machine/joystick.h>
-#include <fcntl.h>
-
-#include "misc.h"
-#include "xf86.h"
-
-#define JS_RETURN sizeof(struct joystick)
-
-/***********************************************************************
- *
- * xf86JoystickOn --
- *
- * open the device and init timeout according to the device value.
- *
- ***********************************************************************
- */
-
-int
-xf86JoystickOn(char * name, int *timeout, int *centerX, int *centerY)
-{
- int status;
- int changed = 0;
- int timeinmicros;
- struct joystick js;
-
-#ifdef DEBUG
- ErrorF("xf86JoystickOn: %s\n", name);
-#endif
-
- if ((status = open(name, O_RDWR | O_NDELAY, 0)) < 0)
- {
- xf86Msg(X_WARNING, "xf86JoystickOn: Cannot open joystick '%s' (%s)\n",
- name, strerror(errno));
- return -1;
- }
-
- if (*timeout <= 0) {
- /* Use the current setting */
- ioctl(status, JOY_GETTIMEOUT, (char *)&timeinmicros);
- *timeout = timeinmicros / 1000;
- if (*timeout == 0)
- *timeout = 1;
- changed = 1;
- }
- /* Maximum allowed timeout in the FreeBSD driver is 10ms */
- if (*timeout > 10) {
- *timeout = 10;
- changed = 1;
- }
-
- if (changed)
- xf86Msg(X_PROBED, "Joystick: timeout value = %d\n", *timeout);
-
- timeinmicros = *timeout * 1000;
-
- /* Assume the joystick is centred when this is called */
- read(status, &js, JS_RETURN);
- if (*centerX < 0) {
- *centerX = js.x;
- xf86Msg(X_PROBED, "Joystick: CenterX set to %d\n", *centerX);
- }
- if (*centerY < 0) {
- *centerY = js.y;
- xf86Msg(X_PROBED, "Joystick: CenterY set to %d\n", *centerY);
- }
-
- return status;
-}
-
-/***********************************************************************
- *
- * xf86JoystickInit --
- *
- * called when X device is initialized.
- *
- ***********************************************************************
- */
-
-void
-xf86JoystickInit()
-{
- return;
-}
-
-/***********************************************************************
- *
- * xf86JoystickOff --
- *
- * close the handle.
- *
- ***********************************************************************
- */
-
-int
-xf86JoystickOff(int *fd, int doclose)
-{
- int oldfd;
-
- if (((oldfd = *fd) >= 0) && doclose) {
- close(*fd);
- *fd = -1;
- }
- return oldfd;
-}
-
-/***********************************************************************
- *
- * xf86JoystickGetState --
- *
- * return the state of buttons and the position of the joystick.
- *
- ***********************************************************************
- */
-
-int
-xf86JoystickGetState(int fd, int *x, int *y, int *buttons)
-{
- struct joystick js;
- int status;
-
- status = read(fd, &js, JS_RETURN);
-
- if (status != JS_RETURN)
- {
- Error("Joystick read");
- return 0;
- }
-
- *x = js.x;
- *y = js.y;
- *buttons = js.b1 | (js.b2 << 1);
-#ifdef DEBUG
- ErrorF("xf86JoystickGetState: x = %d, y = %d, buttons = %d\n", *x, *y,
- *buttons);
-#endif
-
- return 1;
-}
-
-/*
- * Entry point for XFree86 Loader
- */
-void
-bsd_jstkModuleInit(pointer *data, INT32 *magic)
-{
- *magic = MAGIC_DONE;
- *data = NULL;
-}
-/* end of bsd_jstk.c */
diff --git a/hw/xfree86/os-support/bsd/i386_video.c b/hw/xfree86/os-support/bsd/i386_video.c
index 1ebac678d..e2f6420d8 100644
--- a/hw/xfree86/os-support/bsd/i386_video.c
+++ b/hw/xfree86/os-support/bsd/i386_video.c
@@ -55,7 +55,7 @@
#endif
#endif
-#if defined(__OpenBSD__) && defined(__amd64__)
+#if defined(__OpenBSD__) && (defined(__amd64__) || defined(__x86_64__))
#include <machine/mtrr.h>
#include <machine/sysarch.h>
#endif
@@ -108,7 +108,7 @@ static pointer NetBSDsetWC(int, unsigned long, unsigned long, Bool,
MessageType);
static void NetBSDundoWC(int, pointer);
#endif
-#if defined(__amd64__) && defined(__OpenBSD__)
+#if (defined(__amd64__) || defined(__x86_64__)) && defined(__OpenBSD__)
static pointer amd64setWC(int, unsigned long, unsigned long, Bool,
MessageType);
static void amd64undoWC(int, pointer);
@@ -229,7 +229,7 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem)
pVidMem->setWC = NetBSDsetWC;
pVidMem->undoWC = NetBSDundoWC;
#endif
-#if defined(__amd64__) && defined(__OpenBSD__)
+#if (defined(__amd64__) || defined(__x86_64__)) && defined(__OpenBSD__)
pVidMem->setWC = amd64setWC;
pVidMem->undoWC = amd64undoWC;
#endif
@@ -953,7 +953,7 @@ NetBSDundoWC(int screenNum, pointer list)
}
#endif
-#if defined(__OpenBSD__) && defined(__amd64__)
+#if defined(__OpenBSD__) && (defined(__amd64__) || defined(__x86_64__))
static pointer
amd64setWC(int screenNum, unsigned long base, unsigned long size, Bool enable,
MessageType from)
diff --git a/hw/xfree86/os-support/bus/Pci.h b/hw/xfree86/os-support/bus/Pci.h
index ebac0905b..b78d30720 100644
--- a/hw/xfree86/os-support/bus/Pci.h
+++ b/hw/xfree86/os-support/bus/Pci.h
@@ -246,7 +246,7 @@
# if !defined(__FreeBSD__) && !defined(linux)
# define ARCH_PCI_PCI_BRIDGE sparcPciPciBridge
# endif
-#elif defined(__amd64__) || defined(__amd64)
+#elif defined(__amd64__) || defined(__amd64) || defined(__x86_64__)
# if defined(linux)
# define ARCH_PCI_INIT linuxPciInit
# else
diff --git a/hw/xfree86/os-support/linux/Makefile.am b/hw/xfree86/os-support/linux/Makefile.am
index beaae3d5b..93f09c10c 100644
--- a/hw/xfree86/os-support/linux/Makefile.am
+++ b/hw/xfree86/os-support/linux/Makefile.am
@@ -45,7 +45,6 @@ INCLUDES = $(XORG_INCS) $(PLATFORM_INCLUDES) -I/usr/include/drm # FIXME this las
# FIXME: These need to be added to the build
LNX_EXTRA_SRCS = \
lnx_font.c \
- lnx_jstk.c \
lnxResource.c
EXTRA_DIST = \
diff --git a/hw/xfree86/os-support/linux/lnx_jstk.c b/hw/xfree86/os-support/linux/lnx_jstk.c
deleted file mode 100644
index d77631ba4..000000000
--- a/hw/xfree86/os-support/linux/lnx_jstk.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Copyright 1995 by Frederic Lepied, France. <fred@sugix.frmug.fr.net>
- *
- * 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, and that the name of Frederic Lepied not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Frederic Lepied makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL FREDERIC LEPIED BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- */
-
-
-static const char rcs_id[] = "Id: lnx_jstk.c,v 1.1 1995/12/20 14:06:09 lepied Exp";
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <sys/types.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#define inline __inline__
-#include <linux/joystick.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-
-#include "xf86.h"
-
-#if !defined(JSIOCGTIMELIMIT)
-/* make 2.1.x joystick.h backward compatable */
-#define JSIOCGTIMELIMIT JS_GET_TIMELIMIT
-#define JSIOCSTIMELIMIT JS_SET_TIMELIMIT
-#define js_status JS_DATA_TYPE
-#endif
-
-
-/***********************************************************************
- *
- * xf86JoystickOn --
- *
- * open the device and init timeout according to the device value.
- *
- ***********************************************************************
- */
-
-int
-xf86JoystickOn(char *name, int *timeout, int *centerX, int *centerY)
-{
- int fd;
- struct js_status js;
-
-#ifdef DEBUG
- ErrorF("xf86JoystickOn %s\n", name);
-#endif
-
- if ((fd = open(name, O_RDWR | O_NDELAY, 0)) < 0)
- {
- xf86Msg(X_WARNING, "Cannot open joystick '%s' (%s)\n", name,
- strerror(errno));
- return -1;
- }
-
- if (*timeout == 0) {
- if (ioctl (fd, JSIOCGTIMELIMIT, timeout) == -1) {
- Error("joystick JSIOCGTIMELIMIT ioctl");
- }
- else {
- xf86Msg(X_CONFIG, "Joystick: timeout value = %d\n", *timeout);
- }
- }
- else {
- if (ioctl(fd, JSIOCSTIMELIMIT, timeout) == -1) {
- Error("joystick JSIOCSTIMELIMIT ioctl");
- }
- }
-
- /* Assume the joystick is centred when this is called */
- read(fd, &js, JS_RETURN);
- if (*centerX < 0) {
- *centerX = js.x;
- xf86Msg(X_CONFIG, "Joystick: CenterX set to %d\n", *centerX);
- }
- if (*centerY < 0) {
- *centerY = js.y;
- xf86Msg(X_CONFIG, "Joystick: CenterY set to %d\n", *centerY);
- }
-
- return fd;
-}
-
-/***********************************************************************
- *
- * xf86JoystickInit --
- *
- * called when X device is initialized.
- *
- ***********************************************************************
- */
-
-void
-xf86JoystickInit()
-{
- return;
-}
-
-/***********************************************************************
- *
- * xf86JoystickOff --
- *
- * close the handle.
- *
- ***********************************************************************
- */
-
-int
-xf86JoystickOff(int *fd, int doclose)
-{
- int oldfd;
-
- if (((oldfd = *fd) >= 0) && doclose) {
- close(*fd);
- *fd = -1;
- }
- return oldfd;
-}
-
-/***********************************************************************
- *
- * xf86JoystickGetState --
- *
- * return the state of buttons and the position of the joystick.
- *
- ***********************************************************************
- */
-
-int
-xf86JoystickGetState(int fd, int *x, int *y, int *buttons)
-{
- struct js_status js;
- int status;
-
- status = read(fd, &js, JS_RETURN);
-
- if (status != JS_RETURN)
- {
- Error("Joystick read");
- return 0;
- }
-
- *x = js.x;
- *y = js.y;
- *buttons = js.buttons;
-
- return 1;
-}
-
-/*
- * Entry point for XFree86 Loader
- */
-void
-linux_jstkModuleInit(pointer *data, INT32 *magic)
-{
- *magic = MAGIC_DONE;
- *data = NULL;
-}
-
-/* end of lnx_jstk.c */
diff --git a/hw/xfree86/utils/xorgcfg/loadmod.c b/hw/xfree86/utils/xorgcfg/loadmod.c
index 1207820ce..629dfe118 100644
--- a/hw/xfree86/utils/xorgcfg/loadmod.c
+++ b/hw/xfree86/utils/xorgcfg/loadmod.c
@@ -179,7 +179,9 @@ LOOKUP xfree86LookupTab[] = {
SYMFUNC(xf86memchr)
SYMFUNC(xf86memcmp)
SYMFUNC(xf86memcpy)
-#if (defined(__powerpc__) && (defined(Lynx) || defined(linux))) || defined(__sparc__) || defined(__sparc) || defined(__ia64__) || defined (__amd64__)
+#if (defined(__powerpc__) && (defined(Lynx) || defined(linux))) || \
+ defined(__sparc__) || defined(__sparc) || defined(__ia64__) || \
+ defined (__amd64__) || defined(__x86_64__)
/*
* Some PPC, SPARC, and IA64 compilers generate calls to memcpy to handle
* structure copies. This causes a problem both here and in shared
diff --git a/hw/xfree86/x86emu/prim_ops.c b/hw/xfree86/x86emu/prim_ops.c
index b42cdc0a5..41968e1a7 100644
--- a/hw/xfree86/x86emu/prim_ops.c
+++ b/hw/xfree86/x86emu/prim_ops.c
@@ -103,7 +103,7 @@
#include "x86emu/x86emui.h"
#if defined(__GNUC__)
-# if defined (__i386__) || defined(__i386) || defined(__AMD64__) || defined(__x86_64__) || defined(__amd64__)
+# if defined (__i386__) || defined(__i386) || defined(__AMD64__) || defined(__x86_64__) || defined(__amd64__) || defined(__x86_64__)
# include "x86emu/prim_x86_gcc.h"
# endif
#endif
diff --git a/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h b/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h
index af61e2023..5a443cdbf 100644
--- a/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h
+++ b/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h
@@ -42,7 +42,7 @@
#include "x86emu/types.h"
-#if !defined(__GNUC__) || !(defined (__i386__) || defined(__i386) || defined(__AMD64__) || defined(__x86_64__) || defined(__amd64__))
+#if !defined(__GNUC__) || !(defined (__i386__) || defined(__i386) || defined(__AMD64__) || defined(__x86_64__) || defined(__amd64__) || defined(__x86_64__))
#error This file is intended to be used by gcc on i386 or x86-64 system
#endif
diff --git a/hw/xfree86/x86emu/x86emu/types.h b/hw/xfree86/x86emu/x86emu/types.h
index c0c09c1b0..2d41b0f18 100644
--- a/hw/xfree86/x86emu/x86emu/types.h
+++ b/hw/xfree86/x86emu/x86emu/types.h
@@ -75,7 +75,7 @@
defined(__sparc64__) || \
defined(__s390x__) || \
(defined(__hppa__) && defined(__LP64)) || \
- defined(__amd64__) || defined(amd64) || \
+ defined(__amd64__) || defined(amd64) || defined(__x86_64__) || \
(defined(__sgi) && (_MIPS_SZLONG == 64))
#define NUM32 int
#else
diff --git a/hw/xfree86/xf8_32bpp/Makefile.am b/hw/xfree86/xf8_32bpp/Makefile.am
deleted file mode 100644
index 6f51a628e..000000000
--- a/hw/xfree86/xf8_32bpp/Makefile.am
+++ /dev/null
@@ -1,37 +0,0 @@
-module_LTLIBRARIES = libxf8_32bpp.la
-
-sdk_HEADERS = cfb8_32.h
-
-INCLUDES = $(XORG_INCS) -I$(top_srcdir)/mfb -I$(top_srcdir)/cfb
-
-AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
-
-libxf8_32bpp_la_LDFLAGS = -avoid-version
-
-libxf8_32bpp_la_SOURCES = \
- cfbcpyarea.c \
- cfbcpyplane.c \
- cfbgcmisc.c \
- cfbimage.c \
- cfbpntwin.c \
- cfbscrinit.c \
- cfbwindow.c \
- xf86overlay.c \
- cfb8_32module.c \
- cfbgc8.c \
- cfbgc32.c \
- cfbgcunder.c
-
-libxf8_32bpp_la_LIBADD = $(top_builddir)/cfb32/libcfb32.la
-
-EXTRA_DIST = cfbgc.c
-
-cfbgc8.c: $(srcdir)/cfbgc.c
- echo '#define PSZ 8' > $@
- echo '#include "$(srcdir)/cfbgc.c"' >> $@
-
-cfbgc32.c: $(srcdir)/cfbgc.c
- echo '#define PSZ 32' > $@
- echo '#include "$(srcdir)/cfbgc.c"' >> $@
-
-DISTCLEANFILES = cfbgc8.c cfbgc32.c
diff --git a/hw/xfree86/xf8_32bpp/cfb8_32.h b/hw/xfree86/xf8_32bpp/cfb8_32.h
deleted file mode 100644
index 6e985da20..000000000
--- a/hw/xfree86/xf8_32bpp/cfb8_32.h
+++ /dev/null
@@ -1,191 +0,0 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#ifndef _CFB8_32_H
-#define _CFB8_32_H
-
-#include "gcstruct.h"
-
-typedef struct {
- GCOps *Ops8bpp;
- GCOps *Ops32bpp;
- unsigned long changes;
- Bool OpsAre8bpp;
-} cfb8_32GCRec, *cfb8_32GCPtr;
-
-typedef struct {
- unsigned char key;
- void (*EnableDisableFBAccess)(int scrnIndex, Bool enable);
- pointer visualData;
-} cfb8_32ScreenRec, *cfb8_32ScreenPtr;
-
-
-extern DevPrivateKey cfb8_32GetGCPrivateKey(void);
-extern DevPrivateKey cfb8_32GetScreenPrivateKey(void);
-
-RegionPtr
-cfb8_32CopyArea(
- DrawablePtr pSrcDraw,
- DrawablePtr pDstDraw,
- GC *pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty
-);
-
-void
-cfbDoBitblt8To32(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- int rop,
- RegionPtr prgnDst,
- DDXPointPtr pptSrc,
- unsigned long planemask
-);
-
-void
-cfbDoBitblt32To8(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- int rop,
- RegionPtr prgnDst,
- DDXPointPtr pptSrc,
- unsigned long planemask
-);
-
-
-void
-cfb8_32ValidateGC8(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDrawable
-);
-
-void
-cfb8_32ValidateGC32(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDrawable
-);
-
-void
-cfb32ValidateGC_Underlay(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDrawable
-);
-
-Bool cfb8_32CreateGC(GCPtr pGC);
-
-void
-cfb8_32GetSpans(
- DrawablePtr pDraw,
- int wMax,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- char *pchardstStart
-);
-
-void
-cfb8_32PutImage (
- DrawablePtr pDraw,
- GCPtr pGC,
- int depth,
- int x, int y, int w, int h,
- int leftPad,
- int format,
- char *pImage
-);
-
-void
-cfb8_32GetImage (
- DrawablePtr pDraw,
- int sx, int sy, int w, int h,
- unsigned int format,
- unsigned long planeMask,
- char *pdstLine
-);
-
-Bool
-cfb8_32ScreenInit (
- ScreenPtr pScreen,
- pointer pbits,
- int xsize, int ysize,
- int dpix, int dpiy,
- int width
-);
-
-void
-cfb8_32FillBoxSolid8 (
- DrawablePtr pDraw,
- int nbox,
- BoxPtr pBox,
- unsigned long color
-);
-
-RegionPtr
-cfb8_32CopyPlane(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty,
- unsigned long bitPlane
-);
-
-void
-cfbDoBitblt8To8GXcopy(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- int rop,
- RegionPtr prgnDst,
- DDXPointPtr pptSrc,
- unsigned long pm
-);
-
-void
-cfbDoBitblt24To24GXcopy(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- int rop,
- RegionPtr prgnDst,
- DDXPointPtr pptSrc,
- unsigned long pm
-);
-
-Bool cfb8_32CreateWindow(WindowPtr pWin);
-Bool cfb8_32DestroyWindow(WindowPtr pWin);
-
-Bool
-cfb8_32PositionWindow(
- WindowPtr pWin,
- int x, int y
-);
-
-void
-cfb8_32CopyWindow(
- WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc
-);
-
-Bool
-cfb8_32ChangeWindowAttributes(
- WindowPtr pWin,
- unsigned long mask
-);
-
-
-#define CFB8_32_GET_GC_PRIVATE(pGC) ((cfb8_32GCPtr) \
- dixLookupPrivate(&(pGC)->devPrivates, cfb8_32GetGCPrivateKey()))
-
-#define CFB8_32_GET_SCREEN_PRIVATE(pScreen) ((cfb8_32ScreenPtr) \
- dixLookupPrivate(&(pScreen)->devPrivates, cfb8_32GetScreenPrivateKey()))
-
-Bool xf86Overlay8Plus32Init (ScreenPtr pScreen);
-
-#endif /* _CFB8_32_H */
diff --git a/hw/xfree86/xf8_32bpp/cfb8_32module.c b/hw/xfree86/xf8_32bpp/cfb8_32module.c
deleted file mode 100644
index 5afabe52d..000000000
--- a/hw/xfree86/xf8_32bpp/cfb8_32module.c
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Module.h"
-
-static MODULESETUPPROTO(xf8_32bppSetup);
-
-static XF86ModuleVersionInfo VersRec =
-{
- "xf8_32bpp",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- 1, 0, 0,
- ABI_CLASS_ANSIC, /* Only need the ansic layer */
- ABI_ANSIC_VERSION,
- MOD_CLASS_NONE,
- {0,0,0,0} /* signature, to be patched into the file by a tool */
-};
-
-_X_EXPORT XF86ModuleData xf8_32bppModuleData = {
- &VersRec,
- xf8_32bppSetup,
- NULL
-};
-
-static pointer
-xf8_32bppSetup(pointer module, pointer opts, int *errmaj, int *errmin)
-{
- if (!LoadSubModule(module, "cfb", NULL, NULL, NULL, NULL,
- errmaj, errmin))
- return NULL;
- if (!LoadSubModule(module, "cfb32", NULL, NULL, NULL, NULL,
- errmaj, errmin))
- return NULL;
- return (pointer)1; /* non-NULL required to indicate success */
-}
diff --git a/hw/xfree86/xf8_32bpp/cfbcpyarea.c b/hw/xfree86/xf8_32bpp/cfbcpyarea.c
deleted file mode 100644
index d8f0c6d76..000000000
--- a/hw/xfree86/xf8_32bpp/cfbcpyarea.c
+++ /dev/null
@@ -1,549 +0,0 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include "servermd.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "resource.h"
-#include "colormap.h"
-#include "colormapst.h"
-#define PSZ 8
-#include "cfb.h"
-#undef PSZ
-#include "cfb32.h"
-#include "cfb8_32.h"
-#include "mi.h"
-#include "mistruct.h"
-#include "dix.h"
-#include "mibstore.h"
-
-
-RegionPtr
-cfb8_32CopyArea(
- DrawablePtr pSrcDraw,
- DrawablePtr pDstDraw,
- GC *pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty
-){
-
- if(pSrcDraw->bitsPerPixel == 32) {
- if(pDstDraw->bitsPerPixel == 32) {
- if((pGC->alu == GXcopy) && (pGC->planemask == 0xff000000)) {
- return cfb32BitBlt (pSrcDraw, pDstDraw,
- pGC, srcx, srcy, width, height, dstx, dsty,
- cfbDoBitblt8To8GXcopy, 0L);
- }
- return(cfb32CopyArea(pSrcDraw, pDstDraw, pGC, srcx, srcy,
- width, height, dstx, dsty));
- } else {
- /* have to translate 32 -> 8 copies */
- return cfb32BitBlt (pSrcDraw, pDstDraw,
- pGC, srcx, srcy, width, height, dstx, dsty,
- cfbDoBitblt32To8, 0L);
- }
- } else {
- if(pDstDraw->bitsPerPixel == 32) {
- /* have to translate 8 -> 32 copies */
- return cfb32BitBlt (pSrcDraw, pDstDraw,
- pGC, srcx, srcy, width, height, dstx, dsty,
- cfbDoBitblt8To32, 0L);
- } else {
- return(cfbCopyArea(pSrcDraw, pDstDraw, pGC, srcx, srcy,
- width, height, dstx, dsty));
- }
- }
-}
-
-
-
-
-void
-cfbDoBitblt8To32(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- int rop,
- RegionPtr prgnDst,
- DDXPointPtr pptSrc,
- unsigned long pm
-){
- BoxPtr pbox = REGION_RECTS(prgnDst);
- int nbox = REGION_NUM_RECTS(prgnDst);
- unsigned char *ptr8, *ptr32;
- unsigned char *data8, *data32;
- int pitch8, pitch32;
- int height, width, i;
-
- cfbGetByteWidthAndPointer(pSrc, pitch8, ptr8);
- cfbGetByteWidthAndPointer(pDst, pitch32, ptr32);
- ptr32 += 3; /* point to the top byte */
-
- pm >>= 24;
-
- if((pm == 0xff) && (rop == GXcopy)) {
- for(;nbox; pbox++, pptSrc++, nbox--) {
- data8 = ptr8 + (pptSrc->y * pitch8) + pptSrc->x;
- data32 = ptr32 + (pbox->y1 * pitch32) + (pbox->x1 << 2);
- width = pbox->x2 - pbox->x1;
- height = pbox->y2 - pbox->y1;
-
- while(height--) {
- for(i = 0; i < width; i++)
- data32[i << 2] = data8[i];
- data8 += pitch8;
- data32 += pitch32;
- }
- }
- } else { /* it ain't pretty, but hey */
- for(;nbox; pbox++, pptSrc++, nbox--) {
- data8 = ptr8 + (pptSrc->y * pitch8) + pptSrc->x;
- data32 = ptr32 + (pbox->y1 * pitch32) + (pbox->x1 << 2);
- width = pbox->x2 - pbox->x1;
- height = pbox->y2 - pbox->y1;
-
- while(height--) {
- switch(rop) {
- case GXcopy:
- for(i = 0; i < width; i++)
- data32[i<<2] = (data8[i] & pm) | (data32[i<<2] & ~pm);
- break;
- case GXor:
- for(i = 0; i < width; i++)
- data32[i<<2] |= data8[i] & pm;
- break;
- case GXclear:
- for(i = 0; i < width; i++)
- data32[i<<2] &= ~pm;
- break;
- case GXand:
- for(i = 0; i < width; i++)
- data32[i<<2] &= data8[i] | ~pm;
- break;
- case GXandReverse:
- for(i = 0; i < width; i++)
- data32[i<<2] = ~data32[i<<2] & (data8[i] | ~pm);
- break;
- case GXandInverted:
- for(i = 0; i < width; i++)
- data32[i<<2] &= ~data8[i] | ~pm;
- break;
- case GXnoop:
- return;
- case GXxor:
- for(i = 0; i < width; i++)
- data32[i<<2] ^= data8[i] & pm;
- break;
- case GXnor:
- for(i = 0; i < width; i++)
- data32[i<<2] = ~(data32[i<<2] | (data8[i] & pm));
- break;
- case GXequiv:
- for(i = 0; i < width; i++)
- data32[i<<2] = ~(data32[i<<2] ^ (data8[i] & pm));
- break;
- case GXinvert:
- for(i = 0; i < width; i++)
- data32[i<<2] ^= pm;
- break;
- case GXorReverse:
- for(i = 0; i < width; i++)
- data32[i<<2] = ~data32[i<<2] | (data8[i] & pm);
- break;
- case GXcopyInverted:
- for(i = 0; i < width; i++)
- data32[i<<2] = (~data8[i] & pm) | (data32[i<<2] & ~pm);
- break;
- case GXorInverted:
- for(i = 0; i < width; i++)
- data32[i<<2] |= ~data8[i] & pm;
- break;
- case GXnand:
- for(i = 0; i < width; i++)
- data32[i<<2] = ~(data32[i<<2] & (data8[i] | ~pm));
- break;
- case GXset:
- for(i = 0; i < width; i++)
- data32[i<<2] |= pm;
- break;
- }
- data8 += pitch8;
- data32 += pitch32;
- }
- }
- }
-}
-
-
-void
-cfbDoBitblt32To8(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- int rop,
- RegionPtr prgnDst,
- DDXPointPtr pptSrc,
- unsigned long pm
-){
- BoxPtr pbox = REGION_RECTS(prgnDst);
- int nbox = REGION_NUM_RECTS(prgnDst);
- unsigned char *ptr8, *ptr32;
- unsigned char *data8, *data32;
- int pitch8, pitch32;
- int height, width, i;
-
- cfbGetByteWidthAndPointer(pDst, pitch8, ptr8);
- cfbGetByteWidthAndPointer(pSrc, pitch32, ptr32);
- ptr32 += 3; /* point to the top byte */
-
- if(((pm & 0xff) == 0xff) && (rop == GXcopy)) {
- for(;nbox; pbox++, pptSrc++, nbox--) {
- data8 = ptr8 + (pbox->y1 * pitch8) + pbox->x1;
- data32 = ptr32 + (pptSrc->y * pitch32) + (pptSrc->x << 2);
-
- width = pbox->x2 - pbox->x1;
- height = pbox->y2 - pbox->y1;
-
- while(height--) {
- for(i = 0; i < width; i++)
- data8[i] = data32[i << 2];
- data8 += pitch8;
- data32 += pitch32;
- }
- }
- } else {
- for(;nbox; pbox++, pptSrc++, nbox--) {
- data8 = ptr8 + (pbox->y1 * pitch8) + pbox->x1;
- data32 = ptr32 + (pptSrc->y * pitch32) + (pptSrc->x << 2);
-
- width = pbox->x2 - pbox->x1;
- height = pbox->y2 - pbox->y1;
-
- while(height--) {
- switch(rop) {
- case GXcopy:
- for(i = 0; i < width; i++)
- data8[i] = (data32[i<<2] & pm) | (data8[i] & ~pm);
- break;
- case GXor:
- for(i = 0; i < width; i++)
- data8[i] |= data32[i<<2] & pm;
- break;
- case GXclear:
- for(i = 0; i < width; i++)
- data8[i] &= ~pm;
- break;
- case GXand:
- for(i = 0; i < width; i++)
- data8[i] &= data32[i<<2] | ~pm;
- break;
- case GXandReverse:
- for(i = 0; i < width; i++)
- data8[i] = ~data8[i] & (data32[i<<2] | ~pm);
- break;
- case GXandInverted:
- for(i = 0; i < width; i++)
- data8[i] &= ~data32[i<<2] | ~pm;
- break;
- case GXnoop:
- return;
- case GXxor:
- for(i = 0; i < width; i++)
- data8[i] ^= data32[i<<2] & pm;
- break;
- case GXnor:
- for(i = 0; i < width; i++)
- data8[i] = ~(data8[i] | (data32[i<<2] & pm));
- break;
- case GXequiv:
- for(i = 0; i < width; i++)
- data8[i] = ~(data8[i] ^ (data32[i<<2] & pm));
- break;
- case GXinvert:
- for(i = 0; i < width; i++)
- data8[i] ^= pm;
- break;
- case GXorReverse:
- for(i = 0; i < width; i++)
- data8[i] = ~data8[i] | (data32[i<<2] & pm);
- break;
- case GXcopyInverted:
- for(i = 0; i < width; i++)
- data8[i] = (~data32[i<<2] & pm) | (data8[i] & ~pm);
- break;
- case GXorInverted:
- for(i = 0; i < width; i++)
- data8[i] |= ~data32[i<<2] & pm;
- break;
- case GXnand:
- for(i = 0; i < width; i++)
- data8[i] = ~(data8[i] & (data32[i<<2] | ~pm));
- break;
- case GXset:
- for(i = 0; i < width; i++)
- data8[i] |= pm;
- break;
- }
- data8 += pitch8;
- data32 += pitch32;
- }
- }
- }
-}
-
-
-
-static void
-Do8To8Blt(
- unsigned char *SrcPtr,
- int SrcPitch,
- unsigned char *DstPtr,
- int DstPitch,
- int nbox,
- DDXPointPtr pptSrc,
- BoxPtr pbox,
- int xdir, int ydir
-){
- int i, j, width, height, ydir2;
- CARD8 *src, *dst;
-
- SrcPtr += 3;
- DstPtr += 3;
- xdir *= 4;
- ydir2 = ydir * DstPitch;
- ydir *= SrcPitch;
-
- for(;nbox; pbox++, pptSrc++, nbox--) {
- src = SrcPtr + (pptSrc->y * SrcPitch) + (pptSrc->x << 2);
- dst = DstPtr + (pbox->y1 * DstPitch) + (pbox->x1 << 2);
- width = pbox->x2 - pbox->x1;
- height = pbox->y2 - pbox->y1;
-
- if(ydir < 0) {
- src += (height - 1) * SrcPitch;
- dst += (height - 1) * DstPitch;
- }
-
- if(xdir < 0) {
- register int tmp = (width - 1) << 2;
- src += tmp;
- dst += tmp;
- }
-
- while(height--) {
- for(i = width, j = 0; i--; j+=xdir)
- dst[j] = src[j];
- src += ydir;
- dst += ydir2;
- }
- }
-}
-
-static void
-Do24To24Blt(
- unsigned char *SrcPtr,
- int SrcPitch,
- unsigned char *DstPtr,
- int DstPitch,
- int nbox,
- DDXPointPtr pptSrc,
- BoxPtr pbox,
- int xdir, int ydir
-){
- int i, j, width, height, ydir2;
- CARD8 *src, *dst;
-
- xdir *= 4;
- ydir2 = ydir * DstPitch;
- ydir *= SrcPitch;
-
- for(;nbox; pbox++, pptSrc++, nbox--) {
- src = SrcPtr + (pptSrc->y * SrcPitch) + (pptSrc->x << 2);
- dst = DstPtr + (pbox->y1 * DstPitch) + (pbox->x1 << 2);
- width = pbox->x2 - pbox->x1;
- height = pbox->y2 - pbox->y1;
-
- if(ydir < 0) {
- src += (height - 1) * SrcPitch;
- dst += (height - 1) * DstPitch;
- }
-
- if(xdir < 0) {
- register int tmp = (width - 1) << 2;
- src += tmp;
- dst += tmp;
- }
-
- while(height--) {
- for(i = width, j = 0; i--; j+=xdir) {
- *((CARD16*)(dst + j)) = *((CARD32*)(src + j));
- dst[j + 2] = src[j + 2];
- }
- src += ydir;
- dst += ydir2;
- }
- }
-}
-
-
-static void
-cfb8_32DoBitBlt(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- RegionPtr prgnDst,
- DDXPointPtr pptSrc,
- void (*DoBlt)(
- unsigned char *SrcPtr,
- int SrcPitch,
- unsigned char *DstPtr,
- int DstPitch,
- int nbox,
- DDXPointPtr pptSrc,
- BoxPtr pbox,
- int xdir, int ydir)
-){
- int nbox, careful, SrcPitch, DstPitch;
- BoxPtr pbox, pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2;
- DDXPointPtr pptTmp, pptNew1, pptNew2;
- int xdir, ydir;
- unsigned char *SrcPtr, *DstPtr;
-
- /* XXX we have to err on the side of safety when both are windows,
- * because we don't know if IncludeInferiors is being used.
- */
- careful = ((pSrc == pDst) ||
- ((pSrc->type == DRAWABLE_WINDOW) &&
- (pDst->type == DRAWABLE_WINDOW)));
-
- pbox = REGION_RECTS(prgnDst);
- nbox = REGION_NUM_RECTS(prgnDst);
-
- pboxNew1 = NULL;
- pptNew1 = NULL;
- pboxNew2 = NULL;
- pptNew2 = NULL;
- if (careful && (pptSrc->y < pbox->y1)) {
- /* walk source botttom to top */
- ydir = -1;
-
- if (nbox > 1) {
- /* keep ordering in each band, reverse order of bands */
- pboxNew1 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
- if(!pboxNew1)
- return;
- pptNew1 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
- if(!pptNew1) {
- xfree(pboxNew1);
- return;
- }
- pboxBase = pboxNext = pbox+nbox-1;
- while (pboxBase >= pbox) {
- while ((pboxNext >= pbox) &&
- (pboxBase->y1 == pboxNext->y1))
- pboxNext--;
- pboxTmp = pboxNext+1;
- pptTmp = pptSrc + (pboxTmp - pbox);
- while (pboxTmp <= pboxBase) {
- *pboxNew1++ = *pboxTmp++;
- *pptNew1++ = *pptTmp++;
- }
- pboxBase = pboxNext;
- }
- pboxNew1 -= nbox;
- pbox = pboxNew1;
- pptNew1 -= nbox;
- pptSrc = pptNew1;
- }
- } else {
- /* walk source top to bottom */
- ydir = 1;
- }
-
- if (careful && (pptSrc->x < pbox->x1)) {
- /* walk source right to left */
- xdir = -1;
-
- if (nbox > 1) {
- /* reverse order of rects in each band */
- pboxNew2 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
- pptNew2 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
- if(!pboxNew2 || !pptNew2) {
- if (pptNew2) xfree(pptNew2);
- if (pboxNew2) xfree(pboxNew2);
- if (pboxNew1) {
- xfree(pptNew1);
- xfree(pboxNew1);
- }
- return;
- }
- pboxBase = pboxNext = pbox;
- while (pboxBase < pbox+nbox) {
- while ((pboxNext < pbox+nbox) &&
- (pboxNext->y1 == pboxBase->y1))
- pboxNext++;
- pboxTmp = pboxNext;
- pptTmp = pptSrc + (pboxTmp - pbox);
- while (pboxTmp != pboxBase) {
- *pboxNew2++ = *--pboxTmp;
- *pptNew2++ = *--pptTmp;
- }
- pboxBase = pboxNext;
- }
- pboxNew2 -= nbox;
- pbox = pboxNew2;
- pptNew2 -= nbox;
- pptSrc = pptNew2;
- }
- } else {
- /* walk source left to right */
- xdir = 1;
- }
-
- cfbGetByteWidthAndPointer(pSrc, SrcPitch, SrcPtr);
- cfbGetByteWidthAndPointer(pDst, DstPitch, DstPtr);
-
- (*DoBlt)(SrcPtr,SrcPitch,DstPtr,DstPitch,nbox,pptSrc,pbox,xdir,ydir);
-
- if (pboxNew2) {
- xfree(pptNew2);
- xfree(pboxNew2);
- }
- if (pboxNew1) {
- xfree(pptNew1);
- xfree(pboxNew1);
- }
-
-}
-
-
-/* A couple routines to speed up full planemask copies */
-
-void
-cfbDoBitblt8To8GXcopy(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- int rop,
- RegionPtr prgnDst,
- DDXPointPtr pptSrc,
- unsigned long pm
-){
- cfb8_32DoBitBlt(pSrc, pDst, prgnDst, pptSrc, Do8To8Blt);
-}
-
-
-void
-cfbDoBitblt24To24GXcopy(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- int rop,
- RegionPtr prgnDst,
- DDXPointPtr pptSrc,
- unsigned long pm
-){
- cfb8_32DoBitBlt(pSrc, pDst, prgnDst, pptSrc, Do24To24Blt);
-}
diff --git a/hw/xfree86/xf8_32bpp/cfbcpyplane.c b/hw/xfree86/xf8_32bpp/cfbcpyplane.c
deleted file mode 100644
index e10b52525..000000000
--- a/hw/xfree86/xf8_32bpp/cfbcpyplane.c
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <X11/Xproto.h>
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "regionstr.h"
-#define PSZ 8
-#include "cfb.h"
-#undef PSZ
-#include "cfb32.h"
-#include "cfb8_32.h"
-#include "mi.h"
-
-
-RegionPtr
-cfb8_32CopyPlane(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty,
- unsigned long bitPlane
-){
- /* There's actually much more to it than this */
-
- if((pDst->bitsPerPixel == 8) && (pSrc->bitsPerPixel != 32)){
- return(cfbCopyPlane(pSrc, pDst,
- pGC, srcx, srcy, width, height, dstx, dsty, bitPlane));
- }
-
-
- return(miCopyPlane (pSrc, pDst,
- pGC, srcx, srcy, width, height, dstx, dsty, bitPlane));
-}
diff --git a/hw/xfree86/xf8_32bpp/cfbgc.c b/hw/xfree86/xf8_32bpp/cfbgc.c
deleted file mode 100644
index a7787caa9..000000000
--- a/hw/xfree86/xf8_32bpp/cfbgc.c
+++ /dev/null
@@ -1,646 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 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.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-
-/*
-
-PSZ 8 16 24 32
-PIXEL_ADDR True True True True
-NO_ONE_RECT False False False False
-WriteBitGroup True True True True
-FOUR_BIT_CODE True False False False
-LOWMEMFTPT False False False False
-
-*/
-
-
-/* This gets built twice. Once for 8bpp and another for 32bpp */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <X11/Xproto.h>
-#include "cfb.h"
-#include <X11/fonts/fontstruct.h>
-#include "dixfontstr.h"
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-#include "region.h"
-
-#include "mistruct.h"
-#include "mibstore.h"
-#include "migc.h"
-#include "mioverlay.h"
-
-#include "cfb8_32.h"
-#include "cfbmskbits.h"
-#include "cfb8bit.h"
-
-
-#if PSZ == 8
-# define useTEGlyphBlt cfbTEGlyphBlt8
-#else
-# ifdef WriteBitGroup
-# define useTEGlyphBlt cfbImageGlyphBlt8
-# else
-# define useTEGlyphBlt cfbTEGlyphBlt
-# endif
-#endif
-
-#ifdef WriteBitGroup
-# define useImageGlyphBlt cfbImageGlyphBlt8
-# define usePolyGlyphBlt cfbPolyGlyphBlt8
-#else
-# define useImageGlyphBlt miImageGlyphBlt
-# define usePolyGlyphBlt miPolyGlyphBlt
-#endif
-
-#ifdef FOUR_BIT_CODE
-# define usePushPixels cfbPushPixels8
-#else
-# define usePushPixels mfbPushPixels
-#endif
-
-#ifdef PIXEL_ADDR
-# define ZeroPolyArc cfbZeroPolyArcSS8Copy
-#else
-# define ZeroPolyArc miZeroPolyArc
-#endif
-
-
-static GCOps cfb8_32TEOps1Rect = {
- cfbSolidSpansCopy,
- cfbSetSpans,
- cfb8_32PutImage,
- cfb8_32CopyArea,
- cfb8_32CopyPlane,
- cfbPolyPoint,
-#ifdef PIXEL_ADDR
- cfb8LineSS1Rect,
- cfb8SegmentSS1Rect,
-#else
- cfbLineSS,
- cfbSegmentSS,
-#endif
- miPolyRectangle,
- ZeroPolyArc,
- cfbFillPoly1RectCopy,
- cfbPolyFillRect,
- cfbPolyFillArcSolidCopy,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- useTEGlyphBlt,
- usePolyGlyphBlt,
- usePushPixels
-};
-
-static GCOps cfb8_32NonTEOps1Rect = {
- cfbSolidSpansCopy,
- cfbSetSpans,
- cfb8_32PutImage,
- cfb8_32CopyArea,
- cfb8_32CopyPlane,
- cfbPolyPoint,
-#ifdef PIXEL_ADDR
- cfb8LineSS1Rect,
- cfb8SegmentSS1Rect,
-#else
- cfbLineSS,
- cfbSegmentSS,
-#endif
- miPolyRectangle,
- ZeroPolyArc,
- cfbFillPoly1RectCopy,
- cfbPolyFillRect,
- cfbPolyFillArcSolidCopy,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- useImageGlyphBlt,
- usePolyGlyphBlt,
- usePushPixels
-};
-
-static GCOps cfb8_32TEOps = {
- cfbSolidSpansCopy,
- cfbSetSpans,
- cfb8_32PutImage,
- cfb8_32CopyArea,
- cfb8_32CopyPlane,
- cfbPolyPoint,
- cfbLineSS,
- cfbSegmentSS,
- miPolyRectangle,
- ZeroPolyArc,
- miFillPolygon,
- cfbPolyFillRect,
- cfbPolyFillArcSolidCopy,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- useTEGlyphBlt,
- usePolyGlyphBlt,
- usePushPixels
-};
-
-static GCOps cfb8_32NonTEOps = {
- cfbSolidSpansCopy,
- cfbSetSpans,
- cfb8_32PutImage,
- cfb8_32CopyArea,
- cfb8_32CopyPlane,
- cfbPolyPoint,
- cfbLineSS,
- cfbSegmentSS,
- miPolyRectangle,
-#ifdef PIXEL_ADDR
- cfbZeroPolyArcSS8Copy,
-#else
- miZeroPolyArc,
-#endif
- miFillPolygon,
- cfbPolyFillRect,
- cfbPolyFillArcSolidCopy,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- useImageGlyphBlt,
- usePolyGlyphBlt,
- usePushPixels
-};
-
-static GCOps *
-cfb8_32MatchCommon (GCPtr pGC, cfbPrivGCPtr devPriv)
-{
- if (pGC->lineWidth != 0)
- return 0;
- if (pGC->lineStyle != LineSolid)
- return 0;
- if (pGC->fillStyle != FillSolid)
- return 0;
- if (devPriv->rop != GXcopy)
- return 0;
- if (pGC->font &&
- FONTMAXBOUNDS(pGC->font,rightSideBearing) -
- FONTMINBOUNDS(pGC->font,leftSideBearing) <= 32 &&
- FONTMINBOUNDS(pGC->font,characterWidth) >= 0)
- {
- if (TERMINALFONT(pGC->font)
-#ifdef FOUR_BIT_CODE
- && FONTMAXBOUNDS(pGC->font,characterWidth) >= PGSZB
-#endif
- )
-#ifdef NO_ONE_RECT
- return &cfb8_32TEOps1Rect;
-#else
- if (devPriv->oneRect)
- return &cfb8_32TEOps1Rect;
- else
- return &cfb8_32TEOps;
-#endif
- else
-#ifdef NO_ONE_RECT
- return &cfb8_32NonTEOps1Rect;
-#else
- if (devPriv->oneRect)
- return &cfb8_32NonTEOps1Rect;
- else
- return &cfb8_32NonTEOps;
-#endif
- }
- return 0;
-}
-
-
-/* Clipping conventions
- if the drawable is a window
- CT_REGION ==> pCompositeClip really is the composite
- CT_other ==> pCompositeClip is the window clip region
- if the drawable is a pixmap
- CT_REGION ==> pCompositeClip is the translated client region
- clipped to the pixmap boundary
- CT_other ==> pCompositeClip is the pixmap bounding box
-*/
-
-void
-#if PSZ == 8
-cfb8_32ValidateGC8(
-#else
-cfb8_32ValidateGC32(
-#endif
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDrawable
-){
- int mask; /* stateChanges */
- int index; /* used for stepping through bitfields */
- int new_rrop;
- int new_line, new_text, new_fillspans, new_fillarea;
- /* flags for changing the proc vector */
- cfbPrivGCPtr devPriv;
- int oneRect;
-
- pGC->lastWinOrg.x = pDrawable->x;
- pGC->lastWinOrg.y = pDrawable->y;
- devPriv = cfbGetGCPrivate(pGC);
-
- new_rrop = FALSE;
- new_line = FALSE;
- new_text = FALSE;
- new_fillspans = FALSE;
- new_fillarea = FALSE;
-
- /*
- * if the client clip is different or moved OR the subwindowMode has
- * changed OR the window's clip has changed since the last validation
- * we need to recompute the composite clip
- */
-
- if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) ||
- (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS)))
- {
- miComputeCompositeClip (pGC, pDrawable);
-#ifdef NO_ONE_RECT
- devPriv->oneRect = FALSE;
-#else
- oneRect = REGION_NUM_RECTS(pGC->pCompositeClip) == 1;
- if (oneRect != devPriv->oneRect)
- new_line = TRUE;
- devPriv->oneRect = oneRect;
-#endif
- }
-
- mask = changes;
- while (mask) {
- index = lowbit (mask);
- mask &= ~index;
-
- switch (index) {
- case GCFunction:
- case GCForeground:
- new_rrop = TRUE;
- break;
- case GCPlaneMask:
- new_rrop = TRUE;
- new_text = TRUE;
- break;
- case GCBackground:
- break;
- case GCLineStyle:
- case GCLineWidth:
- new_line = TRUE;
- break;
- case GCJoinStyle:
- case GCCapStyle:
- break;
- case GCFillStyle:
- new_text = TRUE;
- new_fillspans = TRUE;
- new_line = TRUE;
- new_fillarea = TRUE;
- break;
- case GCFillRule:
- break;
- case GCTile:
- new_fillspans = TRUE;
- new_fillarea = TRUE;
- break;
- case GCStipple:
- new_fillspans = TRUE;
- new_fillarea = TRUE;
- break;
- case GCTileStipXOrigin:
- case GCTileStipYOrigin:
- break;
- case GCFont:
- new_text = TRUE;
- break;
- case GCSubwindowMode:
- case GCGraphicsExposures:
- case GCClipXOrigin:
- case GCClipYOrigin:
- case GCClipMask:
- case GCDashOffset:
- case GCDashList:
- case GCArcMode:
- default:
- break;
- }
- }
-
- /*
- * If the drawable has changed, ensure suitable
- * entries are in the proc vector.
- */
- if (pDrawable->serialNumber != (pGC->serialNumber & (DRAWABLE_SERIAL_BITS)))
- new_fillspans = TRUE; /* deal with FillSpans later */
-
- if (new_rrop)
- {
- int old_rrop;
-
- old_rrop = devPriv->rop;
- devPriv->rop = cfbReduceRasterOp (pGC->alu, pGC->fgPixel,
- pGC->planemask,
- &devPriv->and, &devPriv->xor);
- if (old_rrop == devPriv->rop)
- new_rrop = FALSE;
- else
- {
-#ifdef PIXEL_ADDR
- new_line = TRUE;
-#endif
-#ifdef WriteBitGroup
- new_text = TRUE;
-#endif
- new_fillspans = TRUE;
- new_fillarea = TRUE;
- }
- }
-
- if(!pGC->ops)
- pGC->ops = & cfb8_32NonTEOps;
-
- if (new_rrop || new_fillspans || new_text || new_fillarea || new_line)
- {
- GCOps *newops;
-
- if ((newops = cfb8_32MatchCommon (pGC, devPriv)))
- {
- if (pGC->ops->devPrivate.val)
- miDestroyGCOps (pGC->ops);
- pGC->ops = newops;
- new_rrop = new_line = new_fillspans = new_text = new_fillarea = 0;
- }
- else
- {
- if (!pGC->ops->devPrivate.val)
- {
- pGC->ops = miCreateGCOps (pGC->ops);
- pGC->ops->devPrivate.val = 1;
- }
- }
- }
-
- /* deal with the changes we've collected */
- if (new_line)
- {
- pGC->ops->FillPolygon = miFillPolygon;
-#ifdef NO_ONE_RECT
- if (pGC->fillStyle == FillSolid)
- {
- switch (devPriv->rop) {
- case GXcopy:
- pGC->ops->FillPolygon = cfbFillPoly1RectCopy;
- break;
- default:
- pGC->ops->FillPolygon = cfbFillPoly1RectGeneral;
- break;
- }
- }
-#else
- if (devPriv->oneRect && pGC->fillStyle == FillSolid)
- {
- switch (devPriv->rop) {
- case GXcopy:
- pGC->ops->FillPolygon = cfbFillPoly1RectCopy;
- break;
- default:
- pGC->ops->FillPolygon = cfbFillPoly1RectGeneral;
- break;
- }
- }
-#endif
- if (pGC->lineWidth == 0)
- {
-#ifdef PIXEL_ADDR
- if ((pGC->lineStyle == LineSolid) && (pGC->fillStyle == FillSolid))
- {
- switch (devPriv->rop)
- {
- case GXxor:
- pGC->ops->PolyArc = cfbZeroPolyArcSS8Xor;
- break;
- case GXcopy:
- pGC->ops->PolyArc = cfbZeroPolyArcSS8Copy;
- break;
- default:
- pGC->ops->PolyArc = cfbZeroPolyArcSS8General;
- break;
- }
- }
- else
-#endif
- pGC->ops->PolyArc = miZeroPolyArc;
- }
- else
- pGC->ops->PolyArc = miPolyArc;
- pGC->ops->PolySegment = miPolySegment;
- switch (pGC->lineStyle)
- {
- case LineSolid:
- if(pGC->lineWidth == 0)
- {
- if (pGC->fillStyle == FillSolid)
- {
-#if defined(PIXEL_ADDR) && !defined(NO_ONE_RECT)
- if (devPriv->oneRect &&
- ((pDrawable->x >= pGC->pScreen->width - 32768) &&
- (pDrawable->y >= pGC->pScreen->height - 32768)))
- {
- pGC->ops->Polylines = cfb8LineSS1Rect;
- pGC->ops->PolySegment = cfb8SegmentSS1Rect;
- } else
-#endif
-#ifdef NO_ONE_RECT
- {
- pGC->ops->Polylines = cfb8LineSS1Rect;
- pGC->ops->PolySegment = cfb8SegmentSS1Rect;
- }
-#else
- {
- pGC->ops->Polylines = cfbLineSS;
- pGC->ops->PolySegment = cfbSegmentSS;
- }
-#endif
- }
- else
- pGC->ops->Polylines = miZeroLine;
- }
- else
- pGC->ops->Polylines = miWideLine;
- break;
- case LineOnOffDash:
- case LineDoubleDash:
- if (pGC->lineWidth == 0 && pGC->fillStyle == FillSolid)
- {
- pGC->ops->Polylines = cfbLineSD;
- pGC->ops->PolySegment = cfbSegmentSD;
- } else
- pGC->ops->Polylines = miWideDash;
- break;
- }
- }
-
- if (new_text && (pGC->font))
- {
- if (FONTMAXBOUNDS(pGC->font,rightSideBearing) -
- FONTMINBOUNDS(pGC->font,leftSideBearing) > 32 ||
- FONTMINBOUNDS(pGC->font,characterWidth) < 0)
- {
- pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
- pGC->ops->ImageGlyphBlt = miImageGlyphBlt;
- }
- else
- {
-#ifdef WriteBitGroup
- if (pGC->fillStyle == FillSolid)
- {
- if (devPriv->rop == GXcopy)
- pGC->ops->PolyGlyphBlt = cfbPolyGlyphBlt8;
- else
-#ifdef FOUR_BIT_CODE
- pGC->ops->PolyGlyphBlt = cfbPolyGlyphRop8;
-#else
- pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
-#endif
- }
- else
-#endif
- pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
- /* special case ImageGlyphBlt for terminal emulator fonts */
-#if !defined(WriteBitGroup) || PSZ == 8
- if (TERMINALFONT(pGC->font) &&
- (pGC->planemask & PMSK) == PMSK
-#ifdef FOUR_BIT_CODE
- && FONTMAXBOUNDS(pGC->font,characterWidth) >= PGSZB
-#endif
- )
- {
- pGC->ops->ImageGlyphBlt = useTEGlyphBlt;
- }
- else
-#endif
- {
-#ifdef WriteBitGroup
- if (devPriv->rop == GXcopy &&
- pGC->fillStyle == FillSolid &&
- (pGC->planemask & PMSK) == PMSK)
- pGC->ops->ImageGlyphBlt = cfbImageGlyphBlt8;
- else
-#endif
- pGC->ops->ImageGlyphBlt = miImageGlyphBlt;
- }
- }
- }
-
-
- if (new_fillspans) {
- switch (pGC->fillStyle) {
- case FillSolid:
- switch (devPriv->rop) {
- case GXcopy:
- pGC->ops->FillSpans = cfbSolidSpansCopy;
- break;
- case GXxor:
- pGC->ops->FillSpans = cfbSolidSpansXor;
- break;
- default:
- pGC->ops->FillSpans = cfbSolidSpansGeneral;
- break;
- }
- break;
- case FillTiled:
- pGC->ops->FillSpans = cfbUnnaturalTileFS;
- break;
- case FillStippled:
- case FillOpaqueStippled:
- pGC->ops->FillSpans = cfbUnnaturalStippleFS;
- break;
- default:
- FatalError("cfbValidateGC: illegal fillStyle\n");
- }
- } /* end of new_fillspans */
-
- if (new_fillarea) {
-#ifndef FOUR_BIT_CODE
- pGC->ops->PolyFillRect = miPolyFillRect;
- if (pGC->fillStyle == FillSolid || pGC->fillStyle == FillTiled)
- {
- pGC->ops->PolyFillRect = cfbPolyFillRect;
- }
-#endif
-#ifdef FOUR_BIT_CODE
- pGC->ops->PushPixels = mfbPushPixels;
- if (pGC->fillStyle == FillSolid && devPriv->rop == GXcopy)
- pGC->ops->PushPixels = cfbPushPixels8;
-#endif
- pGC->ops->PolyFillArc = miPolyFillArc;
- if (pGC->fillStyle == FillSolid)
- {
- switch (devPriv->rop)
- {
- case GXcopy:
- pGC->ops->PolyFillArc = cfbPolyFillArcSolidCopy;
- break;
- default:
- pGC->ops->PolyFillArc = cfbPolyFillArcSolidGeneral;
- break;
- }
- }
- }
-}
diff --git a/hw/xfree86/xf8_32bpp/cfbgcmisc.c b/hw/xfree86/xf8_32bpp/cfbgcmisc.c
deleted file mode 100644
index f009afc0c..000000000
--- a/hw/xfree86/xf8_32bpp/cfbgcmisc.c
+++ /dev/null
@@ -1,150 +0,0 @@
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <X11/Xproto.h>
-#define PSZ 8
-#include "cfb.h"
-#undef PSZ
-#include "cfb32.h"
-#include "cfb8_32.h"
-#include <X11/fonts/fontstruct.h>
-#include "dixfontstr.h"
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-#include "region.h"
-
-#include "mistruct.h"
-#include "mibstore.h"
-#include "migc.h"
-
-
-static void cfb8_32ValidateGC(GCPtr, unsigned long, DrawablePtr);
-static void cfb8_32DestroyGC(GCPtr pGC);
-static void cfb32DestroyGC_Underlay(GCPtr pGC);
-
-static
-GCFuncs cfb8_32GCFuncs = {
- cfb8_32ValidateGC,
- miChangeGC,
- miCopyGC,
- cfb8_32DestroyGC,
- miChangeClip,
- miDestroyClip,
- miCopyClip,
-};
-
-
-static
-GCFuncs cfb32GCFuncs_Underlay = {
- cfb32ValidateGC_Underlay,
- miChangeGC,
- miCopyGC,
- cfb32DestroyGC_Underlay,
- miChangeClip,
- miDestroyClip,
- miCopyClip,
-};
-
-static void
-cfb32DestroyGC_Underlay(GCPtr pGC)
-{
- if (pGC->freeCompClip)
- REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip);
-
- if(pGC->ops)
- miDestroyGCOps(pGC->ops);
-}
-
-
-static void
-cfb8_32DestroyGC(GCPtr pGC)
-{
- cfb8_32GCPtr pGCPriv = CFB8_32_GET_GC_PRIVATE(pGC);
-
- if (pGC->freeCompClip)
- REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip);
- if(pGCPriv->Ops8bpp)
- miDestroyGCOps(pGCPriv->Ops8bpp);
- if(pGCPriv->Ops32bpp)
- miDestroyGCOps(pGCPriv->Ops32bpp);
-}
-
-Bool
-cfb8_32CreateGC(GCPtr pGC)
-{
- cfb8_32GCPtr pGCPriv;
- cfbPrivGC *pPriv;
-
- if (PixmapWidthPaddingInfo[pGC->depth].padPixelsLog2 == LOG2_BITMAP_PAD)
- return (mfbCreateGC(pGC));
-
- pGC->clientClip = NULL;
- pGC->clientClipType = CT_NONE;
- pGC->miTranslate = 1;
- pGC->fExpose = TRUE;
- pGC->freeCompClip = FALSE;
- pGC->pRotatedPixmap = (PixmapPtr) NULL;
-
- pPriv = cfbGetGCPrivate(pGC);
- pPriv->rop = pGC->alu;
- pPriv->oneRect = FALSE;
-
- pGC->ops = NULL;
-
- if (pGC->depth == 8) {
- pGC->funcs = &cfb8_32GCFuncs;
-
- pGCPriv = CFB8_32_GET_GC_PRIVATE(pGC);
- pGCPriv->Ops8bpp = NULL;
- pGCPriv->Ops32bpp = NULL;
- pGCPriv->OpsAre8bpp = FALSE;
- pGCPriv->changes = 0;
- } else
- pGC->funcs = &cfb32GCFuncs_Underlay;
-
- return TRUE;
-}
-
-
-static void
-cfb8_32ValidateGC(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw
-){
- cfb8_32GCPtr pGCPriv = CFB8_32_GET_GC_PRIVATE(pGC);
-
- if(pDraw->bitsPerPixel == 32) {
- if(pGCPriv->OpsAre8bpp) {
- int origChanges = changes;
- pGC->ops = pGCPriv->Ops32bpp;
- changes |= pGCPriv->changes;
- pGCPriv->changes = origChanges;
- pGCPriv->OpsAre8bpp = FALSE;
- } else
- pGCPriv->changes |= changes;
-
- cfb8_32ValidateGC32(pGC, changes, pDraw);
- pGCPriv->Ops32bpp = pGC->ops;
- } else { /* bitsPerPixel == 8 */
- if(!pGCPriv->OpsAre8bpp) {
- int origChanges = changes;
- pGC->ops = pGCPriv->Ops8bpp;
- changes |= pGCPriv->changes;
- pGCPriv->changes = origChanges;
- pGCPriv->OpsAre8bpp = TRUE;
- } else
- pGCPriv->changes |= changes;
-
- cfb8_32ValidateGC8(pGC, changes, pDraw);
- pGCPriv->Ops8bpp = pGC->ops;
- }
-}
-
diff --git a/hw/xfree86/xf8_32bpp/cfbgcunder.c b/hw/xfree86/xf8_32bpp/cfbgcunder.c
deleted file mode 100644
index d90321355..000000000
--- a/hw/xfree86/xf8_32bpp/cfbgcunder.c
+++ /dev/null
@@ -1,620 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 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.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-#define PSZ 32
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <X11/Xproto.h>
-#include "cfb.h"
-#include <X11/fonts/fontstruct.h>
-#include "dixfontstr.h"
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-#include "region.h"
-
-#include "mistruct.h"
-#include "mibstore.h"
-#include "migc.h"
-#include "mioverlay.h"
-
-#include "cfbmskbits.h"
-#include "cfb8bit.h"
-#include "cfb8_32.h"
-
-#ifdef WriteBitGroup
-# define useTEGlyphBlt cfbImageGlyphBlt8
-#else
-# define useTEGlyphBlt cfbTEGlyphBlt
-#endif
-
-#ifdef WriteBitGroup
-# define useImageGlyphBlt cfbImageGlyphBlt8
-# define usePolyGlyphBlt cfbPolyGlyphBlt8
-#else
-# define useImageGlyphBlt miImageGlyphBlt
-# define usePolyGlyphBlt miPolyGlyphBlt
-#endif
-
-#ifdef FOUR_BIT_CODE
-# define usePushPixels cfbPushPixels8
-#else
-# define usePushPixels mfbPushPixels
-#endif
-
-#ifdef PIXEL_ADDR
-# define ZeroPolyArc cfbZeroPolyArcSS8Copy
-#else
-# define ZeroPolyArc miZeroPolyArc
-#endif
-
-
-static GCOps cfbTEOps1Rect = {
- cfbSolidSpansCopy,
- cfbSetSpans,
- cfbPutImage,
- cfbCopyArea,
- cfbCopyPlane,
- cfbPolyPoint,
-#ifdef PIXEL_ADDR
- cfb8LineSS1Rect,
- cfb8SegmentSS1Rect,
-#else
- cfbLineSS,
- cfbSegmentSS,
-#endif
- miPolyRectangle,
- ZeroPolyArc,
- cfbFillPoly1RectCopy,
- cfbPolyFillRect,
- cfbPolyFillArcSolidCopy,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- useTEGlyphBlt,
- usePolyGlyphBlt,
- usePushPixels
-};
-
-static GCOps cfbNonTEOps1Rect = {
- cfbSolidSpansCopy,
- cfbSetSpans,
- cfbPutImage,
- cfbCopyArea,
- cfbCopyPlane,
- cfbPolyPoint,
-#ifdef PIXEL_ADDR
- cfb8LineSS1Rect,
- cfb8SegmentSS1Rect,
-#else
- cfbLineSS,
- cfbSegmentSS,
-#endif
- miPolyRectangle,
- ZeroPolyArc,
- cfbFillPoly1RectCopy,
- cfbPolyFillRect,
- cfbPolyFillArcSolidCopy,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- useImageGlyphBlt,
- usePolyGlyphBlt,
- usePushPixels
-};
-
-static GCOps cfbTEOps = {
- cfbSolidSpansCopy,
- cfbSetSpans,
- cfbPutImage,
- cfbCopyArea,
- cfbCopyPlane,
- cfbPolyPoint,
- cfbLineSS,
- cfbSegmentSS,
- miPolyRectangle,
- ZeroPolyArc,
- miFillPolygon,
- cfbPolyFillRect,
- cfbPolyFillArcSolidCopy,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- useTEGlyphBlt,
- usePolyGlyphBlt,
- usePushPixels
-};
-
-static GCOps cfbNonTEOps = {
- cfbSolidSpansCopy,
- cfbSetSpans,
- cfbPutImage,
- cfbCopyArea,
- cfbCopyPlane,
- cfbPolyPoint,
- cfbLineSS,
- cfbSegmentSS,
- miPolyRectangle,
-#ifdef PIXEL_ADDR
- cfbZeroPolyArcSS8Copy,
-#else
- miZeroPolyArc,
-#endif
- miFillPolygon,
- cfbPolyFillRect,
- cfbPolyFillArcSolidCopy,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- useImageGlyphBlt,
- usePolyGlyphBlt,
- usePushPixels
-};
-
-static GCOps *
-cfb32MatchCommon_Underlay(
- GCPtr pGC,
- cfbPrivGCPtr devPriv)
-{
- if (pGC->lineWidth != 0)
- return 0;
- if (pGC->lineStyle != LineSolid)
- return 0;
- if (pGC->fillStyle != FillSolid)
- return 0;
- if (devPriv->rop != GXcopy)
- return 0;
- if (pGC->font &&
- FONTMAXBOUNDS(pGC->font,rightSideBearing) -
- FONTMINBOUNDS(pGC->font,leftSideBearing) <= 32 &&
- FONTMINBOUNDS(pGC->font,characterWidth) >= 0)
- {
- if (TERMINALFONT(pGC->font)
-#ifdef FOUR_BIT_CODE
- && FONTMAXBOUNDS(pGC->font,characterWidth) >= PGSZB
-#endif
- )
-#ifdef NO_ONE_RECT
- return &cfbTEOps1Rect;
-#else
- if (devPriv->oneRect)
- return &cfbTEOps1Rect;
- else
- return &cfbTEOps;
-#endif
- else
-#ifdef NO_ONE_RECT
- return &cfbNonTEOps1Rect;
-#else
- if (devPriv->oneRect)
- return &cfbNonTEOps1Rect;
- else
- return &cfbNonTEOps;
-#endif
- }
- return 0;
-}
-
-
-void
-cfb32ValidateGC_Underlay(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDrawable
-){
- int mask; /* stateChanges */
- int index; /* used for stepping through bitfields */
- int new_rrop;
- int new_line, new_text, new_fillspans, new_fillarea;
- /* flags for changing the proc vector */
- cfbPrivGCPtr devPriv;
- int oneRect;
-
- pGC->lastWinOrg.x = pDrawable->x;
- pGC->lastWinOrg.y = pDrawable->y;
- devPriv = cfbGetGCPrivate(pGC);
-
- new_rrop = FALSE;
- new_line = FALSE;
- new_text = FALSE;
- new_fillspans = FALSE;
- new_fillarea = FALSE;
-
- /*
- * if the client clip is different or moved OR the subwindowMode has
- * changed OR the window's clip has changed since the last validation
- * we need to recompute the composite clip
- */
-
- if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) ||
- (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS))
- )
- {
- if(pDrawable->type == DRAWABLE_WINDOW)
- miOverlayComputeCompositeClip (pGC, (WindowPtr)pDrawable);
- else
- miComputeCompositeClip (pGC, pDrawable);
-#ifdef NO_ONE_RECT
- devPriv->oneRect = FALSE;
-#else
- oneRect = REGION_NUM_RECTS(pGC->pCompositeClip) == 1;
- if (oneRect != devPriv->oneRect)
- new_line = TRUE;
- devPriv->oneRect = oneRect;
-#endif
- }
-
- mask = changes;
- while (mask) {
- index = lowbit (mask);
- mask &= ~index;
-
- switch (index) {
- case GCFunction:
- case GCForeground:
- new_rrop = TRUE;
- break;
- case GCPlaneMask:
- new_rrop = TRUE;
- new_text = TRUE;
- break;
- case GCBackground:
- break;
- case GCLineStyle:
- case GCLineWidth:
- new_line = TRUE;
- break;
- case GCJoinStyle:
- case GCCapStyle:
- break;
- case GCFillStyle:
- new_text = TRUE;
- new_fillspans = TRUE;
- new_line = TRUE;
- new_fillarea = TRUE;
- break;
- case GCFillRule:
- break;
- case GCTile:
- new_fillspans = TRUE;
- new_fillarea = TRUE;
- break;
- case GCStipple:
- new_fillspans = TRUE;
- new_fillarea = TRUE;
- break;
- case GCTileStipXOrigin:
- case GCTileStipYOrigin:
- break;
- case GCFont:
- new_text = TRUE;
- break;
- case GCSubwindowMode:
- case GCGraphicsExposures:
- case GCClipXOrigin:
- case GCClipYOrigin:
- case GCClipMask:
- case GCDashOffset:
- case GCDashList:
- case GCArcMode:
- default:
- break;
- }
- }
-
- /*
- * If the drawable has changed, ensure suitable
- * entries are in the proc vector.
- */
- if (pDrawable->serialNumber != (pGC->serialNumber & (DRAWABLE_SERIAL_BITS)))
- new_fillspans = TRUE; /* deal with FillSpans later */
-
- if (new_rrop)
- {
- int old_rrop;
-
- old_rrop = devPriv->rop;
- devPriv->rop = cfbReduceRasterOp (pGC->alu, pGC->fgPixel,
- pGC->planemask,
- &devPriv->and, &devPriv->xor);
- if (old_rrop == devPriv->rop)
- new_rrop = FALSE;
- else
- {
-#ifdef PIXEL_ADDR
- new_line = TRUE;
-#endif
-#ifdef WriteBitGroup
- new_text = TRUE;
-#endif
- new_fillspans = TRUE;
- new_fillarea = TRUE;
- }
- }
-
- if(!pGC->ops)
- pGC->ops = & cfbNonTEOps;
-
-
- if (new_rrop || new_fillspans || new_text || new_fillarea || new_line)
- {
- GCOps *newops;
-
- if ((newops = cfb32MatchCommon_Underlay (pGC, devPriv)))
- {
- if (pGC->ops->devPrivate.val)
- miDestroyGCOps (pGC->ops);
- pGC->ops = newops;
- new_rrop = new_line = new_fillspans = new_text = new_fillarea = 0;
- }
- else
- {
- if (!pGC->ops->devPrivate.val)
- {
- pGC->ops = miCreateGCOps (pGC->ops);
- pGC->ops->devPrivate.val = 1;
- }
- }
- }
-
- /* deal with the changes we've collected */
- if (new_line)
- {
- pGC->ops->FillPolygon = miFillPolygon;
-#ifdef NO_ONE_RECT
- if (pGC->fillStyle == FillSolid)
- {
- switch (devPriv->rop) {
- case GXcopy:
- pGC->ops->FillPolygon = cfbFillPoly1RectCopy;
- break;
- default:
- pGC->ops->FillPolygon = cfbFillPoly1RectGeneral;
- break;
- }
- }
-#else
- if (devPriv->oneRect && pGC->fillStyle == FillSolid)
- {
- switch (devPriv->rop) {
- case GXcopy:
- pGC->ops->FillPolygon = cfbFillPoly1RectCopy;
- break;
- default:
- pGC->ops->FillPolygon = cfbFillPoly1RectGeneral;
- break;
- }
- }
-#endif
- if (pGC->lineWidth == 0)
- {
-#ifdef PIXEL_ADDR
- if ((pGC->lineStyle == LineSolid) && (pGC->fillStyle == FillSolid))
- {
- switch (devPriv->rop)
- {
- case GXxor:
- pGC->ops->PolyArc = cfbZeroPolyArcSS8Xor;
- break;
- case GXcopy:
- pGC->ops->PolyArc = cfbZeroPolyArcSS8Copy;
- break;
- default:
- pGC->ops->PolyArc = cfbZeroPolyArcSS8General;
- break;
- }
- }
- else
-#endif
- pGC->ops->PolyArc = miZeroPolyArc;
- }
- else
- pGC->ops->PolyArc = miPolyArc;
- pGC->ops->PolySegment = miPolySegment;
- switch (pGC->lineStyle)
- {
- case LineSolid:
- if(pGC->lineWidth == 0)
- {
- if (pGC->fillStyle == FillSolid)
- {
-#if defined(PIXEL_ADDR) && !defined(NO_ONE_RECT)
- if (devPriv->oneRect &&
- ((pDrawable->x >= pGC->pScreen->width - 32768) &&
- (pDrawable->y >= pGC->pScreen->height - 32768)))
- {
- pGC->ops->Polylines = cfb8LineSS1Rect;
- pGC->ops->PolySegment = cfb8SegmentSS1Rect;
- } else
-#endif
-#ifdef NO_ONE_RECT
- {
- pGC->ops->Polylines = cfb8LineSS1Rect;
- pGC->ops->PolySegment = cfb8SegmentSS1Rect;
- }
-#else
- {
- pGC->ops->Polylines = cfbLineSS;
- pGC->ops->PolySegment = cfbSegmentSS;
- }
-#endif
- }
- else
- pGC->ops->Polylines = miZeroLine;
- }
- else
- pGC->ops->Polylines = miWideLine;
- break;
- case LineOnOffDash:
- case LineDoubleDash:
- if (pGC->lineWidth == 0 && pGC->fillStyle == FillSolid)
- {
- pGC->ops->Polylines = cfbLineSD;
- pGC->ops->PolySegment = cfbSegmentSD;
- } else
- pGC->ops->Polylines = miWideDash;
- break;
- }
- }
-
- if (new_text && (pGC->font))
- {
- if (FONTMAXBOUNDS(pGC->font,rightSideBearing) -
- FONTMINBOUNDS(pGC->font,leftSideBearing) > 32 ||
- FONTMINBOUNDS(pGC->font,characterWidth) < 0)
- {
- pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
- pGC->ops->ImageGlyphBlt = miImageGlyphBlt;
- }
- else
- {
-#ifdef WriteBitGroup
- if (pGC->fillStyle == FillSolid)
- {
- if (devPriv->rop == GXcopy)
- pGC->ops->PolyGlyphBlt = cfbPolyGlyphBlt8;
- else
-#ifdef FOUR_BIT_CODE
- pGC->ops->PolyGlyphBlt = cfbPolyGlyphRop8;
-#else
- pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
-#endif
- }
- else
-#endif
- pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
- /* special case ImageGlyphBlt for terminal emulator fonts */
-#if !defined(WriteBitGroup) || PSZ == 8
- if (TERMINALFONT(pGC->font) &&
- (pGC->planemask & PMSK) == PMSK
-#ifdef FOUR_BIT_CODE
- && FONTMAXBOUNDS(pGC->font,characterWidth) >= PGSZB
-#endif
- )
- {
- pGC->ops->ImageGlyphBlt = useTEGlyphBlt;
- }
- else
-#endif
- {
-#ifdef WriteBitGroup
- if (devPriv->rop == GXcopy &&
- pGC->fillStyle == FillSolid &&
- (pGC->planemask & PMSK) == PMSK)
- pGC->ops->ImageGlyphBlt = cfbImageGlyphBlt8;
- else
-#endif
- pGC->ops->ImageGlyphBlt = miImageGlyphBlt;
- }
- }
- }
-
-
- if (new_fillspans) {
- switch (pGC->fillStyle) {
- case FillSolid:
- switch (devPriv->rop) {
- case GXcopy:
- pGC->ops->FillSpans = cfbSolidSpansCopy;
- break;
- case GXxor:
- pGC->ops->FillSpans = cfbSolidSpansXor;
- break;
- default:
- pGC->ops->FillSpans = cfbSolidSpansGeneral;
- break;
- }
- break;
- case FillTiled:
- pGC->ops->FillSpans = cfbUnnaturalTileFS;
- break;
- case FillStippled:
- case FillOpaqueStippled:
- pGC->ops->FillSpans = cfbUnnaturalStippleFS;
- break;
- default:
- FatalError("cfbValidateGC: illegal fillStyle\n");
- }
- } /* end of new_fillspans */
-
- if (new_fillarea) {
-#ifndef FOUR_BIT_CODE
- pGC->ops->PolyFillRect = miPolyFillRect;
- if (pGC->fillStyle == FillSolid || pGC->fillStyle == FillTiled)
- {
- pGC->ops->PolyFillRect = cfbPolyFillRect;
- }
-#endif
-#ifdef FOUR_BIT_CODE
- pGC->ops->PushPixels = mfbPushPixels;
- if (pGC->fillStyle == FillSolid && devPriv->rop == GXcopy)
- pGC->ops->PushPixels = cfbPushPixels8;
-#endif
- pGC->ops->PolyFillArc = miPolyFillArc;
- if (pGC->fillStyle == FillSolid)
- {
- switch (devPriv->rop)
- {
- case GXcopy:
- pGC->ops->PolyFillArc = cfbPolyFillArcSolidCopy;
- break;
- default:
- pGC->ops->PolyFillArc = cfbPolyFillArcSolidGeneral;
- break;
- }
- }
- }
-}
diff --git a/hw/xfree86/xf8_32bpp/cfbimage.c b/hw/xfree86/xf8_32bpp/cfbimage.c
deleted file mode 100644
index 01a5a5eb6..000000000
--- a/hw/xfree86/xf8_32bpp/cfbimage.c
+++ /dev/null
@@ -1,174 +0,0 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <X11/X.h>
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-#include "gcstruct.h"
-#define PSZ 8
-#include "cfb.h"
-#undef PSZ
-#include "cfb32.h"
-#include "cfb8_32.h"
-#include "servermd.h"
-#include "mi.h"
-
-
-void
-cfb8_32GetImage (
- DrawablePtr pDraw,
- int sx, int sy, int w, int h,
- unsigned int format,
- unsigned long planemask,
- char *pdstLine
-){
- if(!w || !h) return;
-
- if (!cfbDrawableEnabled (pDraw))
- return;
-
- if(pDraw->depth == 24){
- cfb32GetImage(pDraw, sx, sy, w, h, format, planemask, pdstLine);
- return;
- }
-
- if((pDraw->bitsPerPixel == 8) || (pDraw->bitsPerPixel == 1)){
- cfbGetImage(pDraw, sx, sy, w, h, format, planemask, pdstLine);
- return;
- }
-
- /* source is depth 8, 32 bpp */
- if(format != ZPixmap) {
- miGetImage(pDraw, sx, sy, w, h, format, planemask, pdstLine);
- return;
- } else {
- BoxRec box;
- DDXPointRec ptSrc;
- RegionRec rgnDst;
- ScreenPtr pScreen;
- PixmapPtr pPixmap;
-
- pScreen = pDraw->pScreen;
- pPixmap = GetScratchPixmapHeader(pScreen, w, h, 8, 8,
- PixmapBytePad(w,8), (pointer)pdstLine);
- if (!pPixmap)
- return;
- if ((planemask & 0xff) != 0xff)
- memset((char *)pdstLine, 0, pPixmap->devKind * h);
- ptSrc.x = sx + pDraw->x;
- ptSrc.y = sy + pDraw->y;
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = w;
- box.y2 = h;
- REGION_INIT(pScreen, &rgnDst, &box, 1);
- cfbDoBitblt32To8(pDraw, (DrawablePtr)pPixmap, GXcopy, &rgnDst,
- &ptSrc, planemask);
- REGION_UNINIT(pScreen, &rgnDst);
- FreeScratchPixmapHeader(pPixmap);
- }
-}
-
-void
-cfb8_32PutImage (
- DrawablePtr pDraw,
- GCPtr pGC,
- int depth,
- int x, int y, int w, int h,
- int leftPad,
- int format,
- char *pImage
-){
- if(!w || !h) return;
-
- if((pDraw->bitsPerPixel == 8) || (format != XYPixmap)){
- cfbPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage);
- return;
- } else { /* moving an 8bpp XYPixmap to a 32bpp screen */
- unsigned long oldFg, oldBg;
- XID gcv[3];
- unsigned long oldPlanemask;
- unsigned long i;
- long bytesPer;
-
- oldPlanemask = pGC->planemask;
- oldFg = pGC->fgPixel;
- oldBg = pGC->bgPixel;
- gcv[0] = ~0L;
- gcv[1] = 0;
- DoChangeGC(pGC, GCForeground | GCBackground, gcv, 0);
- bytesPer = (long)h * BitmapBytePad(w + leftPad);
-
- for (i = 0x80000000; i & 0xff000000; i >>= 1, pImage += bytesPer)
- {
- if (i & oldPlanemask)
- {
- gcv[0] = i;
- DoChangeGC(pGC, GCPlaneMask, gcv, 0);
- ValidateGC(pDraw, pGC);
- (*pGC->ops->PutImage)(pDraw, pGC, 1, x, y, w, h, leftPad,
- XYBitmap, pImage);
- }
- }
- gcv[0] = oldPlanemask;
- gcv[1] = oldFg;
- gcv[2] = oldBg;
- DoChangeGC(pGC, GCPlaneMask | GCForeground | GCBackground, gcv, 0);
- ValidateGC(pDraw, pGC);
- }
-}
-
-
-
-
-void
-cfb8_32GetSpans(
- DrawablePtr pDraw,
- int wMax,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- char *pDst
-){
- int pitch, i;
- CARD8 *ptr, *ptrBase;
-
- if (!cfbDrawableEnabled (pDraw))
- return;
-
- if(pDraw->bitsPerPixel == 1) {
- mfbGetSpans(pDraw, wMax, ppt, pwidth, nspans, pDst);
- return;
- }
-
- if(pDraw->depth == 24) {
- cfb32GetSpans(pDraw, wMax, ppt, pwidth, nspans, pDst);
- return;
- } else if(pDraw->bitsPerPixel == 8) {
- cfbGetSpans(pDraw, wMax, ppt, pwidth, nspans, pDst);
- return;
- }
-
- /* gotta get spans from a depth 8 window */
- cfbGetByteWidthAndPointer(pDraw, pitch, ptrBase);
- ptrBase += 3; /* point to top byte */
-
- while(nspans--) {
- ptr = ptrBase + (ppt->y * pitch) + (ppt->x << 2);
-
- for(i = *pwidth; i--; ptr += 4)
- *(pDst++) = *ptr;
-
- pDst = (char*)((long)(pDst + 3) & ~3L);
-
- ppt++; pwidth++;
- }
-}
-
-
diff --git a/hw/xfree86/xf8_32bpp/cfbpntwin.c b/hw/xfree86/xf8_32bpp/cfbpntwin.c
deleted file mode 100644
index fbf597d22..000000000
--- a/hw/xfree86/xf8_32bpp/cfbpntwin.c
+++ /dev/null
@@ -1,51 +0,0 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-
-#include "windowstr.h"
-#include "regionstr.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-
-#define PSZ 8
-#include "cfb.h"
-#undef PSZ
-#include "cfb32.h"
-#include "cfb8_32.h"
-#include "mi.h"
-
-#ifdef PANORAMIX
-#include "panoramiX.h"
-#include "panoramiXsrv.h"
-#endif
-
-void
-cfb8_32FillBoxSolid8(
- DrawablePtr pDraw,
- int nbox,
- BoxPtr pbox,
- unsigned long color
-){
- CARD8 *ptr, *data;
- int pitch, height, width, i;
- CARD8 c = (CARD8)color;
-
- cfbGetByteWidthAndPointer(pDraw, pitch, ptr);
- ptr += 3; /* point to the top byte */
-
- while(nbox--) {
- data = ptr + (pbox->y1 * pitch) + (pbox->x1 << 2);
- width = (pbox->x2 - pbox->x1) << 2;
- height = pbox->y2 - pbox->y1;
-
- while(height--) {
- for(i = 0; i < width; i+=4)
- data[i] = c;
- data += pitch;
- }
- pbox++;
- }
-}
diff --git a/hw/xfree86/xf8_32bpp/cfbscrinit.c b/hw/xfree86/xf8_32bpp/cfbscrinit.c
deleted file mode 100644
index c3432b803..000000000
--- a/hw/xfree86/xf8_32bpp/cfbscrinit.c
+++ /dev/null
@@ -1,311 +0,0 @@
-
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include "misc.h"
-#include "servermd.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "resource.h"
-#include "colormap.h"
-#include "colormapst.h"
-#define PSZ 8
-#include "cfb.h"
-#undef PSZ
-#include "cfb32.h"
-#include "cfb8_32.h"
-#include "mi.h"
-#include "micmap.h"
-#include "mistruct.h"
-#include "dix.h"
-#include "mibstore.h"
-#include "mioverlay.h"
-#include "xf86.h"
-#include "xf86str.h"
-#include "globals.h"
-
-/* CAUTION: We require that cfb8 and cfb32 were NOT
- compiled with CFB_NEED_SCREEN_PRIVATE */
-
-static DevPrivateKey cfb8_32GCPrivateKey = &cfb8_32GCPrivateKey;
-DevPrivateKey cfb8_32GetGCPrivateKey(void)
-{
- return cfb8_32GCPrivateKey;
-}
-
-static DevPrivateKey cfb8_32ScreenPrivateKey = &cfb8_32ScreenPrivateKey;
-DevPrivateKey cfb8_32GetScreenPrivateKey(void)
-{
- return cfb8_32ScreenPrivateKey;
-}
-
-static Bool
-cfb8_32AllocatePrivates(ScreenPtr pScreen)
-{
- cfb8_32ScreenPtr pScreenPriv;
-
- if (!(pScreenPriv = xalloc(sizeof(cfb8_32ScreenRec))))
- return FALSE;
-
- dixSetPrivate(&pScreen->devPrivates, cfb8_32ScreenPrivateKey, pScreenPriv);
-
-
- /* All cfb will have the same GC and Window private indicies */
- if(!mfbAllocatePrivates(pScreen, &cfbGCPrivateKey))
- return FALSE;
-
- if(!dixRequestPrivate(cfbGCPrivateKey, sizeof(cfbPrivGC)))
- return FALSE;
-
- if(!dixRequestPrivate(cfb8_32GCPrivateKey, sizeof(cfb8_32GCRec)))
- return FALSE;
-
- return TRUE;
-}
-
-static void DestroyColormapNoop(
- ColormapPtr pColormap)
-{
- /* NOOP */
-}
-
-static void StoreColorsNoop(
- ColormapPtr pColormap,
- int ndef,
- xColorItem * pdef)
-{
- /* NOOP */
-}
-
-static Bool
-cfb8_32SetupScreen(
- ScreenPtr pScreen,
- pointer pbits, /* pointer to screen bitmap */
- int xsize, int ysize, /* in pixels */
- int dpix, int dpiy, /* dots per inch */
- int width /* pixel width of frame buffer */
-){
- if (!cfb8_32AllocatePrivates(pScreen))
- return FALSE;
- pScreen->defColormap = FakeClientID(0);
- /* let CreateDefColormap do whatever it wants for pixels */
- pScreen->blackPixel = pScreen->whitePixel = (Pixel) 0;
- pScreen->QueryBestSize = mfbQueryBestSize;
- /* SaveScreen */
- pScreen->GetImage = cfb8_32GetImage;
- pScreen->GetSpans = cfb8_32GetSpans;
- pScreen->CreateWindow = cfb8_32CreateWindow;
- pScreen->DestroyWindow = cfb8_32DestroyWindow;
- pScreen->PositionWindow = cfb8_32PositionWindow;
- pScreen->ChangeWindowAttributes = cfb8_32ChangeWindowAttributes;
- pScreen->RealizeWindow = cfb32MapWindow; /* OK */
- pScreen->UnrealizeWindow = cfb32UnmapWindow; /* OK */
- pScreen->CopyWindow = cfb8_32CopyWindow;
- pScreen->CreatePixmap = cfb32CreatePixmap; /* OK */
- pScreen->DestroyPixmap = cfb32DestroyPixmap; /* OK */
- pScreen->RealizeFont = mfbRealizeFont;
- pScreen->UnrealizeFont = mfbUnrealizeFont;
- pScreen->CreateGC = cfb8_32CreateGC;
- pScreen->CreateColormap = miInitializeColormap;
- pScreen->DestroyColormap = DestroyColormapNoop;
- pScreen->InstallColormap = miInstallColormap;
- pScreen->UninstallColormap = miUninstallColormap;
- pScreen->ListInstalledColormaps = miListInstalledColormaps;
- pScreen->StoreColors = StoreColorsNoop;
- pScreen->ResolveColor = miResolveColor;
- pScreen->BitmapToRegion = mfbPixmapToRegion;
-
- mfbRegisterCopyPlaneProc (pScreen, cfb8_32CopyPlane);
- return TRUE;
-}
-
-typedef struct {
- pointer pbits;
- int width;
-} miScreenInitParmsRec, *miScreenInitParmsPtr;
-
-static Bool
-cfb8_32CreateScreenResources(ScreenPtr pScreen)
-{
- miScreenInitParmsPtr pScrInitParms;
- int pitch;
- Bool retval;
-
- /* get the pitch before mi destroys it */
- pScrInitParms = (miScreenInitParmsPtr)pScreen->devPrivate;
- pitch = pScrInitParms->width << 2;
-
- if((retval = miCreateScreenResources(pScreen))) {
- /* fix the screen pixmap */
- PixmapPtr pPix = (PixmapPtr)pScreen->devPrivate;
- pPix->drawable.bitsPerPixel = 32;
- pPix->drawable.depth = 8;
- pPix->devKind = pitch;
- }
-
- return retval;
-}
-
-
-static Bool
-cfb8_32CloseScreen (int i, ScreenPtr pScreen)
-{
- cfb8_32ScreenPtr pScreenPriv = CFB8_32_GET_SCREEN_PRIVATE(pScreen);
- if(pScreenPriv->visualData)
- xfree(pScreenPriv->visualData);
-
- xfree((pointer) pScreenPriv);
- dixSetPrivate(&pScreen->devPrivates, cfb8_32ScreenPrivateKey, NULL);
-
- return(cfb32CloseScreen(i, pScreen));
-}
-
-static void
-cfb8_32TransFunc(
- ScreenPtr pScreen,
- int nbox,
- BoxPtr pbox
-){
- cfb8_32FillBoxSolid8(&(WindowTable[pScreen->myNum]->drawable),
- nbox, pbox, xf86Screens[pScreen->myNum]->colorKey);
-}
-
-static Bool
-cfb8_32InOverlayFunc(WindowPtr pWin)
-{
- return (pWin->drawable.depth == 8);
-}
-
-static Bool
-cfb8_32FinishScreenInit(
- ScreenPtr pScreen,
- pointer pbits, /* pointer to screen bitmap */
- int xsize, int ysize, /* in pixels */
- int dpix, int dpiy, /* dots per inch */
- int width /* pixel width of frame buffer */
-){
- VisualPtr visuals;
- DepthPtr depths;
- int nvisuals;
- int ndepths;
- int rootdepth;
- VisualID defaultVisual;
-
- rootdepth = 0;
- if (!miInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootdepth,
- &defaultVisual,((unsigned long)1<<(32-1)), 8, -1))
- return FALSE;
- if (! miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
- rootdepth, ndepths, depths,
- defaultVisual, nvisuals, visuals))
- return FALSE;
-
- pScreen->CreateScreenResources = cfb8_32CreateScreenResources;
- pScreen->CloseScreen = cfb8_32CloseScreen;
- pScreen->GetScreenPixmap = cfb32GetScreenPixmap; /* OK */
- pScreen->SetScreenPixmap = cfb32SetScreenPixmap; /* OK */
-
- if (! miInitOverlay(pScreen, cfb8_32InOverlayFunc, cfb8_32TransFunc))
- return FALSE;
-
- return TRUE;
-}
-
-static void
-cfb8_32EnableDisableFBAccess (
- int index,
- Bool enable
-){
- ScreenPtr pScreen = screenInfo.screens[index];
- cfb8_32ScreenPtr pScreenPriv = CFB8_32_GET_SCREEN_PRIVATE(pScreen);
-
- miOverlaySetRootClip(pScreen, enable);
-
- (*pScreenPriv->EnableDisableFBAccess) (index, enable);
-}
-
-static Atom overlayVisualsAtom;
-
-typedef struct {
- CARD32 overlay_visual;
- CARD32 transparent_type;
- CARD32 value;
- CARD32 layer;
-} overlayVisualRec;
-
-static void
-cfb8_32SetupVisuals (ScreenPtr pScreen)
-{
- cfb8_32ScreenPtr pScreenPriv = CFB8_32_GET_SCREEN_PRIVATE(pScreen);
- char atomString[] = {"SERVER_OVERLAY_VISUALS"};
- overlayVisualRec *overlayVisuals;
- VisualID *visuals = NULL;
- int numVisuals = 0;
- DepthPtr pDepth = pScreen->allowedDepths;
- int numDepths = pScreen->numDepths;
- int i;
-
- /* find depth 8 visuals */
- for(i = 0; i < numDepths; i++, pDepth++) {
- if(pDepth->depth == 8) {
- numVisuals = pDepth->numVids;
- visuals = pDepth->vids;
- break;
- }
- }
-
- if(!numVisuals || !visuals) {
- ErrorF("No overlay visuals found!\n");
- return;
- }
-
- if(!(overlayVisuals = xalloc(numVisuals * sizeof(overlayVisualRec))))
- return;
-
- for(i = 0; i < numVisuals; i++) {
- overlayVisuals[i].overlay_visual = visuals[i];
- overlayVisuals[i].transparent_type = 1; /* transparent pixel */
- overlayVisuals[i].value = pScreenPriv->key;
- overlayVisuals[i].layer = 1;
- }
-
- overlayVisualsAtom = MakeAtom(atomString, sizeof(atomString) - 1, TRUE);
- xf86RegisterRootWindowProperty(pScreen->myNum, overlayVisualsAtom,
- overlayVisualsAtom, 32, numVisuals * 4, overlayVisuals);
- pScreenPriv->visualData = (pointer)overlayVisuals;
-}
-
-Bool
-cfb8_32ScreenInit(
- ScreenPtr pScreen,
- pointer pbits, /* pointer to screen bitmap */
- int xsize, int ysize, /* in pixels */
- int dpix, int dpiy, /* dots per inch */
- int w /* pixel width of frame buffer */
-){
- cfb8_32ScreenPtr pScreenPriv;
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-
- if (!cfb8_32SetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, w))
- return FALSE;
-
- pScreenPriv = CFB8_32_GET_SCREEN_PRIVATE(pScreen);
- pScreenPriv->key = pScrn->colorKey;
- pScreenPriv->visualData = NULL;
-
-
- pScreenPriv->EnableDisableFBAccess = pScrn->EnableDisableFBAccess;
- pScrn->EnableDisableFBAccess = cfb8_32EnableDisableFBAccess;
-
-
- if(cfb8_32FinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, w))
- {
- cfb8_32SetupVisuals(pScreen);
- return TRUE;
- }
- return FALSE;
-}
diff --git a/hw/xfree86/xf8_32bpp/cfbwindow.c b/hw/xfree86/xf8_32bpp/cfbwindow.c
deleted file mode 100644
index 2e6057f12..000000000
--- a/hw/xfree86/xf8_32bpp/cfbwindow.c
+++ /dev/null
@@ -1,116 +0,0 @@
-
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "windowstr.h"
-#define PSZ 8
-#include "cfb.h"
-#undef PSZ
-#include "cfb32.h"
-#include "cfb8_32.h"
-#include "mistruct.h"
-#include "regionstr.h"
-#include "cfbmskbits.h"
-#include "mioverlay.h"
-
-
-/* We don't bother with cfb's fastBackground/Border so we don't
- need to use the Window privates */
-
-
-Bool
-cfb8_32CreateWindow(WindowPtr pWin)
-{
- pWin->drawable.bitsPerPixel = 32;
- return TRUE;
-}
-
-
-Bool
-cfb8_32DestroyWindow(WindowPtr pWin)
-{
- return TRUE;
-}
-
-Bool
-cfb8_32PositionWindow(
- WindowPtr pWin,
- int x, int y
-){
- return TRUE;
-}
-
-void
-cfb8_32CopyWindow(pWin, ptOldOrg, prgnSrc)
- WindowPtr pWin;
- DDXPointRec ptOldOrg;
- RegionPtr prgnSrc;
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- DDXPointPtr ppt, pptSrc;
- RegionRec rgnDst;
- RegionPtr borderClip = &pWin->borderClip;
- BoxPtr pbox;
- int dx, dy, i, nbox;
- WindowPtr pwinRoot;
- Bool doUnderlay = miOverlayCopyUnderlay(pScreen);
- Bool freeReg = FALSE;
-
- pwinRoot = WindowTable[pScreen->myNum];
-
- if(doUnderlay)
- freeReg = miOverlayCollectUnderlayRegions(pWin, &borderClip);
-
- REGION_NULL(pScreen, &rgnDst);
-
- dx = ptOldOrg.x - pWin->drawable.x;
- dy = ptOldOrg.y - pWin->drawable.y;
- REGION_TRANSLATE(pScreen, prgnSrc, -dx, -dy);
- REGION_INTERSECT(pScreen, &rgnDst, borderClip, prgnSrc);
-
- pbox = REGION_RECTS(&rgnDst);
- nbox = REGION_NUM_RECTS(&rgnDst);
- if(!nbox ||
- !(pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec))))
- {
- REGION_UNINIT(pScreen, &rgnDst);
- return;
- }
- ppt = pptSrc;
-
- for (i = nbox; --i >= 0; ppt++, pbox++)
- {
- ppt->x = pbox->x1 + dx;
- ppt->y = pbox->y1 + dy;
- }
-
- if(doUnderlay)
- cfbDoBitblt24To24GXcopy((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
- GXcopy, &rgnDst, pptSrc, ~0);
- else
- cfbDoBitblt8To8GXcopy((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
- GXcopy, &rgnDst, pptSrc, ~0);
-
- xfree(pptSrc);
- REGION_UNINIT(pScreen, &rgnDst);
- if(freeReg)
- REGION_DESTROY(pScreen, borderClip);
-}
-
-Bool
-cfb8_32ChangeWindowAttributes(
- WindowPtr pWin,
- unsigned long mask
-){
- return TRUE;
-}
-
-
-
-
diff --git a/hw/xfree86/xf8_32bpp/xf86overlay.c b/hw/xfree86/xf8_32bpp/xf86overlay.c
deleted file mode 100644
index c63b3cfd1..000000000
--- a/hw/xfree86/xf8_32bpp/xf86overlay.c
+++ /dev/null
@@ -1,1179 +0,0 @@
-
-/*
- Copyright (C) 1998. The XFree86 Project Inc.
-
- Written by Mark Vojkovich (mvojkovi@ucsd.edu)
-*/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "regionstr.h"
-#include "windowstr.h"
-#include "xf86str.h"
-#include "migc.h"
-#include "gcstruct.h"
-#include "pixmapstr.h"
-#include "colormapst.h"
-#include "cfb8_32.h"
-
-#define IS_DIRTY 1
-#define IS_SHARED 2
-
-/** Screen Functions **/
-
-static Bool OverlayCloseScreen (int, ScreenPtr);
-static Bool OverlayCreateGC(GCPtr pGC);
-static Bool OverlayDestroyPixmap(PixmapPtr);
-static PixmapPtr OverlayCreatePixmap(ScreenPtr, int, int, int, unsigned);
-static Bool OverlayChangeWindowAttributes(WindowPtr, unsigned long);
-
-/** Funcs **/
-static void OverlayValidateGC(GCPtr, unsigned long, DrawablePtr);
-static void OverlayChangeGC(GCPtr, unsigned long);
-static void OverlayCopyGC(GCPtr, unsigned long, GCPtr);
-static void OverlayDestroyGC(GCPtr);
-static void OverlayChangeClip(GCPtr, int, pointer, int);
-static void OverlayDestroyClip(GCPtr);
-static void OverlayCopyClip(GCPtr, GCPtr);
-
-
-static PixmapPtr OverlayRefreshPixmap(PixmapPtr);
-
-static GCFuncs OverlayGCFuncs = {
- OverlayValidateGC, OverlayChangeGC,
- OverlayCopyGC, OverlayDestroyGC,
- OverlayChangeClip, OverlayDestroyClip,
- OverlayCopyClip
-};
-
-
-/** Pixmap Ops */
-static void PixmapFillSpans(DrawablePtr, GCPtr, int, DDXPointPtr, int *,
- int);
-static void PixmapSetSpans(DrawablePtr, GCPtr, char *, DDXPointPtr,
- int *, int, int);
-static void PixmapPutImage(DrawablePtr, GCPtr, int, int, int, int, int,
- int, int, char *);
-static void PixmapPushPixels(GCPtr, PixmapPtr, DrawablePtr, int, int,
- int, int);
-static RegionPtr PixmapCopyArea(DrawablePtr, DrawablePtr, GCPtr, int, int,
- int, int, int, int);
-static RegionPtr PixmapCopyPlane(DrawablePtr, DrawablePtr, GCPtr, int, int,
- int, int, int, int, unsigned long);
-static void PixmapPolyPoint(DrawablePtr, GCPtr, int, int, xPoint *);
-static void PixmapPolylines(DrawablePtr, GCPtr, int, int, DDXPointPtr);
-static void PixmapPolySegment(DrawablePtr, GCPtr, int, xSegment *);
-static void PixmapPolyRectangle(DrawablePtr, GCPtr, int, xRectangle *);
-static void PixmapPolyArc(DrawablePtr, GCPtr, int, xArc *);
-static void PixmapFillPolygon(DrawablePtr, GCPtr, int, int, int,
- DDXPointPtr);
-static void PixmapPolyFillRect(DrawablePtr, GCPtr, int, xRectangle *);
-static void PixmapPolyFillArc(DrawablePtr, GCPtr, int, xArc *);
-static int PixmapPolyText8(DrawablePtr, GCPtr, int, int, int, char *);
-static int PixmapPolyText16(DrawablePtr, GCPtr, int, int, int,
- unsigned short *);
-static void PixmapImageText8(DrawablePtr, GCPtr, int, int, int, char *);
-static void PixmapImageText16(DrawablePtr, GCPtr, int, int, int,
- unsigned short *);
-static void PixmapImageGlyphBlt(DrawablePtr, GCPtr, int, int,
- unsigned int, CharInfoPtr *, pointer);
-static void PixmapPolyGlyphBlt(DrawablePtr, GCPtr, int, int,
- unsigned int, CharInfoPtr *, pointer);
-
-static GCOps PixmapGCOps = {
- PixmapFillSpans, PixmapSetSpans,
- PixmapPutImage, PixmapCopyArea,
- PixmapCopyPlane, PixmapPolyPoint,
- PixmapPolylines, PixmapPolySegment,
- PixmapPolyRectangle, PixmapPolyArc,
- PixmapFillPolygon, PixmapPolyFillRect,
- PixmapPolyFillArc, PixmapPolyText8,
- PixmapPolyText16, PixmapImageText8,
- PixmapImageText16, PixmapImageGlyphBlt,
- PixmapPolyGlyphBlt, PixmapPushPixels,
- {NULL} /* devPrivate */
-};
-
-
-/** Window Ops **/
-static void WindowFillSpans(DrawablePtr, GCPtr, int, DDXPointPtr, int *,
- int);
-static void WindowSetSpans(DrawablePtr, GCPtr, char *, DDXPointPtr,
- int *, int, int);
-static void WindowPutImage(DrawablePtr, GCPtr, int, int, int, int, int,
- int, int, char *);
-static void WindowPushPixels(GCPtr, PixmapPtr, DrawablePtr, int, int,
- int, int);
-static RegionPtr WindowCopyArea(DrawablePtr, DrawablePtr, GCPtr, int, int,
- int, int, int, int);
-static RegionPtr WindowCopyPlane(DrawablePtr, DrawablePtr, GCPtr, int, int,
- int, int, int, int, unsigned long);
-static void WindowPolyPoint(DrawablePtr, GCPtr, int, int, xPoint *);
-static void WindowPolylines(DrawablePtr, GCPtr, int, int, DDXPointPtr);
-static void WindowPolySegment(DrawablePtr, GCPtr, int, xSegment *);
-static void WindowPolyRectangle(DrawablePtr, GCPtr, int, xRectangle *);
-static void WindowPolyArc(DrawablePtr, GCPtr, int, xArc *);
-static void WindowFillPolygon(DrawablePtr, GCPtr, int, int, int,
- DDXPointPtr);
-static void WindowPolyFillRect(DrawablePtr, GCPtr, int, xRectangle *);
-static void WindowPolyFillArc(DrawablePtr, GCPtr, int, xArc *);
-static int WindowPolyText8(DrawablePtr, GCPtr, int, int, int, char *);
-static int WindowPolyText16(DrawablePtr, GCPtr, int, int, int,
- unsigned short *);
-static void WindowImageText8(DrawablePtr, GCPtr, int, int, int, char *);
-static void WindowImageText16(DrawablePtr, GCPtr, int, int, int,
- unsigned short *);
-static void WindowImageGlyphBlt(DrawablePtr, GCPtr, int, int,
- unsigned int, CharInfoPtr *, pointer);
-static void WindowPolyGlyphBlt(DrawablePtr, GCPtr, int, int,
- unsigned int, CharInfoPtr *, pointer);
-
-static GCOps WindowGCOps = {
- WindowFillSpans, WindowSetSpans,
- WindowPutImage, WindowCopyArea,
- WindowCopyPlane, WindowPolyPoint,
- WindowPolylines, WindowPolySegment,
- WindowPolyRectangle, WindowPolyArc,
- WindowFillPolygon, WindowPolyFillRect,
- WindowPolyFillArc, WindowPolyText8,
- WindowPolyText16, WindowImageText8,
- WindowImageText16, WindowImageGlyphBlt,
- WindowPolyGlyphBlt, WindowPushPixels,
- {NULL} /* devPrivate */
-};
-
-/** privates **/
-
-typedef struct {
- CloseScreenProcPtr CloseScreen;
- CreateGCProcPtr CreateGC;
- CreatePixmapProcPtr CreatePixmap;
- DestroyPixmapProcPtr DestroyPixmap;
- ChangeWindowAttributesProcPtr ChangeWindowAttributes;
- int LockPrivate;
-} OverlayScreenRec, *OverlayScreenPtr;
-
-typedef struct {
- GCFuncs *wrapFuncs;
- GCOps *wrapOps;
- GCOps *overlayOps;
- unsigned long fg;
- unsigned long bg;
- unsigned long pm;
- PixmapPtr tile;
-} OverlayGCRec, *OverlayGCPtr;
-
-typedef struct {
- PixmapPtr pix32;
- CARD32 dirty;
-} OverlayPixmapRec, *OverlayPixmapPtr;
-
-
-static DevPrivateKey OverlayScreenKey = &OverlayScreenKey;
-static DevPrivateKey OverlayGCKey = &OverlayGCKey;
-static DevPrivateKey OverlayPixmapKey = &OverlayPixmapKey;
-
-/** Macros **/
-
-#define TILE_EXISTS(pGC) (!(pGC)->tileIsPixel && (pGC)->tile.pixmap)
-
-#define OVERLAY_GET_PIXMAP_PRIVATE(pPix) ((OverlayPixmapPtr) \
- dixLookupPrivate(&(pPix)->devPrivates, OverlayPixmapKey))
-
-#define OVERLAY_GET_SCREEN_PRIVATE(pScreen) ((OverlayScreenPtr) \
- dixLookupPrivate(&(pScreen)->devPrivates, OverlayScreenKey))
-
-#define OVERLAY_GET_GC_PRIVATE(pGC) ((OverlayGCPtr) \
- dixLookupPrivate(&(pGC)->devPrivates, OverlayGCKey))
-
-#define OVERLAY_GC_FUNC_PROLOGUE(pGC)\
- OverlayGCPtr pGCPriv = OVERLAY_GET_GC_PRIVATE(pGC);\
- (pGC)->funcs = pGCPriv->wrapFuncs;\
- if(pGCPriv->overlayOps) \
- (pGC)->ops = pGCPriv->wrapOps
-
-#define OVERLAY_GC_FUNC_EPILOGUE(pGC)\
- pGCPriv->wrapFuncs = (pGC)->funcs;\
- (pGC)->funcs = &OverlayGCFuncs;\
- if(pGCPriv->overlayOps) { \
- pGCPriv->wrapOps = (pGC)->ops;\
- (pGC)->ops = pGCPriv->overlayOps;\
- }
-
-#define WINDOW_GC_OP_PROLOGUE(pGC)\
- OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE((pGC)->pScreen);\
- OverlayGCPtr pGCPriv = OVERLAY_GET_GC_PRIVATE(pGC);\
- unsigned long oldfg = (pGC)->fgPixel;\
- unsigned long oldbg = (pGC)->bgPixel;\
- unsigned long oldpm = (pGC)->planemask;\
- PixmapPtr oldtile = (pGC)->tile.pixmap;\
- (pGC)->fgPixel = pGCPriv->fg;\
- (pGC)->bgPixel = pGCPriv->bg;\
- (pGC)->planemask = pGCPriv->pm;\
- if(pGCPriv->tile) (pGC)->tile.pixmap = pGCPriv->tile;\
- (pGC)->funcs = pGCPriv->wrapFuncs;\
- (pGC)->ops = pGCPriv->wrapOps;\
- pScreenPriv->LockPrivate++
-
-
-#define WINDOW_GC_OP_EPILOGUE(pGC)\
- pGCPriv->wrapOps = (pGC)->ops;\
- pGCPriv->wrapFuncs = (pGC)->funcs;\
- (pGC)->fgPixel = oldfg;\
- (pGC)->bgPixel = oldbg;\
- (pGC)->planemask = oldpm;\
- (pGC)->tile.pixmap = oldtile;\
- (pGC)->funcs = &OverlayGCFuncs;\
- (pGC)->ops = &WindowGCOps;\
- pScreenPriv->LockPrivate--
-
-
-#define PIXMAP_GC_OP_PROLOGUE(pGC)\
- OverlayGCPtr pGCPriv = OVERLAY_GET_GC_PRIVATE(pGC);\
- OverlayPixmapPtr pPixPriv = OVERLAY_GET_PIXMAP_PRIVATE((PixmapPtr)pDraw);\
- pGC->funcs = pGCPriv->wrapFuncs;\
- pGC->ops = pGCPriv->wrapOps
-
-#define PIXMAP_GC_OP_EPILOGUE(pGC)\
- pGCPriv->wrapOps = pGC->ops;\
- pGC->funcs = &OverlayGCFuncs;\
- pGC->ops = &PixmapGCOps;\
- pPixPriv->dirty |= IS_DIRTY
-
-
-Bool
-xf86Overlay8Plus32Init (ScreenPtr pScreen)
-{
- OverlayScreenPtr pScreenPriv;
-
- if (!dixRequestPrivate(OverlayGCKey, sizeof(OverlayGCRec)))
- return FALSE;
-
- if (!dixRequestPrivate(OverlayPixmapKey, sizeof(OverlayPixmapRec)))
- return FALSE;
-
- if (!(pScreenPriv = xalloc(sizeof(OverlayScreenRec))))
- return FALSE;
-
- dixSetPrivate(&pScreen->devPrivates, OverlayScreenKey, pScreenPriv);
-
- pScreenPriv->CreateGC = pScreen->CreateGC;
- pScreenPriv->CloseScreen = pScreen->CloseScreen;
- pScreenPriv->CreatePixmap = pScreen->CreatePixmap;
- pScreenPriv->DestroyPixmap = pScreen->DestroyPixmap;
- pScreenPriv->ChangeWindowAttributes = pScreen->ChangeWindowAttributes;
-
- pScreen->CreateGC = OverlayCreateGC;
- pScreen->CloseScreen = OverlayCloseScreen;
- pScreen->CreatePixmap = OverlayCreatePixmap;
- pScreen->DestroyPixmap = OverlayDestroyPixmap;
- pScreen->ChangeWindowAttributes = OverlayChangeWindowAttributes;
-
- pScreenPriv->LockPrivate = 0;
-
- /* allocate the key in the default map */
- if(pScreen->defColormap) {
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- ColormapPtr pmap;
- xColorItem color;
-
- pmap = (ColormapPtr)LookupIDByType(pScreen->defColormap, RT_COLORMAP);
-
- pmap->red[pScrn->colorKey].refcnt = AllocPrivate;
- pmap->red[pScrn->colorKey].fShared = FALSE;
- pmap->freeRed--;
-
- color.red = color.blue = color.green = 0;
- color.pixel = pScrn->colorKey;
- color.flags = DoRed | DoGreen | DoBlue;
-
- StoreColors(pmap, 1, &color);
- }
-
- return TRUE;
-}
-
-
-/*********************** Screen Funcs ***********************/
-
-Bool
-OverlayCreateGC(GCPtr pGC)
-{
- ScreenPtr pScreen = pGC->pScreen;
- OverlayGCPtr pGCPriv = OVERLAY_GET_GC_PRIVATE(pGC);
- OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pScreen);
- Bool ret;
-
- pScreen->CreateGC = pScreenPriv->CreateGC;
-
- if((ret = (*pScreen->CreateGC)(pGC)) && (pGC->depth != 1)) {
- pGCPriv->wrapFuncs = pGC->funcs;
- pGC->funcs = &OverlayGCFuncs;
- pGCPriv->wrapOps = NULL;
- pGCPriv->overlayOps = NULL;
- pGCPriv->tile = NULL;
- }
-
- pScreen->CreateGC = OverlayCreateGC;
-
- return ret;
-}
-
-static PixmapPtr
-OverlayCreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
- unsigned usage_hint)
-{
- OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pScreen);
- PixmapPtr pPix;
-
- pScreen->CreatePixmap = pScreenPriv->CreatePixmap;
- pPix = (*pScreen->CreatePixmap) (pScreen, w, h, depth, usage_hint);
- pScreen->CreatePixmap = OverlayCreatePixmap;
-
- /* We initialize all the privates */
- if(pPix) {
- OverlayPixmapPtr pPriv = OVERLAY_GET_PIXMAP_PRIVATE(pPix);
- pPriv->pix32 = NULL;
- pPriv->dirty = IS_DIRTY;
- if(!w || !h)
- pPriv->dirty |= IS_SHARED;
- }
-
- return pPix;
-}
-
-static Bool
-OverlayDestroyPixmap(PixmapPtr pPix)
-{
- ScreenPtr pScreen = pPix->drawable.pScreen;
- OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pScreen);
- Bool result;
-
- pScreen->DestroyPixmap = pScreenPriv->DestroyPixmap;
-
- if((pPix->refcnt == 1) && (pPix->drawable.bitsPerPixel == 8)) {
- OverlayPixmapPtr pPriv = OVERLAY_GET_PIXMAP_PRIVATE(pPix);
- if(pPriv->pix32) {
- if(pPriv->pix32->refcnt != 1)
- ErrorF("Warning! private pix refcnt = %i\n", pPriv->pix32->refcnt);
- (*pScreen->DestroyPixmap)(pPriv->pix32);
- }
- pPriv->pix32 = NULL;
- }
-
- result = (*pScreen->DestroyPixmap) (pPix);
- pScreen->DestroyPixmap = OverlayDestroyPixmap;
-
- return result;
-}
-
-static Bool
-OverlayCloseScreen (int i, ScreenPtr pScreen)
-{
- OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pScreen);
-
- pScreen->CreateGC = pScreenPriv->CreateGC;
- pScreen->CloseScreen = pScreenPriv->CloseScreen;
- pScreen->CreatePixmap = pScreenPriv->CreatePixmap;
- pScreen->DestroyPixmap = pScreenPriv->DestroyPixmap;
- pScreen->ChangeWindowAttributes = pScreenPriv->ChangeWindowAttributes;
-
- xfree ((pointer) pScreenPriv);
-
- return (*pScreen->CloseScreen) (i, pScreen);
-}
-
-
-
-static Bool
-OverlayChangeWindowAttributes (WindowPtr pWin, unsigned long mask)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pScreen);
- Bool result;
-
- if(pWin->drawable.depth == 8) {
- if((mask & CWBackPixmap) &&
- (pWin->backgroundState == BackgroundPixmap))
- OverlayRefreshPixmap(pWin->background.pixmap);
-
- if((mask & CWBorderPixmap) && !pWin->borderIsPixel)
- OverlayRefreshPixmap(pWin->border.pixmap);
- }
-
- pScreen->ChangeWindowAttributes = pScreenPriv->ChangeWindowAttributes;
- result = (*pScreen->ChangeWindowAttributes) (pWin, mask);
- pScreen->ChangeWindowAttributes = OverlayChangeWindowAttributes;
-
- return result;
-}
-
-/*********************** GC Funcs *****************************/
-
-
-static PixmapPtr
-OverlayRefreshPixmap(PixmapPtr pix8)
-{
- OverlayPixmapPtr pixPriv = OVERLAY_GET_PIXMAP_PRIVATE(pix8);
- ScreenPtr pScreen = pix8->drawable.pScreen;
-
- if(!pixPriv->pix32) {
- PixmapPtr newPix;
-
- newPix = (*pScreen->CreatePixmap)(pScreen, pix8->drawable.width,
- pix8->drawable.height, 24, 0);
- newPix->drawable.depth = 8; /* Bad Mark! Bad Mark! */
- pixPriv->pix32 = newPix;
- }
-
- if(pixPriv->dirty) {
- OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pScreen);
- GCPtr pGC;
-
- pGC = GetScratchGC(8, pScreen);
-
- pScreenPriv->LockPrivate++; /* don't modify this one */
- ValidateGC((DrawablePtr)pixPriv->pix32, pGC);
-
- (*pGC->ops->CopyArea)((DrawablePtr)pix8, (DrawablePtr)pixPriv->pix32,
- pGC, 0, 0, pix8->drawable.width, pix8->drawable.height, 0, 0);
- pScreenPriv->LockPrivate--;
- FreeScratchGC(pGC);
-
- pixPriv->dirty &= ~IS_DIRTY;
- pixPriv->pix32->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- }
-
- return pixPriv->pix32;
-}
-
-
-static void
-OverlayValidateGC(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw
-){
- OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pGC->pScreen);
- OVERLAY_GC_FUNC_PROLOGUE (pGC);
-
- if(pScreenPriv->LockPrivate < 0) {
- ErrorF("Something is wrong in OverlayValidateGC!\n");
- pScreenPriv->LockPrivate = 0;
- }
-
- if(pGC->depth == 24) {
- unsigned long oldpm = pGC->planemask;
- pGCPriv->overlayOps = NULL;
-
- if(pDraw->type == DRAWABLE_WINDOW)
- pGC->planemask &= 0x00ffffff;
- else
- pGC->planemask |= 0xff000000;
-
- if(oldpm != pGC->planemask) changes |= GCPlaneMask;
-
- (*pGC->funcs->ValidateGC)(pGC, changes, pDraw);
-
- } else { /* depth == 8 */
- unsigned long newChanges = 0;
-
- if(pDraw->bitsPerPixel == 32) {
-
- if(pGC->fillStyle == FillTiled)
- pGCPriv->tile = OverlayRefreshPixmap(pGC->tile.pixmap);
- else pGCPriv->tile = NULL;
-
- if(pGCPriv->overlayOps != &WindowGCOps) {
- newChanges = GCForeground | GCBackground | GCPlaneMask;
- if(pGCPriv->tile)
- newChanges |= GCTile;
- }
- pGCPriv->overlayOps = &WindowGCOps;
-
- if(!pScreenPriv->LockPrivate) {
- unsigned long oldfg = pGC->fgPixel;
- unsigned long oldbg = pGC->bgPixel;
- unsigned long oldpm = pGC->planemask;
- PixmapPtr oldtile = pGC->tile.pixmap;
-
- pGC->fgPixel = pGCPriv->fg = oldfg << 24;
- pGC->bgPixel = pGCPriv->bg = oldbg << 24;
- pGC->planemask = pGCPriv->pm = oldpm << 24;
- if(pGCPriv->tile)
- pGC->tile.pixmap = pGCPriv->tile;
-
- (*pGC->funcs->ValidateGC)(pGC, changes | newChanges, pDraw);
-
- pGC->fgPixel = oldfg;
- pGC->bgPixel = oldbg;
- pGC->planemask = oldpm;
- pGC->tile.pixmap = oldtile;
- } else {
- pGCPriv->fg = pGC->fgPixel;
- pGCPriv->bg = pGC->bgPixel;
- pGCPriv->pm = pGC->planemask;
-
- (*pGC->funcs->ValidateGC)(pGC, changes | newChanges, pDraw);
- }
-
- } else { /* bitsPerPixel == 8 */
- if(pGCPriv->overlayOps == &WindowGCOps) {
- newChanges = GCForeground | GCBackground | GCPlaneMask;
- if(pGCPriv->tile)
- newChanges |= GCTile;
- }
- pGCPriv->overlayOps = &PixmapGCOps;
-
- (*pGC->funcs->ValidateGC)(pGC, changes | newChanges, pDraw);
- }
- }
-
- OVERLAY_GC_FUNC_EPILOGUE (pGC);
-}
-
-
-static void
-OverlayDestroyGC(GCPtr pGC)
-{
- OVERLAY_GC_FUNC_PROLOGUE (pGC);
- (*pGC->funcs->DestroyGC)(pGC);
- OVERLAY_GC_FUNC_EPILOGUE (pGC);
-}
-
-static void
-OverlayChangeGC (
- GCPtr pGC,
- unsigned long mask
-){
- OVERLAY_GC_FUNC_PROLOGUE (pGC);
- (*pGC->funcs->ChangeGC) (pGC, mask);
- OVERLAY_GC_FUNC_EPILOGUE (pGC);
-}
-
-static void
-OverlayCopyGC (
- GCPtr pGCSrc,
- unsigned long mask,
- GCPtr pGCDst
-){
- OVERLAY_GC_FUNC_PROLOGUE (pGCDst);
- (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
- OVERLAY_GC_FUNC_EPILOGUE (pGCDst);
-}
-static void
-OverlayChangeClip (
- GCPtr pGC,
- int type,
- pointer pvalue,
- int nrects
-){
- OVERLAY_GC_FUNC_PROLOGUE (pGC);
- (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
- OVERLAY_GC_FUNC_EPILOGUE (pGC);
-}
-
-static void
-OverlayCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
-{
- OVERLAY_GC_FUNC_PROLOGUE (pgcDst);
- (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
- OVERLAY_GC_FUNC_EPILOGUE (pgcDst);
-}
-
-static void
-OverlayDestroyClip(GCPtr pGC)
-{
- OVERLAY_GC_FUNC_PROLOGUE (pGC);
- (* pGC->funcs->DestroyClip)(pGC);
- OVERLAY_GC_FUNC_EPILOGUE (pGC);
-}
-
-
-
-/******************* Window GC ops ***********************/
-
-static void
-WindowFillSpans(
- DrawablePtr pDraw,
- GC *pGC,
- int nInit,
- DDXPointPtr pptInit,
- int *pwidthInit,
- int fSorted
-){
- WINDOW_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted);
- WINDOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-WindowSetSpans(
- DrawablePtr pDraw,
- GCPtr pGC,
- char *pcharsrc,
- register DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- int fSorted
-){
- WINDOW_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, ppt, pwidth, nspans, fSorted);
- WINDOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-WindowPutImage(
- DrawablePtr pDraw,
- GCPtr pGC,
- int depth,
- int x, int y, int w, int h,
- int leftPad,
- int format,
- char *pImage
-){
- WINDOW_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PutImage)(pDraw, pGC, depth, x, y, w, h,
- leftPad, format, pImage);
- WINDOW_GC_OP_EPILOGUE(pGC);
-}
-
-static RegionPtr
-WindowCopyArea(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GC *pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty
-){
- RegionPtr ret;
-
- WINDOW_GC_OP_PROLOGUE(pGC);
- ret = (*pGC->ops->CopyArea)(pSrc, pDst,
- pGC, srcx, srcy, width, height, dstx, dsty);
- WINDOW_GC_OP_EPILOGUE(pGC);
- return ret;
-}
-
-static RegionPtr
-WindowCopyPlane(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty,
- unsigned long bitPlane
-){
- RegionPtr ret;
-
- WINDOW_GC_OP_PROLOGUE(pGC);
- ret = (*pGC->ops->CopyPlane)(pSrc, pDst,
- pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
- WINDOW_GC_OP_EPILOGUE(pGC);
- return ret;
-}
-
-static void
-WindowPolyPoint(
- DrawablePtr pDraw,
- GCPtr pGC,
- int mode,
- int npt,
- xPoint *pptInit
-){
- WINDOW_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PolyPoint)(pDraw, pGC, mode, npt, pptInit);
- WINDOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-WindowPolylines(
- DrawablePtr pDraw,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr pptInit
-){
- WINDOW_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->Polylines)(pDraw, pGC, mode, npt, pptInit);
- WINDOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-WindowPolySegment(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nseg,
- xSegment *pSeg
-){
- WINDOW_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PolySegment)(pDraw, pGC, nseg, pSeg);
- WINDOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-WindowPolyRectangle(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nRectsInit,
- xRectangle *pRectsInit
-){
- WINDOW_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PolyRectangle)(pDraw, pGC, nRectsInit, pRectsInit);
- WINDOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-WindowPolyArc(
- DrawablePtr pDraw,
- GCPtr pGC,
- int narcs,
- xArc *parcs
-){
- WINDOW_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PolyArc)(pDraw, pGC, narcs, parcs);
- WINDOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-WindowFillPolygon(
- DrawablePtr pDraw,
- GCPtr pGC,
- int shape,
- int mode,
- int count,
- DDXPointPtr ptsIn
-){
- WINDOW_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, ptsIn);
- WINDOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-WindowPolyFillRect(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nrectFill,
- xRectangle *prectInit
-){
- WINDOW_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PolyFillRect)(pDraw, pGC, nrectFill, prectInit);
- WINDOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-WindowPolyFillArc(
- DrawablePtr pDraw,
- GCPtr pGC,
- int narcs,
- xArc *parcs
-){
- WINDOW_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PolyFillArc)(pDraw, pGC, narcs, parcs);
- WINDOW_GC_OP_EPILOGUE(pGC);
-}
-
-static int
-WindowPolyText8(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- char *chars
-){
- int ret;
-
- WINDOW_GC_OP_PROLOGUE(pGC);
- ret = (*pGC->ops->PolyText8)(pDraw, pGC, x, y, count, chars);
- WINDOW_GC_OP_EPILOGUE(pGC);
- return ret;
-}
-
-static int
-WindowPolyText16(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- unsigned short *chars
-){
- int ret;
-
- WINDOW_GC_OP_PROLOGUE(pGC);
- ret = (*pGC->ops->PolyText16)(pDraw, pGC, x, y, count, chars);
- WINDOW_GC_OP_EPILOGUE(pGC);
- return ret;
-}
-
-static void
-WindowImageText8(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- char *chars
-){
- WINDOW_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->ImageText8)(pDraw, pGC, x, y, count, chars);
- WINDOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-WindowImageText16(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- unsigned short *chars
-){
- WINDOW_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->ImageText16)(pDraw, pGC, x, y, count, chars);
- WINDOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-WindowImageGlyphBlt(
- DrawablePtr pDraw,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase
-){
- WINDOW_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph,
- ppci, pglyphBase);
- WINDOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-WindowPolyGlyphBlt(
- DrawablePtr pDraw,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase
-){
- WINDOW_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph,
- ppci, pglyphBase);
- WINDOW_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-WindowPushPixels(
- GCPtr pGC,
- PixmapPtr pBitMap,
- DrawablePtr pDraw,
- int dx, int dy, int xOrg, int yOrg
-){
- WINDOW_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PushPixels)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
- WINDOW_GC_OP_EPILOGUE(pGC);
-}
-
-
-/******************* Pixmap GC ops ***********************/
-
-static void
-PixmapFillSpans(
- DrawablePtr pDraw,
- GC *pGC,
- int nInit,
- DDXPointPtr pptInit,
- int *pwidthInit,
- int fSorted
-){
- PIXMAP_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted);
- PIXMAP_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-PixmapSetSpans(
- DrawablePtr pDraw,
- GCPtr pGC,
- char *pcharsrc,
- register DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- int fSorted
-){
- PIXMAP_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, ppt, pwidth, nspans, fSorted);
- PIXMAP_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-PixmapPutImage(
- DrawablePtr pDraw,
- GCPtr pGC,
- int depth,
- int x, int y, int w, int h,
- int leftPad,
- int format,
- char *pImage
-){
- PIXMAP_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PutImage)(pDraw, pGC, depth, x, y, w, h,
- leftPad, format, pImage);
- PIXMAP_GC_OP_EPILOGUE(pGC);
-}
-
-static RegionPtr
-PixmapCopyArea(
- DrawablePtr pSrc,
- DrawablePtr pDraw,
- GC *pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty
-){
- RegionPtr ret;
-
- PIXMAP_GC_OP_PROLOGUE(pGC);
- ret = (*pGC->ops->CopyArea)(pSrc, pDraw,
- pGC, srcx, srcy, width, height, dstx, dsty);
- PIXMAP_GC_OP_EPILOGUE(pGC);
- return ret;
-}
-
-static RegionPtr
-PixmapCopyPlane(
- DrawablePtr pSrc,
- DrawablePtr pDraw,
- GCPtr pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty,
- unsigned long bitPlane
-){
- RegionPtr ret;
-
- PIXMAP_GC_OP_PROLOGUE(pGC);
- ret = (*pGC->ops->CopyPlane)(pSrc, pDraw,
- pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
- PIXMAP_GC_OP_EPILOGUE(pGC);
- return ret;
-}
-
-static void
-PixmapPolyPoint(
- DrawablePtr pDraw,
- GCPtr pGC,
- int mode,
- int npt,
- xPoint *pptInit
-){
- PIXMAP_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PolyPoint)(pDraw, pGC, mode, npt, pptInit);
- PIXMAP_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-PixmapPolylines(
- DrawablePtr pDraw,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr pptInit
-){
- PIXMAP_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->Polylines)(pDraw, pGC, mode, npt, pptInit);
- PIXMAP_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-PixmapPolySegment(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nseg,
- xSegment *pSeg
-){
- PIXMAP_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PolySegment)(pDraw, pGC, nseg, pSeg);
- PIXMAP_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-PixmapPolyRectangle(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nRectsInit,
- xRectangle *pRectsInit
-){
- PIXMAP_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PolyRectangle)(pDraw, pGC, nRectsInit, pRectsInit);
- PIXMAP_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-PixmapPolyArc(
- DrawablePtr pDraw,
- GCPtr pGC,
- int narcs,
- xArc *parcs
-){
- PIXMAP_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PolyArc)(pDraw, pGC, narcs, parcs);
- PIXMAP_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-PixmapFillPolygon(
- DrawablePtr pDraw,
- GCPtr pGC,
- int shape,
- int mode,
- int count,
- DDXPointPtr ptsIn
-){
- PIXMAP_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, ptsIn);
- PIXMAP_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-PixmapPolyFillRect(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nrectFill,
- xRectangle *prectInit
-){
- PIXMAP_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PolyFillRect)(pDraw, pGC, nrectFill, prectInit);
- PIXMAP_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-PixmapPolyFillArc(
- DrawablePtr pDraw,
- GCPtr pGC,
- int narcs,
- xArc *parcs
-){
- PIXMAP_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PolyFillArc)(pDraw, pGC, narcs, parcs);
- PIXMAP_GC_OP_EPILOGUE(pGC);
-}
-
-static int
-PixmapPolyText8(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- char *chars
-){
- int ret;
-
- PIXMAP_GC_OP_PROLOGUE(pGC);
- ret = (*pGC->ops->PolyText8)(pDraw, pGC, x, y, count, chars);
- PIXMAP_GC_OP_EPILOGUE(pGC);
- return ret;
-}
-
-static int
-PixmapPolyText16(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- unsigned short *chars
-){
- int ret;
-
- PIXMAP_GC_OP_PROLOGUE(pGC);
- ret = (*pGC->ops->PolyText16)(pDraw, pGC, x, y, count, chars);
- PIXMAP_GC_OP_EPILOGUE(pGC);
- return ret;
-}
-
-static void
-PixmapImageText8(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- char *chars
-){
- PIXMAP_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->ImageText8)(pDraw, pGC, x, y, count, chars);
- PIXMAP_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-PixmapImageText16(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- unsigned short *chars
-){
- PIXMAP_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->ImageText16)(pDraw, pGC, x, y, count, chars);
- PIXMAP_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-PixmapImageGlyphBlt(
- DrawablePtr pDraw,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase
-){
- PIXMAP_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph,
- ppci, pglyphBase);
- PIXMAP_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-PixmapPolyGlyphBlt(
- DrawablePtr pDraw,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase
-){
- PIXMAP_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph,
- ppci, pglyphBase);
- PIXMAP_GC_OP_EPILOGUE(pGC);
-}
-
-static void
-PixmapPushPixels(
- GCPtr pGC,
- PixmapPtr pBitMap,
- DrawablePtr pDraw,
- int dx, int dy, int xOrg, int yOrg
-){
- PIXMAP_GC_OP_PROLOGUE(pGC);
- (*pGC->ops->PushPixels)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
- PIXMAP_GC_OP_EPILOGUE(pGC);
-}
-
-
diff --git a/hw/xgl/egl/kinput.c b/hw/xgl/egl/kinput.c
index 774e00eb5..f892dc173 100644
--- a/hw/xgl/egl/kinput.c
+++ b/hw/xgl/egl/kinput.c
@@ -977,7 +977,7 @@ KdClassifyInput (KdMouseInfo *mi, xEvent *ev)
return keyboard;
}
-#ifndef NDEBUG
+#ifdef DEBUG
char *kdStateNames[] = {
"start",
"button_1_pend",
@@ -1010,7 +1010,7 @@ char *kdActionNames[] = {
"gen_down_2",
"gen_up_2",
};
-#endif
+#endif /* DEBUG */
static void
KdQueueEvent (xEvent *ev)
diff --git a/hw/xnest/Args.c b/hw/xnest/Args.c
index f061f9e80..209f175ab 100644
--- a/hw/xnest/Args.c
+++ b/hw/xnest/Args.c
@@ -57,11 +57,6 @@ void ddxInitGlobals(void)
extern Bool noCompositeExtension;
noCompositeExtension = TRUE;
#endif
-
-#ifdef XKB
- extern Bool noXkbExtension;
- noXkbExtension = TRUE;
-#endif
}
int
diff --git a/hw/xprint/Makefile.am b/hw/xprint/Makefile.am
index 1b8004841..2ed7aaf57 100644
--- a/hw/xprint/Makefile.am
+++ b/hw/xprint/Makefile.am
@@ -3,7 +3,7 @@ SUBDIRS = doc pcl pcl-mono raster ps etc config
bin_PROGRAMS = Xprt
Xprt_CFLAGS = @DIX_CFLAGS@ @XPRINT_CFLAGS@ \
- -DXPRINT -DPRINT_ONLY_SERVER -D_XP_PRINT_SERVER_ \
+ -DPRINT_ONLY_SERVER -D_XP_PRINT_SERVER_ \
-DXPRINTDIR=\"$(libdir)/X11/xserver\" \
-DXPRASTERDDX -DXPPCLDDX -DXPMONOPCLDDX -DXPPSDDX \
-DXFree86Server
@@ -17,6 +17,7 @@ XPRINT_LIBS = \
pcl-mono/libpcl.la \
$(top_builddir)/fb/libfb.la \
$(top_builddir)/render/librender.la \
+ $(top_builddir)/dix/libXpdix.la \
$(XSERVER_LIBS) \
$(top_builddir)/Xext/libXext.la \
$(top_builddir)/xkb/libxkb.la \
diff --git a/hw/xprint/ps/psout.h b/hw/xprint/ps/psout.h
index 3e19d5a67..1138e4afe 100644
--- a/hw/xprint/ps/psout.h
+++ b/hw/xprint/ps/psout.h
@@ -169,7 +169,7 @@ typedef signed __int64 PsOutColor;
defined(ia64) || defined(__ia64__) || \
defined(__sparc64__) || defined(_LP64) || \
defined(__s390x__) || \
- defined(amd64) || defined (__amd64__) || \
+ defined(amd64) || defined (__amd64__) || defined(__x86_64__) || \
defined (__powerpc64__) || \
(defined(sgi) && (_MIPS_SZLONG == 64))
typedef signed long PsOutColor;
diff --git a/hw/xquartz/Makefile.am b/hw/xquartz/Makefile.am
index 075382476..1c97ac8f2 100644
--- a/hw/xquartz/Makefile.am
+++ b/hw/xquartz/Makefile.am
@@ -25,7 +25,6 @@ libXquartz_la_SOURCES = \
applewm.c \
darwin.c \
darwinEvents.c \
- darwinKeyboard.c \
darwinXinput.c \
keysym2ucs.c \
pseudoramiX.c \
@@ -35,7 +34,8 @@ libXquartz_la_SOURCES = \
quartzForeground.c \
quartzKeyboard.c \
quartzPasteboard.c \
- quartzStartup.c
+ quartzStartup.c \
+ threadSafety.c
EXTRA_DIST = \
X11Application.h \
@@ -44,7 +44,6 @@ EXTRA_DIST = \
darwinClut8.h \
darwin.h \
darwinEvents.h \
- darwinKeyboard.h \
keysym2ucs.h \
pseudoramiX.h \
quartz.h \
@@ -52,4 +51,5 @@ EXTRA_DIST = \
quartzCommon.h \
quartzForeground.h \
quartzKeyboard.h \
- quartzPasteboard.h
+ quartzPasteboard.h \
+ threadSafety.h
diff --git a/hw/xquartz/X11Application.h b/hw/xquartz/X11Application.h
index ea9a6b758..47c605c67 100644
--- a/hw/xquartz/X11Application.h
+++ b/hw/xquartz/X11Application.h
@@ -32,7 +32,6 @@
#if __OBJC__
-#import <Cocoa/Cocoa.h>
#import "X11Controller.h"
@interface X11Application : NSApplication {
@@ -56,7 +55,7 @@
- (void) prefs_set_string:(NSString *)key value:(NSString *)value;
- (void) prefs_synchronize;
-- (BOOL) x_active;
+- (OSX_BOOL) x_active;
@end
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 2844fca10..265819af6 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -27,34 +27,26 @@
promote the sale, use or other dealings in this Software without
prior written authorization. */
+#include "sanitizedCarbon.h"
+
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
-#include "quartzCommon.h"
#include "quartzForeground.h"
-
+#include "quartzCommon.h"
#import "X11Application.h"
-#include <Carbon/Carbon.h>
-/* ouch! */
-#define BOOL X_BOOL
# include "darwin.h"
# include "darwinEvents.h"
# include "quartz.h"
# define _APPLEWM_SERVER_
# include "X11/extensions/applewm.h"
# include "micmap.h"
-#undef BOOL
-
#include <mach/mach.h>
#include <unistd.h>
#include <pthread.h>
-#include "rootlessCommon.h"
-
-WindowPtr xprGetXWindowFromAppKit(int windowNumber); // xpr/xprFrame.c
-
#define DEFAULTS_FILE "/usr/X11/lib/X11/xserver/Xquartz.plist"
int X11EnableKeyEquivalents = TRUE;
@@ -159,7 +151,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
[self orderFrontStandardAboutPanelWithOptions: dict];
}
-- (void) activateX:(BOOL)state {
+- (void) activateX:(OSX_BOOL)state {
/* Create a TSM document that supports full Unicode input, and
have it activated while X is active (unless using the old
keymapping files) */
@@ -193,7 +185,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
- (void) sendEvent:(NSEvent *)e {
NSEventType type;
- BOOL for_appkit, for_x;
+ OSX_BOOL for_appkit, for_x;
type = [e type];
@@ -210,8 +202,6 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
if (_x_active) [self activateX:NO];
} else if ([self modalWindow] == nil) {
/* Must be an X window. Tell appkit it doesn't have focus. */
- WindowPtr pWin = xprGetXWindowFromAppKit([e windowNumber]);
- if (pWin) RootlessReorderWindow(pWin);
for_appkit = NO;
if ([self isActive]) {
@@ -244,9 +234,6 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
|| [e keyCode] == 53 /*Esc*/)) {
swallow_up = 0;
for_x = NO;
-#ifdef DARWIN_DDX_MISSING
- DarwinSendDDXEvent(kXquartzToggleFullscreen, 0);
-#endif
}
} else {
/* If we saw a key equivalent on the down, don't pass
@@ -277,7 +264,8 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
_appFlags._active = YES;
[self activateX:YES];
- if ([e data2] & 0x10) X11ApplicationSetFrontProcess();
+ if ([e data2] & 0x10)
+ DarwinSendDDXEvent(kXquartzBringAllToFront, 0);
}
break;
@@ -647,8 +635,8 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
if(darwinDesiredDepth == 8)
darwinDesiredDepth = -1;
- enable_stereo = [self prefs_get_boolean:@PREFS_ENABLE_STEREO
- default:false];
+// enable_stereo = [self prefs_get_boolean:@PREFS_ENABLE_STEREO
+// default:false];
}
/* This will end up at the end of the responder chain. */
@@ -657,7 +645,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
AppleWMCopyToPasteboard);
}
-- (BOOL) x_active {
+- (OSX_BOOL) x_active {
return _x_active;
}
@@ -744,7 +732,7 @@ void X11ApplicationShowHideMenubar (int state) {
[n release];
}
-static void * create_thread (void *func, void *arg) {
+static pthread_t create_thread (void *func, void *arg) {
pthread_attr_t attr;
pthread_t tid;
@@ -754,7 +742,7 @@ static void * create_thread (void *func, void *arg) {
pthread_create (&tid, &attr, func, arg);
pthread_attr_destroy (&attr);
- return (void *) tid;
+ return tid;
}
static void check_xinitrc (void) {
@@ -825,7 +813,10 @@ void X11ApplicationMain (int argc, const char **argv, void (*server_thread) (voi
aquaMenuBarHeight = NSHeight([[NSScreen mainScreen] frame]) -
NSMaxY([[NSScreen mainScreen] visibleFrame]);
- if (!create_thread (server_thread, server_arg)) {
+ APPKIT_THREAD = pthread_self();
+ SERVER_THREAD = create_thread (server_thread, server_arg);
+
+ if (!SERVER_THREAD) {
ErrorF("can't create secondary thread\n");
exit (1);
}
@@ -905,7 +896,7 @@ static void send_nsevent (NSEventType type, NSEvent *e) {
break;
case NSScrollWheel:
- DarwinSendScrollEvents([e deltaY], pointer_x, pointer_y,
+ DarwinSendScrollEvents([e deltaX], [e deltaY], pointer_x, pointer_y,
pressure, tilt_x, tilt_y);
break;
diff --git a/hw/xquartz/X11Controller.h b/hw/xquartz/X11Controller.h
index 8d6a38ff0..c5994bd1f 100644
--- a/hw/xquartz/X11Controller.h
+++ b/hw/xquartz/X11Controller.h
@@ -32,7 +32,7 @@
#if __OBJC__
-#import <Cocoa/Cocoa.h>
+#include "sanitizedCocoa.h"
#include "xpr/x-list.h"
@interface X11Controller : NSObject
@@ -67,14 +67,14 @@
int checked_window_item;
x_list *pending_apps;
- BOOL finished_launching;
- BOOL can_quit;
+ OSX_BOOL finished_launching;
+ OSX_BOOL can_quit;
}
- (void) set_window_menu:(NSArray *)list;
- (void) set_window_menu_check:(NSNumber *)n;
- (void) set_apps_menu:(NSArray *)list;
-- (void) set_can_quit:(BOOL)state;
+- (void) set_can_quit:(OSX_BOOL)state;
- (void) server_ready;
- (IBAction) apps_table_show:(id)sender;
diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m
index 5bf4f4d52..8dfe4b342 100644
--- a/hw/xquartz/X11Controller.m
+++ b/hw/xquartz/X11Controller.m
@@ -27,6 +27,8 @@
promote the sale, use or other dealings in this Software without
prior written authorization. */
+#include "sanitizedCarbon.h"
+
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -37,17 +39,13 @@
#import "X11Controller.h"
#import "X11Application.h"
-#import <Carbon/Carbon.h>
-/* ouch! */
-#define BOOL X_BOOL
#include "opaque.h"
-# include "darwin.h"
-# include "quartz.h"
-# define _APPLEWM_SERVER_
-# include "X11/extensions/applewm.h"
-# include "applewmExt.h"
-#undef BOOL
+#include "darwin.h"
+#include "quartz.h"
+#define _APPLEWM_SERVER_
+#include "X11/extensions/applewm.h"
+#include "applewmExt.h"
#include <stdio.h>
#include <unistd.h>
@@ -602,7 +600,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
#endif
}
-- (void) set_can_quit:(BOOL)state
+- (void) set_can_quit:(OSX_BOOL)state
{
can_quit = state;
}
@@ -669,7 +667,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
AHLookupAnchor ((CFStringRef)NSLocalizedString(@"Mac Help", no comment), CFSTR ("mchlp2276"));
}
-- (BOOL) validateMenuItem:(NSMenuItem *)item
+- (OSX_BOOL) validateMenuItem:(NSMenuItem *)item
{
NSMenu *menu = [item menu];
@@ -692,24 +690,26 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMShowAll);
}
-- (NSApplicationTerminateReply) applicationShouldTerminate:sender
-{
- NSString *msg;
+- (NSApplicationTerminateReply) applicationShouldTerminate:sender {
+ NSString *msg;
+ NSString *title;
- if (can_quit || [X11App prefs_get_boolean:@PREFS_NO_QUIT_ALERT default:NO])
- return NSTerminateNow;
+ if (can_quit || [X11App prefs_get_boolean:@PREFS_NO_QUIT_ALERT default:NO])
+ return NSTerminateNow;
- /* Make sure we're frontmost. */
- [NSApp activateIgnoringOtherApps:YES];
+ /* Make sure we're frontmost. */
+ [NSApp activateIgnoringOtherApps:YES];
- msg = NSLocalizedString (@"Are you sure you want to quit X11?\n\nIf you quit X11, any X11 applications you are running will stop immediately and you will lose any changes you have not saved.", @"Dialog when quitting");
-
- /* FIXME: safe to run the alert in here? Or should we return Later
- and then run the alert on a timer? It seems to work here, so.. */
+ title = NSLocalizedString(@"Do you really want to quit X11?", @"Dialog title when quitting");
+ msg = NSLocalizedString(@"Any open X11 applications will stop immediately, and you will lose any unsaved changes.", @"Dialog when quitting");
+
+ /* FIXME: safe to run the alert in here? Or should we return Later
+ * and then run the alert on a timer? It seems to work here, so..
+ */
- return (NSRunAlertPanel (nil, msg, NSLocalizedString (@"Quit", @""),
- NSLocalizedString (@"Cancel", @""), nil)
- == NSAlertDefaultReturn) ? NSTerminateNow : NSTerminateCancel;
+ return (NSRunAlertPanel (title, msg, NSLocalizedString (@"Quit", @""),
+ NSLocalizedString (@"Cancel", @""), nil)
+ == NSAlertDefaultReturn) ? NSTerminateNow : NSTerminateCancel;
}
- (void) applicationWillTerminate:(NSNotification *)aNotification
@@ -741,17 +741,17 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
pending_apps = NULL;
}
-- (BOOL) application:(NSApplication *)app openFile:(NSString *)filename
+- (OSX_BOOL) application:(NSApplication *)app openFile:(NSString *)filename
{
- const char *name = [filename UTF8String];
-
- if (finished_launching)
- [self launch_client:filename];
- else if (name[0] != ':') /* ignore display names */
- pending_apps = x_list_prepend (pending_apps, [filename retain]);
-
- /* FIXME: report failures. */
- return YES;
+ const char *name = [filename UTF8String];
+
+ if (finished_launching)
+ [self launch_client:filename];
+ else if (name[0] != ':') /* ignore display names */
+ pending_apps = x_list_prepend (pending_apps, [filename retain]);
+
+ /* FIXME: report failures. */
+ return YES;
}
@end
diff --git a/hw/xquartz/applewm.c b/hw/xquartz/applewm.c
index 072e57ff4..ba86f1045 100644
--- a/hw/xquartz/applewm.c
+++ b/hw/xquartz/applewm.c
@@ -25,6 +25,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
+#include "sanitizedCarbon.h"
+
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 002ea413d..aad55fc64 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -76,7 +76,7 @@
#include "darwin.h"
#include "darwinEvents.h"
-#include "darwinKeyboard.h"
+#include "quartzKeyboard.h"
#include "quartz.h"
//#include "darwinClut8.h"
@@ -142,6 +142,8 @@ const int NUMFORMATS = sizeof(formats)/sizeof(formats[0]);
#define XORG_RELEASE "?"
#endif
+const char *__crashreporter_info__ = "X.Org X Server " XSERVER_VERSION "Build Date: " BUILD_DATE;
+
void DDXRingBell(int volume, int pitch, int duration) {
// FIXME -- make some noise, yo
}
@@ -333,42 +335,34 @@ static void DarwinChangePointerControl(
* DarwinMouseProc
* Handle the initialization, etc. of a mouse
*/
-static int DarwinMouseProc(
- DeviceIntPtr pPointer,
- int what )
-{
- CARD8 map[6];
-
+static int DarwinMouseProc(DeviceIntPtr pPointer, int what) {
+ CARD8 map[8] = {0, 1, 2, 3, 4, 5, 6, 7};
+
switch (what) {
-
+
case DEVICE_INIT:
pPointer->public.on = FALSE;
-
+
// Set button map.
- map[1] = 1;
- map[2] = 2;
- map[3] = 3;
- map[4] = 4;
- map[5] = 5;
- InitPointerDeviceStruct( (DevicePtr)pPointer, map, 5,
- GetMotionHistory,
- (PtrCtrlProcPtr)NoopDDA,
- GetMotionHistorySize(), 5);
- InitProximityClassDeviceStruct( (DevicePtr)pPointer);
+ InitPointerDeviceStruct((DevicePtr)pPointer, map, 7,
+ GetMotionHistory,
+ (PtrCtrlProcPtr)NoopDDA,
+ GetMotionHistorySize(), 7);
+ InitProximityClassDeviceStruct(pPointer);
break;
-
+
case DEVICE_ON:
pPointer->public.on = TRUE;
AddEnabledDevice( darwinEventReadFD );
return Success;
-
+
case DEVICE_CLOSE:
case DEVICE_OFF:
pPointer->public.on = FALSE;
- RemoveEnabledDevice( darwinEventReadFD );
+ RemoveEnabledDevice(darwinEventReadFD);
return Success;
}
-
+
return Success;
}
diff --git a/hw/xquartz/darwin.h b/hw/xquartz/darwin.h
index df92d8b49..3231077be 100644
--- a/hw/xquartz/darwin.h
+++ b/hw/xquartz/darwin.h
@@ -34,6 +34,8 @@
#include <X11/extensions/XKB.h>
#include <assert.h>
+#include "threadSafety.h"
+
typedef struct {
void *framebuffer;
int x;
@@ -123,7 +125,7 @@ void DarwinSendDDXEvent(int type, int argc, ...);
#ifdef ENABLE_DEBUG_LOG
extern FILE *debug_log_fp;
#define DEBUG_LOG_NAME "x11-debug.txt"
-#define DEBUG_LOG(msg, args...) if (debug_log_fp) fprintf(debug_log_fp, "%x:%s:%s:%d " msg, pthread_self(), __FILE__, __FUNCTION__, __LINE__, ##args ); fflush(debug_log_fp);
+#define DEBUG_LOG(msg, args...) if (debug_log_fp) fprintf(debug_log_fp, "%s:%s:%s:%d " msg, threadSafetyID(pthread_self()), __FILE__, __FUNCTION__, __LINE__, ##args ); fflush(debug_log_fp);
#else
#define DEBUG_LOG(msg, args...)
#endif
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 3afbaf890..afa292fb8 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -1,7 +1,7 @@
/*
Darwin event queue and event handling
-Copyright 2007 Apple Inc.
+Copyright 2007-2008 Apple Inc.
Copyright 2004 Kaleb S. KEITHLEY. All Rights Reserved.
Copyright (c) 2002-2004 Torrey T. Lyons. All Rights Reserved.
@@ -30,6 +30,10 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
#define NEED_EVENTS
#include <X11/X.h>
#include <X11/Xmd.h>
@@ -44,22 +48,29 @@ in this Software without prior written authorization from The Open Group.
#include "darwin.h"
#include "quartz.h"
-#include "darwinKeyboard.h"
+#include "quartzKeyboard.h"
#include "darwinEvents.h"
#include <sys/types.h>
#include <sys/uio.h>
#include <unistd.h>
+#include <pthread.h>
+#include <errno.h>
+
#include <IOKit/hidsystem/IOLLEvent.h>
+/* Fake button press/release for scroll wheel move. */
+#define SCROLLWHEELUPFAKE 4
+#define SCROLLWHEELDOWNFAKE 5
+#define SCROLLWHEELLEFTFAKE 6
+#define SCROLLWHEELRIGHTFAKE 7
+
#define _APPLEWM_SERVER_
#include "applewmExt.h"
#include <X11/extensions/applewm.h>
-
-/* Fake button press/release for scroll wheel move. */
-#define SCROLLWHEELUPFAKE 4
-#define SCROLLWHEELDOWNFAKE 5
+/* FIXME: Abstract this better */
+void QuartzModeEQInit(void);
int input_check_zero, input_check_flag;
@@ -67,6 +78,25 @@ static int old_flags = 0; // last known modifier state
xEvent *darwinEvents = NULL;
+pthread_mutex_t mieqEnqueue_mutex;
+static inline void mieqEnqueue_lock(void) {
+ int err;
+ if((err = pthread_mutex_lock(&mieqEnqueue_mutex))) {
+ ErrorF("%s:%s:%d: Failed to lock mieqEnqueue_mutex: %d\n",
+ __FILE__, __FUNCTION__, __LINE__, err);
+ spewCallStack();
+ }
+}
+
+static inline void mieqEnqueue_unlock(void) {
+ int err;
+ if((err = pthread_mutex_unlock(&mieqEnqueue_mutex))) {
+ ErrorF("%s:%s:%d: Failed to unlock mieqEnqueue_mutex: %d\n",
+ __FILE__, __FUNCTION__, __LINE__, err);
+ spewCallStack();
+ }
+}
+
/*
* DarwinPressModifierMask
* Press or release the given modifier key, specified by its mask.
@@ -186,108 +216,104 @@ static void DarwinSimulateMouseClick(
be moved into their own individual functions and set as handlers using
mieqSetHandler. */
-void DarwinEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents) {
- int i;
-
- DEBUG_LOG("DarwinEventHandler(%d, %p, %p, %d)\n", screenNum, xe, dev, nevents);
- for (i=0; i<nevents; i++) {
- switch(xe[i].u.u.type) {
- case kXquartzControllerNotify:
- DEBUG_LOG("kXquartzControllerNotify\n");
- AppleWMSendEvent(AppleWMControllerNotify,
- AppleWMControllerNotifyMask,
- xe[i].u.clientMessage.u.l.longs0,
- xe[i].u.clientMessage.u.l.longs1);
- break;
-
- case kXquartzPasteboardNotify:
- DEBUG_LOG("kXquartzPasteboardNotify\n");
- AppleWMSendEvent(AppleWMPasteboardNotify,
- AppleWMPasteboardNotifyMask,
- xe[i].u.clientMessage.u.l.longs0,
- xe[i].u.clientMessage.u.l.longs1);
- break;
-
- case kXquartzActivate:
- DEBUG_LOG("kXquartzActivate\n");
- QuartzShow(xe[i].u.keyButtonPointer.rootX,
- xe[i].u.keyButtonPointer.rootY);
- AppleWMSendEvent(AppleWMActivationNotify,
- AppleWMActivationNotifyMask,
- AppleWMIsActive, 0);
- break;
-
- case kXquartzDeactivate:
- DEBUG_LOG("kXquartzDeactivate\n");
- DarwinReleaseModifiers();
- AppleWMSendEvent(AppleWMActivationNotify,
- AppleWMActivationNotifyMask,
- AppleWMIsInactive, 0);
- QuartzHide();
- break;
-
- case kXquartzWindowState:
- DEBUG_LOG("kXquartzWindowState\n");
- RootlessNativeWindowStateChanged(xe[i].u.clientMessage.u.l.longs0,
- xe[i].u.clientMessage.u.l.longs1);
- break;
-
- case kXquartzWindowMoved:
- DEBUG_LOG("kXquartzWindowMoved\n");
- RootlessNativeWindowMoved ((WindowPtr)xe[i].u.clientMessage.u.l.longs0);
- break;
-
- case kXquartzToggleFullscreen:
- DEBUG_LOG("kXquartzToggleFullscreen\n");
+static void DarwinEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents) {
+ int i;
+
+ TA_SERVER();
+
+ DEBUG_LOG("DarwinEventHandler(%d, %p, %p, %d)\n", screenNum, xe, dev, nevents);
+ for (i=0; i<nevents; i++) {
+ switch(xe[i].u.u.type) {
+ case kXquartzControllerNotify:
+ DEBUG_LOG("kXquartzControllerNotify\n");
+ AppleWMSendEvent(AppleWMControllerNotify,
+ AppleWMControllerNotifyMask,
+ xe[i].u.clientMessage.u.l.longs0,
+ xe[i].u.clientMessage.u.l.longs1);
+ break;
+
+ case kXquartzPasteboardNotify:
+ DEBUG_LOG("kXquartzPasteboardNotify\n");
+ AppleWMSendEvent(AppleWMPasteboardNotify,
+ AppleWMPasteboardNotifyMask,
+ xe[i].u.clientMessage.u.l.longs0,
+ xe[i].u.clientMessage.u.l.longs1);
+ break;
+
+ case kXquartzActivate:
+ DEBUG_LOG("kXquartzActivate\n");
+ QuartzShow(xe[i].u.keyButtonPointer.rootX,
+ xe[i].u.keyButtonPointer.rootY);
+ AppleWMSendEvent(AppleWMActivationNotify,
+ AppleWMActivationNotifyMask,
+ AppleWMIsActive, 0);
+ break;
+
+ case kXquartzDeactivate:
+ DEBUG_LOG("kXquartzDeactivate\n");
+ DarwinReleaseModifiers();
+ AppleWMSendEvent(AppleWMActivationNotify,
+ AppleWMActivationNotifyMask,
+ AppleWMIsInactive, 0);
+ QuartzHide();
+ break;
+
+ case kXquartzToggleFullscreen:
+ DEBUG_LOG("kXquartzToggleFullscreen\n");
#ifdef DARWIN_DDX_MISSING
- if (quartzEnableRootless) QuartzSetFullscreen(!quartzHasRoot);
- else if (quartzHasRoot) QuartzHide();
- else QuartzShow();
+ if (quartzEnableRootless)
+ QuartzSetFullscreen(!quartzHasRoot);
+ else if (quartzHasRoot)
+ QuartzHide();
+ else
+ QuartzShow();
#else
- // ErrorF("kXquartzToggleFullscreen not implemented\n");
+ // ErrorF("kXquartzToggleFullscreen not implemented\n");
#endif
- break;
-
- case kXquartzSetRootless:
- DEBUG_LOG("kXquartzSetRootless\n");
+ break;
+
+ case kXquartzSetRootless:
+ DEBUG_LOG("kXquartzSetRootless\n");
#ifdef DARWIN_DDX_MISSING
- QuartzSetRootless(xe[i].u.clientMessage.u.l.longs0);
- if (!quartzEnableRootless && !quartzHasRoot) QuartzHide();
+ QuartzSetRootless(xe[i].u.clientMessage.u.l.longs0);
+ if (!quartzEnableRootless && !quartzHasRoot)
+ QuartzHide();
#else
- // ErrorF("kXquartzSetRootless not implemented\n");
+ // ErrorF("kXquartzSetRootless not implemented\n");
#endif
- break;
-
- case kXquartzSetRootClip:
- QuartzSetRootClip((BOOL)xe[i].u.clientMessage.u.l.longs0);
- break;
-
- case kXquartzQuit:
- GiveUp(0);
- break;
-
- case kXquartzBringAllToFront:
- DEBUG_LOG("kXquartzBringAllToFront\n");
- RootlessOrderAllWindows();
- break;
-
- case kXquartzSpaceChanged:
- DEBUG_LOG("kXquartzSpaceChanged\n");
- QuartzSpaceChanged(xe[i].u.clientMessage.u.l.longs0);
-
- break;
- default:
- ErrorF("Unknown application defined event type %d.\n", xe[i].u.u.type);
+ break;
+
+ case kXquartzSetRootClip:
+ QuartzSetRootClip((Bool)xe[i].u.clientMessage.u.l.longs0);
+ break;
+
+ case kXquartzQuit:
+ GiveUp(0);
+ break;
+
+ case kXquartzSpaceChanged:
+ DEBUG_LOG("kXquartzSpaceChanged\n");
+ QuartzSpaceChanged(xe[i].u.clientMessage.u.l.longs0);
+ break;
+
+ default:
+ ErrorF("Unknown application defined event type %d.\n", xe[i].u.u.type);
}
- }
+ }
}
Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr) {
+ int err;
+
if (!darwinEvents)
darwinEvents = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum());
if (!darwinEvents)
FatalError("Couldn't allocate event buffer\n");
+ if((err = pthread_mutex_init(&mieqEnqueue_mutex, NULL))) {
+ FatalError("Couldn't allocate mieqEnqueue mutex: %d.\n", err);
+ }
+
mieqInit();
mieqSetHandler(kXquartzReloadKeymap, DarwinKeyboardReloadHandler);
mieqSetHandler(kXquartzActivate, DarwinEventHandler);
@@ -295,16 +321,16 @@ Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr) {
mieqSetHandler(kXquartzSetRootClip, DarwinEventHandler);
mieqSetHandler(kXquartzQuit, DarwinEventHandler);
mieqSetHandler(kXquartzReadPasteboard, QuartzReadPasteboard);
- mieqSetHandler(kXquartzWritePasteboard, QuartzWritePasteboard);
+ mieqSetHandler(kXquartzWritePasteboard, QuartzWritePasteboard);
mieqSetHandler(kXquartzToggleFullscreen, DarwinEventHandler);
mieqSetHandler(kXquartzSetRootless, DarwinEventHandler);
mieqSetHandler(kXquartzSpaceChanged, DarwinEventHandler);
mieqSetHandler(kXquartzControllerNotify, DarwinEventHandler);
mieqSetHandler(kXquartzPasteboardNotify, DarwinEventHandler);
mieqSetHandler(kXquartzDisplayChanged, QuartzDisplayChangedHandler);
- mieqSetHandler(kXquartzWindowState, DarwinEventHandler);
- mieqSetHandler(kXquartzWindowMoved, DarwinEventHandler);
+ QuartzModeEQInit();
+
return TRUE;
}
@@ -314,40 +340,38 @@ Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr) {
*/
void ProcessInputEvents(void) {
xEvent xe;
- // button number and modifier mask of currently pressed fake button
- input_check_flag=0;
+ int x = sizeof(xe);
+
+ TA_SERVER();
- // ErrorF("calling mieqProcessInputEvents\n");
mieqProcessInputEvents();
// Empty the signaling pipe
- int x = sizeof(xe);
while (x == sizeof(xe)) {
-// DEBUG_LOG("draining pipe\n");
x = read(darwinEventReadFD, &xe, sizeof(xe));
}
}
/* Sends a null byte down darwinEventWriteFD, which will cause the
Dispatch() event loop to check out event queue */
-void DarwinPokeEQ(void) {
- char nullbyte=0;
- input_check_flag++;
- // <daniels> bushing: oh, i ... er ... christ.
- write(darwinEventWriteFD, &nullbyte, 1);
+static void DarwinPokeEQ(void) {
+ char nullbyte=0;
+ input_check_flag++;
+ // <daniels> oh, i ... er ... christ.
+ write(darwinEventWriteFD, &nullbyte, 1);
}
void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y,
float pressure, float tilt_x, float tilt_y) {
- static int darwinFakeMouseButtonDown = 0;
- static int darwinFakeMouseButtonMask = 0;
- int i, num_events;
+ static int darwinFakeMouseButtonDown = 0;
+ static int darwinFakeMouseButtonMask = 0;
+ int i, num_events;
if(!darwinEvents) {
ErrorF("DarwinSendPointerEvents called before darwinEvents was initialized\n");
return;
}
- /* I can't find a spec for this, but at least GTK expects that tablets are
+ /* I can't find a spec for this, but at least GTK expects that tablets are
just like mice, except they have either one or three extra valuators, in this
order:
@@ -356,126 +380,135 @@ void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int poin
we can't do that. Again, GTK seems to record the min/max of each valuator,
and then perform scaling back to float itself using that info. Soo.... */
- int valuators[5] = {pointer_x, pointer_y,
+ int valuators[5] = {pointer_x, pointer_y,
pressure * INT32_MAX * 1.0f,
tilt_x * INT32_MAX * 1.0f,
tilt_y * INT32_MAX * 1.0f};
- if (ev_type == ButtonPress && darwinFakeButtons && ev_button == 1) {
- // Mimic multi-button mouse with modifier-clicks
- // If both sets of modifiers are pressed,
- // button 2 is clicked.
- if ((old_flags & darwinFakeMouse2Mask) == darwinFakeMouse2Mask) {
- DarwinSimulateMouseClick(pointer_x, pointer_y, pressure,
+ if (ev_type == ButtonPress && darwinFakeButtons && ev_button == 1) {
+ // Mimic multi-button mouse with modifier-clicks
+ // If both sets of modifiers are pressed,
+ // button 2 is clicked.
+ if ((old_flags & darwinFakeMouse2Mask) == darwinFakeMouse2Mask) {
+ DarwinSimulateMouseClick(pointer_x, pointer_y, pressure,
tilt_x, tilt_y, 2, darwinFakeMouse2Mask);
- darwinFakeMouseButtonDown = 2;
- darwinFakeMouseButtonMask = darwinFakeMouse2Mask;
- return;
- } else if ((old_flags & darwinFakeMouse3Mask) == darwinFakeMouse3Mask) {
- DarwinSimulateMouseClick(pointer_x, pointer_y, pressure,
+ darwinFakeMouseButtonDown = 2;
+ darwinFakeMouseButtonMask = darwinFakeMouse2Mask;
+ return;
+ } else if ((old_flags & darwinFakeMouse3Mask) == darwinFakeMouse3Mask) {
+ DarwinSimulateMouseClick(pointer_x, pointer_y, pressure,
tilt_x, tilt_y, 3, darwinFakeMouse3Mask);
- darwinFakeMouseButtonDown = 3;
- darwinFakeMouseButtonMask = darwinFakeMouse3Mask;
- return;
- }
- }
- if (ev_type == ButtonRelease && darwinFakeButtons && darwinFakeMouseButtonDown) {
- // If last mousedown was a fake click, don't check for
- // mouse modifiers here. The user may have released the
- // modifiers before the mouse button.
- ev_button = darwinFakeMouseButtonDown;
- darwinFakeMouseButtonDown = 0;
- // Bring modifiers back up to date
- DarwinUpdateModifiers(KeyPress, darwinFakeMouseButtonMask & old_flags);
- darwinFakeMouseButtonMask = 0;
- return;
- }
-
- num_events = GetPointerEvents(darwinEvents, darwinPointer, ev_type, ev_button,
- POINTER_ABSOLUTE, 0, 5, valuators);
-
- for(i=0; i<num_events; i++) mieqEnqueue (darwinPointer,&darwinEvents[i]);
- DarwinPokeEQ();
+ darwinFakeMouseButtonDown = 3;
+ darwinFakeMouseButtonMask = darwinFakeMouse3Mask;
+ return;
+ }
+ }
+
+ if (ev_type == ButtonRelease && darwinFakeButtons && darwinFakeMouseButtonDown) {
+ // If last mousedown was a fake click, don't check for
+ // mouse modifiers here. The user may have released the
+ // modifiers before the mouse button.
+ ev_button = darwinFakeMouseButtonDown;
+ darwinFakeMouseButtonDown = 0;
+ // Bring modifiers back up to date
+ DarwinUpdateModifiers(KeyPress, darwinFakeMouseButtonMask & old_flags);
+ darwinFakeMouseButtonMask = 0;
+ return;
+ }
+
+ mieqEnqueue_lock(); {
+ num_events = GetPointerEvents(darwinEvents, darwinPointer, ev_type, ev_button,
+ POINTER_ABSOLUTE, 0, 5, valuators);
+ for(i=0; i<num_events; i++) mieqEnqueue (darwinPointer,&darwinEvents[i]);
+ DarwinPokeEQ();
+
+ } mieqEnqueue_unlock();
}
void DarwinSendKeyboardEvents(int ev_type, int keycode) {
- int i, num_events;
+ int i, num_events;
+
if(!darwinEvents) {
ErrorF("DarwinSendKeyboardEvents called before darwinEvents was initialized\n");
return;
}
- if (old_flags == 0 && darwinSyncKeymap && darwinKeymapFile == NULL) {
- /* See if keymap has changed. */
+ if (old_flags == 0 && darwinSyncKeymap && darwinKeymapFile == NULL) {
+ /* See if keymap has changed. */
- static unsigned int last_seed;
- unsigned int this_seed;
+ static unsigned int last_seed;
+ unsigned int this_seed;
- this_seed = QuartzSystemKeymapSeed();
- if (this_seed != last_seed) {
- last_seed = this_seed;
- DarwinSendDDXEvent(kXquartzReloadKeymap, 0);
- }
- }
+ this_seed = QuartzSystemKeymapSeed();
+ if (this_seed != last_seed) {
+ last_seed = this_seed;
+ DarwinSendDDXEvent(kXquartzReloadKeymap, 0);
+ }
+ }
- num_events = GetKeyboardEvents(darwinEvents, darwinKeyboard, ev_type, keycode + MIN_KEYCODE);
- for(i=0; i<num_events; i++) mieqEnqueue(darwinKeyboard,&darwinEvents[i]);
- DarwinPokeEQ();
+ mieqEnqueue_lock(); {
+ num_events = GetKeyboardEvents(darwinEvents, darwinKeyboard, ev_type, keycode + MIN_KEYCODE);
+ for(i=0; i<num_events; i++) mieqEnqueue(darwinKeyboard,&darwinEvents[i]);
+ DarwinPokeEQ();
+ } mieqEnqueue_unlock();
}
void DarwinSendProximityEvents(int ev_type, int pointer_x, int pointer_y,
float pressure, float tilt_x, float tilt_y) {
- int i, num_events;
- int valuators[5] = {pointer_x, pointer_y,
+ int i, num_events;
+ int valuators[5] = {pointer_x, pointer_y,
pressure * INT32_MAX * 1.0f,
tilt_x * INT32_MAX * 1.0f,
tilt_y * INT32_MAX * 1.0f};
- if(!darwinEvents) {
+ if(!darwinEvents) {
ErrorF("DarwinSendProximityvents called before darwinEvents was initialized\n");
return;
-}
+ }
- num_events = GetProximityEvents(darwinEvents, darwinPointer, ev_type,
- 0, 5, valuators);
-
- for(i=0; i<num_events; i++) mieqEnqueue (darwinPointer,&darwinEvents[i]);
- DarwinPokeEQ();
+ mieqEnqueue_lock(); {
+ num_events = GetProximityEvents(darwinEvents, darwinPointer, ev_type,
+ 0, 5, valuators);
+ for(i=0; i<num_events; i++) mieqEnqueue (darwinPointer,&darwinEvents[i]);
+ DarwinPokeEQ();
+ } mieqEnqueue_unlock();
}
-/* Send the appropriate number of button 4 / 5 clicks to emulate scroll wheel */
-void DarwinSendScrollEvents(float count, int pointer_x, int pointer_y,
- float pressure, float tilt_x, float tilt_y) {
- int i;
- int ev_button = count > 0.0f ? 4 : 5;
- int valuators[5] = {pointer_x, pointer_y,
- pressure * INT32_MAX * 1.0f,
- tilt_x * INT32_MAX * 1.0f,
- tilt_y * INT32_MAX * 1.0f};
-
+/* Send the appropriate number of button clicks to emulate scroll wheel */
+void DarwinSendScrollEvents(float count_x, float count_y,
+ int pointer_x, int pointer_y,
+ float pressure, float tilt_x, float tilt_y) {
if(!darwinEvents) {
ErrorF("DarwinSendScrollEvents called before darwinEvents was initialized\n");
return;
}
- for (count = fabs(count); count > 0.0; count = count - 1.0f) {
- int num_events = GetPointerEvents(darwinEvents, darwinPointer, ButtonPress, ev_button,
- POINTER_ABSOLUTE, 0, 5, valuators);
- for(i=0; i<num_events; i++) mieqEnqueue(darwinPointer,&darwinEvents[i]);
- num_events = GetPointerEvents(darwinEvents, darwinPointer, ButtonRelease, ev_button,
- POINTER_ABSOLUTE, 0, 5, valuators);
- for(i=0; i<num_events; i++) mieqEnqueue(darwinPointer,&darwinEvents[i]);
- }
- DarwinPokeEQ();
+ int sign_x = count_x > 0.0f ? SCROLLWHEELLEFTFAKE : SCROLLWHEELRIGHTFAKE;
+ int sign_y = count_y > 0.0f ? SCROLLWHEELUPFAKE : SCROLLWHEELDOWNFAKE;
+ count_x = fabs(count_x);
+ count_y = fabs(count_y);
+
+ while ((count_x > 0.0f) || (count_y > 0.0f)) {
+ if (count_x > 0.0f) {
+ DarwinSendPointerEvents(ButtonPress, sign_x, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
+ DarwinSendPointerEvents(ButtonRelease, sign_x, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
+ count_x = count_x - 1.0f;
+ }
+ if (count_y > 0.0f) {
+ DarwinSendPointerEvents(ButtonPress, sign_y, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
+ DarwinSendPointerEvents(ButtonRelease, sign_y, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
+ count_y = count_y - 1.0f;
+ }
+ }
}
/* Send the appropriate KeyPress/KeyRelease events to GetKeyboardEvents to
reflect changing modifier flags (alt, control, meta, etc) */
void DarwinUpdateModKeys(int flags) {
- DarwinUpdateModifiers(KeyRelease, old_flags & ~flags);
- DarwinUpdateModifiers(KeyPress, ~old_flags & flags);
- old_flags = flags;
+ DarwinUpdateModifiers(KeyRelease, old_flags & ~flags);
+ DarwinUpdateModifiers(KeyPress, ~old_flags & flags);
+ old_flags = flags;
}
@@ -503,5 +536,8 @@ void DarwinSendDDXEvent(int type, int argc, ...) {
va_end (args);
}
- mieqEnqueue(NULL, &xe);
+ mieqEnqueue_lock();
+ mieqEnqueue(darwinPointer, &xe);
+ DarwinPokeEQ();
+ mieqEnqueue_unlock();
}
diff --git a/hw/xquartz/darwinEvents.h b/hw/xquartz/darwinEvents.h
index 7c56be9c8..dd3f81c30 100644
--- a/hw/xquartz/darwinEvents.h
+++ b/hw/xquartz/darwinEvents.h
@@ -32,17 +32,13 @@ Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr);
void DarwinEQEnqueue(const xEventPtr e);
void DarwinEQPointerPost(DeviceIntPtr pDev, xEventPtr e);
void DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX);
-void DarwinPokeEQ(void);
void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y,
float pressure, float tilt_x, float tilt_y);
void DarwinSendProximityEvents(int ev_type, int pointer_x, int pointer_y,
float pressure, float tilt_x, float tilt_y);
void DarwinSendKeyboardEvents(int ev_type, int keycode);
-void DarwinSendScrollEvents(float count, int pointer_x, int pointer_y,
+void DarwinSendScrollEvents(float count_x, float count_y, int pointer_x, int pointer_y,
float pressure, float tilt_x, float tilt_y);
void DarwinUpdateModKeys(int flags);
-void DarwinEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev,
- int nevents);
-
#endif /* _DARWIN_EVENTS_H */
diff --git a/hw/xquartz/darwinKeyboard.c b/hw/xquartz/darwinKeyboard.c
deleted file mode 100644
index 6f2758e53..000000000
--- a/hw/xquartz/darwinKeyboard.c
+++ /dev/null
@@ -1,1019 +0,0 @@
-//=============================================================================
-//
-// Keyboard support for the Darwin X Server
-//
-// Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved.
-// Copyright (c) 2003 Apple Computer, Inc. All Rights Reserved.
-// Copyright 2004 Kaleb S. KEITHLEY. All Rights Reserved.
-//
-// The code to parse the Darwin keymap is derived from dumpkeymap.c
-// by Eric Sunshine, which includes the following copyright:
-//
-// Copyright (C) 1999,2000 by Eric Sunshine <sunshine@sunshineco.com>
-// All rights reserved.
-//
-//-----------------------------------------------------------------------------
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-// 3. The name of the author may not be used to endorse or promote products
-// derived from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
-// NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//=============================================================================
-
-
-/*
-===========================================================================
-
- An X keyCode must be in the range XkbMinLegalKeyCode (8) to
- XkbMaxLegalKeyCode(255).
-
- The keyCodes we get from the kernel range from 0 to 127, so we need to
- offset the range before passing the keyCode to X.
-
- An X KeySym is an extended ascii code that is device independent.
-
- The modifier map is accessed by the keyCode, but the normal map is
- accessed by keyCode - MIN_KEYCODE. Sigh.
-
-===========================================================================
-*/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-// Define this to get a diagnostic output to stderr which is helpful
-// in determining how the X server is interpreting the Darwin keymap.
-// #define DUMP_DARWIN_KEYMAP
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <IOKit/hidsystem/event_status_driver.h>
-#include <IOKit/hidsystem/ev_keymap.h>
-#include <architecture/byte_order.h> // For the NXSwap*
-#include "darwin.h"
-#include "darwinKeyboard.h"
-#include "quartzKeyboard.h"
-#include "quartzAudio.h"
-
-#ifdef NDEBUG
-#undef NDEBUG
-#include <assert.h>
-#define NDEBUG 1
-#else
-#include <assert.h>
-#endif
-
-#define AltMask Mod1Mask
-#define MetaMask Mod2Mask
-#define FunctionMask Mod3Mask
-
-#define UK(a) NoSymbol // unknown symbol
-
-static KeySym const next_to_x[256] = {
- NoSymbol, NoSymbol, NoSymbol, XK_KP_Enter,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
- NoSymbol, XK_Return, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_Escape,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
- XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
- XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
- XK_comma, XK_minus, XK_period, XK_slash,
- XK_0, XK_1, XK_2, XK_3,
- XK_4, XK_5, XK_6, XK_7,
- XK_8, XK_9, XK_colon, XK_semicolon,
- XK_less, XK_equal, XK_greater, XK_question,
- XK_at, XK_A, XK_B, XK_C,
- XK_D, XK_E, XK_F, XK_G,
- XK_H, XK_I, XK_J, XK_K,
- XK_L, XK_M, XK_N, XK_O,
- XK_P, XK_Q, XK_R, XK_S,
- XK_T, XK_U, XK_V, XK_W,
- XK_X, XK_Y, XK_Z, XK_bracketleft,
- XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
- XK_grave, XK_a, XK_b, XK_c,
- XK_d, XK_e, XK_f, XK_g,
- XK_h, XK_i, XK_j, XK_k,
- XK_l, XK_m, XK_n, XK_o,
- XK_p, XK_q, XK_r, XK_s,
- XK_t, XK_u, XK_v, XK_w,
- XK_x, XK_y, XK_z, XK_braceleft,
- XK_bar, XK_braceright, XK_asciitilde, XK_BackSpace,
-// 128
- NoSymbol, XK_Agrave, XK_Aacute, XK_Acircumflex,
- XK_Atilde, XK_Adiaeresis, XK_Aring, XK_Ccedilla,
- XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis,
- XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis,
-// 144
- XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute,
- XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_Ugrave,
- XK_Uacute, XK_Ucircumflex, XK_Udiaeresis, XK_Yacute,
- XK_THORN, XK_mu, XK_multiply, XK_division,
-// 160
- XK_copyright, XK_exclamdown, XK_cent, XK_sterling,
- UK(fraction), XK_yen, UK(fhook), XK_section,
- XK_currency, XK_rightsinglequotemark,
- XK_leftdoublequotemark,
- XK_guillemotleft,
- XK_leftanglebracket,
- XK_rightanglebracket,
- UK(filigature), UK(flligature),
-// 176
- XK_registered, XK_endash, XK_dagger, XK_doubledagger,
- XK_periodcentered,XK_brokenbar, XK_paragraph, UK(bullet),
- XK_singlelowquotemark,
- XK_doublelowquotemark,
- XK_rightdoublequotemark,
- XK_guillemotright,
- XK_ellipsis, UK(permille), XK_notsign, XK_questiondown,
-// 192
- XK_onesuperior, XK_dead_grave, XK_dead_acute, XK_dead_circumflex,
- XK_dead_tilde, XK_dead_macron, XK_dead_breve, XK_dead_abovedot,
- XK_dead_diaeresis,
- XK_twosuperior, XK_dead_abovering,
- XK_dead_cedilla,
- XK_threesuperior,
- XK_dead_doubleacute,
- XK_dead_ogonek, XK_dead_caron,
-// 208
- XK_emdash, XK_plusminus, XK_onequarter, XK_onehalf,
- XK_threequarters,
- XK_agrave, XK_aacute, XK_acircumflex,
- XK_atilde, XK_adiaeresis, XK_aring, XK_ccedilla,
- XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis,
-// 224
- XK_igrave, XK_AE, XK_iacute, XK_ordfeminine,
- XK_icircumflex, XK_idiaeresis, XK_eth, XK_ntilde,
- XK_Lstroke, XK_Ooblique, XK_OE, XK_masculine,
- XK_ograve, XK_oacute, XK_ocircumflex, XK_otilde,
-// 240
- XK_odiaeresis, XK_ae, XK_ugrave, XK_uacute,
- XK_ucircumflex, XK_idotless, XK_udiaeresis, XK_ygrave,
- XK_lstroke, XK_ooblique, XK_oe, XK_ssharp,
- XK_thorn, XK_ydiaeresis, NoSymbol, NoSymbol,
- };
-
-#define MIN_SYMBOL 0xAC
-static KeySym const symbol_to_x[] = {
- XK_Left, XK_Up, XK_Right, XK_Down
- };
-static int const NUM_SYMBOL = sizeof(symbol_to_x) / sizeof(symbol_to_x[0]);
-
-#define MIN_FUNCKEY 0x20
-static KeySym const funckey_to_x[] = {
- XK_F1, XK_F2, XK_F3, XK_F4,
- XK_F5, XK_F6, XK_F7, XK_F8,
- XK_F9, XK_F10, XK_F11, XK_F12,
- XK_Insert, XK_Delete, XK_Home, XK_End,
- XK_Page_Up, XK_Page_Down, XK_F13, XK_F14,
- XK_F15
- };
-static int const NUM_FUNCKEY = sizeof(funckey_to_x) / sizeof(funckey_to_x[0]);
-
-typedef struct {
- KeySym normalSym;
- KeySym keypadSym;
-} darwinKeyPad_t;
-
-static darwinKeyPad_t const normal_to_keypad[] = {
- { XK_0, XK_KP_0 },
- { XK_1, XK_KP_1 },
- { XK_2, XK_KP_2 },
- { XK_3, XK_KP_3 },
- { XK_4, XK_KP_4 },
- { XK_5, XK_KP_5 },
- { XK_6, XK_KP_6 },
- { XK_7, XK_KP_7 },
- { XK_8, XK_KP_8 },
- { XK_9, XK_KP_9 },
- { XK_equal, XK_KP_Equal },
- { XK_asterisk, XK_KP_Multiply },
- { XK_plus, XK_KP_Add },
- { XK_comma, XK_KP_Separator },
- { XK_minus, XK_KP_Subtract },
- { XK_period, XK_KP_Decimal },
- { XK_slash, XK_KP_Divide }
-};
-static int const NUM_KEYPAD = sizeof(normal_to_keypad) / sizeof(normal_to_keypad[0]);
-
-static void DarwinChangeKeyboardControl( DeviceIntPtr device, KeybdCtrl *ctrl )
-{
- // keyclick, bell volume / pitch, autorepead, LED's
-}
-
-darwinKeyboardInfo keyInfo;
-static FILE *fref = NULL;
-static char *inBuffer = NULL;
-
-//-----------------------------------------------------------------------------
-// Data Stream Object
-// Can be configured to treat embedded "numbers" as being composed of
-// either 1, 2, or 4 bytes, apiece.
-//-----------------------------------------------------------------------------
-typedef struct _DataStream {
- unsigned char const *data;
- unsigned char const *data_end;
- short number_size; // Size in bytes of a "number" in the stream.
-} DataStream;
-
-static DataStream* new_data_stream(unsigned char const* data, int size) {
- DataStream* s = (DataStream*)xalloc( sizeof(DataStream) );
- if(s) {
- s->data = data;
- s->data_end = data + size;
- s->number_size = 1; // Default to byte-sized numbers.
- }
- return s;
-}
-
-static void destroy_data_stream(DataStream* s) {
- xfree(s);
-}
-
-static unsigned char get_byte(DataStream* s) {
- assert(s->data + 1 <= s->data_end);
- return *s->data++;
-}
-
-static short get_word(DataStream* s) {
- short hi, lo;
- assert(s->data + 2 <= s->data_end);
- hi = *s->data++;
- lo = *s->data++;
- return ((hi << 8) | lo);
-}
-
-static int get_dword(DataStream* s) {
- int b1, b2, b3, b4;
- assert(s->data + 4 <= s->data_end);
- b4 = *s->data++;
- b3 = *s->data++;
- b2 = *s->data++;
- b1 = *s->data++;
- return ((b4 << 24) | (b3 << 16) | (b2 << 8) | b1);
-}
-
-static int get_number(DataStream* s) {
- switch (s->number_size) {
- case 4: return get_dword(s);
- case 2: return get_word(s);
- default: return get_byte(s);
- }
-}
-
-//-----------------------------------------------------------------------------
-// Utility functions to help parse Darwin keymap
-//-----------------------------------------------------------------------------
-
-/*
- * bits_set
- * Calculate number of bits set in the modifier mask.
- */
-static short bits_set(short mask) {
- short n = 0;
-
- for ( ; mask != 0; mask >>= 1)
- if ((mask & 0x01) != 0)
- n++;
- return n;
-}
-
-/*
- * parse_next_char_code
- * Read the next character code from the Darwin keymapping
- * and write it to the X keymap.
- */
-static void parse_next_char_code(DataStream *s, KeySym *k) {
- const short charSet = get_number(s);
- const short charCode = get_number(s);
-
- if (charSet == 0) { // ascii character
- if (charCode >= 0 && charCode < 256)
- *k = next_to_x[charCode];
- } else if (charSet == 0x01) { // symbol character
- if (charCode >= MIN_SYMBOL &&
- charCode <= MIN_SYMBOL + NUM_SYMBOL)
- *k = symbol_to_x[charCode - MIN_SYMBOL];
- } else if (charSet == 0xFE) { // function key
- if (charCode >= MIN_FUNCKEY &&
- charCode <= MIN_FUNCKEY + NUM_FUNCKEY)
- *k = funckey_to_x[charCode - MIN_FUNCKEY];
- }
-}
-
-
-/*
- * DarwinReadKeymapFile
- * Read the appropriate keymapping from a keymapping file.
- */
-static Bool DarwinReadKeymapFile(NXKeyMapping *keyMap) {
- struct stat st;
- NXEventSystemDevice info[20];
- int interface = 0, handler_id = 0;
- int map_interface, map_handler_id, map_size = 0;
- unsigned int i, size;
- int *bufferEnd;
- union km_tag {
- int *intP;
- char *charP;
- } km;
-
- fref = fopen( darwinKeymapFile, "rb" );
- if (fref == NULL) {
- ErrorF("Unable to open keymapping file '%s' (%s).\n",
- darwinKeymapFile, strerror(errno));
- return FALSE;
- }
- if (fstat(fileno(fref), &st) == -1) {
- ErrorF("Could not stat keymapping file '%s' (%s).\n",
- darwinKeymapFile, strerror(errno));
- return FALSE;
- }
-
- // check to make sure we don't crash later
- if (st.st_size <= 16*sizeof(int)) {
- ErrorF("Keymapping file '%s' is invalid (too small).\n",
- darwinKeymapFile);
- return FALSE;
- }
-
- inBuffer = (char*) xalloc( st.st_size );
- bufferEnd = (int *) (inBuffer + st.st_size);
- if (fread(inBuffer, st.st_size, 1, fref) != 1) {
- ErrorF("Could not read %qd bytes from keymapping file '%s' (%s).\n",
- st.st_size, darwinKeymapFile, strerror(errno));
- return FALSE;
- }
-
- if (strncmp( inBuffer, "KYM1", 4 ) == 0) {
- // Magic number OK.
- } else if (strncmp( inBuffer, "KYMP", 4 ) == 0) {
- ErrorF("Keymapping file '%s' is intended for use with the original NeXT keyboards and cannot be used by XDarwin.\n", darwinKeymapFile);
- return FALSE;
- } else {
- ErrorF("Keymapping file '%s' has a bad magic number and cannot be used by XDarwin.\n", darwinKeymapFile);
- return FALSE;
- }
-
- // find the keyboard interface and handler id
- size = sizeof( info ) / sizeof( int );
- if (!NXEventSystemInfo( darwinParamConnect, NX_EVS_DEVICE_INFO,
- (NXEventSystemInfoType) info, &size )) {
- ErrorF("Error reading event status driver info.\n");
- return FALSE;
- }
-
- size = size * sizeof( int ) / sizeof( info[0] );
- for( i = 0; i < size; i++) {
- if (info[i].dev_type == NX_EVS_DEVICE_TYPE_KEYBOARD) {
- Bool hasInterface = FALSE;
- Bool hasMatch = FALSE;
-
- interface = info[i].interface;
- handler_id = info[i].id;
-
- // Find an appropriate keymapping:
- // The first time we try to match both interface and handler_id.
- // If we can't match both, we take the first match for interface.
-
- do {
- km.charP = inBuffer;
- km.intP++;
- while (km.intP+3 < bufferEnd) {
- map_interface = NXSwapBigIntToHost(*(km.intP++));
- map_handler_id = NXSwapBigIntToHost(*(km.intP++));
- map_size = NXSwapBigIntToHost(*(km.intP++));
- if (map_interface == interface) {
- if (map_handler_id == handler_id || hasInterface) {
- hasMatch = TRUE;
- break;
- } else {
- hasInterface = TRUE;
- }
- }
- km.charP += map_size;
- }
- } while (hasInterface && !hasMatch);
-
- if (hasMatch) {
- // fill in NXKeyMapping structure
- keyMap->size = map_size;
- keyMap->mapping = (char*) xalloc(map_size);
- memcpy(keyMap->mapping, km.charP, map_size);
- return TRUE;
- }
- } // if dev_id == keyboard device
- } // foreach info struct
-
- // The keymapping file didn't match any of the info structs
- // returned by NXEventSystemInfo.
- ErrorF("Keymapping file '%s' did not contain appropriate keyboard interface.\n", darwinKeymapFile);
- return FALSE;
-}
-
-
-/*
- * DarwinParseNXKeyMapping
- */
-static Bool DarwinParseNXKeyMapping(darwinKeyboardInfo *info) {
- KeySym *k;
- int i;
- short numMods, numKeys, numPadKeys = 0;
- Bool haveKeymap = FALSE;
- NXKeyMapping keyMap;
- DataStream *keyMapStream;
- unsigned char const *numPadStart = 0;
-
- if (darwinKeymapFile) {
- haveKeymap = DarwinReadKeymapFile(&keyMap);
- if (fref)
- fclose(fref);
- if (inBuffer)
- xfree(inBuffer);
- if (!haveKeymap) {
- ErrorF("Reverting to kernel keymapping.\n");
- }
- }
-
- if (!haveKeymap) {
- // get the Darwin keyboard map
- keyMap.size = NXKeyMappingLength( darwinParamConnect );
- keyMap.mapping = (char*) xalloc( keyMap.size );
- if (!NXGetKeyMapping( darwinParamConnect, &keyMap )) {
- return FALSE;
- }
- }
-
- keyMapStream = new_data_stream( (unsigned char const*)keyMap.mapping,
- keyMap.size );
-
- // check the type of map
- if (get_word(keyMapStream)) {
- keyMapStream->number_size = 2;
- ErrorF("Current 16-bit keymapping may not be interpreted correctly.\n");
- }
-
- // Insert X modifier KeySyms into the keyboard map.
- numMods = get_number(keyMapStream);
- while (numMods-- > 0) {
- int left = 1; // first keycode is left
- short const charCode = get_number(keyMapStream);
- short numKeyCodes = get_number(keyMapStream);
-
- // This is just a marker, not a real modifier.
- // Store numeric keypad keys for later.
- if (charCode == NX_MODIFIERKEY_NUMERICPAD) {
- numPadStart = keyMapStream->data;
- numPadKeys = numKeyCodes;
- }
-
- while (numKeyCodes-- > 0) {
- const short keyCode = get_number(keyMapStream);
- if (charCode != NX_MODIFIERKEY_NUMERICPAD) {
- switch (charCode) {
- case NX_MODIFIERKEY_ALPHALOCK:
- info->keyMap[keyCode * GLYPHS_PER_KEY] = XK_Caps_Lock;
- break;
- case NX_MODIFIERKEY_SHIFT:
- info->keyMap[keyCode * GLYPHS_PER_KEY] =
- (left ? XK_Shift_L : XK_Shift_R);
- break;
- case NX_MODIFIERKEY_CONTROL:
- info->keyMap[keyCode * GLYPHS_PER_KEY] =
- (left ? XK_Control_L : XK_Control_R);
- break;
- case NX_MODIFIERKEY_ALTERNATE:
- // info->keyMap[keyCode * GLYPHS_PER_KEY] = XK_Mode_switch;
- info->keyMap[keyCode * GLYPHS_PER_KEY] =
- (left ? XK_Alt_L : XK_Alt_R);
- break;
- case NX_MODIFIERKEY_COMMAND:
- info->keyMap[keyCode * GLYPHS_PER_KEY] =
- (left ? XK_Meta_L : XK_Meta_R);
- break;
- case NX_MODIFIERKEY_SECONDARYFN:
- info->keyMap[keyCode * GLYPHS_PER_KEY] =
- (left ? XK_Control_L : XK_Control_R);
- break;
- case NX_MODIFIERKEY_HELP:
- // Help is not an X11 modifier; treat as normal key
- info->keyMap[keyCode * GLYPHS_PER_KEY] = XK_Help;
- break;
- }
- }
- left = 0;
- }
- }
-
- // Convert the Darwin keyboard mapping to an X keyboard map.
- // A key can have a different character code for each combination of
- // modifiers. We currently ignore all modifier combinations except
- // those with Shift, AlphaLock, and Alt.
- numKeys = get_number(keyMapStream);
- for (i = 0, k = info->keyMap; i < numKeys; i++, k += GLYPHS_PER_KEY) {
- short const charGenMask = get_number(keyMapStream);
- if (charGenMask != 0xFF) { // is key bound?
- short numKeyCodes = 1 << bits_set(charGenMask);
-
- // Record unmodified case
- parse_next_char_code( keyMapStream, k );
- numKeyCodes--;
-
- // If AlphaLock and Shift modifiers produce different codes,
- // we record the Shift case since X handles AlphaLock.
- if (charGenMask & 0x01) { // AlphaLock
- parse_next_char_code( keyMapStream, k+1 );
- numKeyCodes--;
- }
-
- if (charGenMask & 0x02) { // Shift
- parse_next_char_code( keyMapStream, k+1 );
- numKeyCodes--;
-
- if (charGenMask & 0x01) { // Shift-AlphaLock
- get_number(keyMapStream); get_number(keyMapStream);
- numKeyCodes--;
- }
- }
-
- // Skip the Control cases
- if (charGenMask & 0x04) { // Control
- get_number(keyMapStream); get_number(keyMapStream);
- numKeyCodes--;
-
- if (charGenMask & 0x01) { // Control-AlphaLock
- get_number(keyMapStream); get_number(keyMapStream);
- numKeyCodes--;
- }
-
- if (charGenMask & 0x02) { // Control-Shift
- get_number(keyMapStream); get_number(keyMapStream);
- numKeyCodes--;
-
- if (charGenMask & 0x01) { // Shift-Control-AlphaLock
- get_number(keyMapStream); get_number(keyMapStream);
- numKeyCodes--;
- }
- }
- }
-
- // Process Alt cases
- if (charGenMask & 0x08) { // Alt
- parse_next_char_code( keyMapStream, k+2 );
- numKeyCodes--;
-
- if (charGenMask & 0x01) { // Alt-AlphaLock
- parse_next_char_code( keyMapStream, k+3 );
- numKeyCodes--;
- }
-
- if (charGenMask & 0x02) { // Alt-Shift
- parse_next_char_code( keyMapStream, k+3 );
- numKeyCodes--;
-
- if (charGenMask & 0x01) { // Alt-Shift-AlphaLock
- get_number(keyMapStream); get_number(keyMapStream);
- numKeyCodes--;
- }
- }
- }
-
- while (numKeyCodes-- > 0) {
- get_number(keyMapStream); get_number(keyMapStream);
- }
-
- if (k[3] == k[2]) k[3] = NoSymbol;
- if (k[2] == k[1]) k[2] = NoSymbol;
- if (k[1] == k[0]) k[1] = NoSymbol;
- if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol;
- }
- }
-
- // Now we have to go back through the list of keycodes that are on the
- // numeric keypad and update the X keymap.
- keyMapStream->data = numPadStart;
- while(numPadKeys-- > 0) {
- const short keyCode = get_number(keyMapStream);
- k = &info->keyMap[keyCode * GLYPHS_PER_KEY];
- for (i = 0; i < NUM_KEYPAD; i++) {
- if (*k == normal_to_keypad[i].normalSym) {
- k[0] = normal_to_keypad[i].keypadSym;
- break;
- }
- }
- }
-
- // free Darwin keyboard map
- destroy_data_stream( keyMapStream );
- xfree( keyMap.mapping );
-
- return TRUE;
-}
-
-/*
- * DarwinBuildModifierMaps
- * Use the keyMap field of keyboard info structure to populate
- * the modMap and modifierKeycodes fields.
- */
-static void DarwinBuildModifierMaps(darwinKeyboardInfo *info) {
- int i;
- KeySym *k;
-
- memset(info->modMap, NoSymbol, sizeof(info->modMap));
- memset(info->modifierKeycodes, 0, sizeof(info->modifierKeycodes));
-
- for (i = 0; i < NUM_KEYCODES; i++) {
- k = info->keyMap + i * GLYPHS_PER_KEY;
-
- switch (*k) {
- case XK_Shift_L:
- info->modifierKeycodes[NX_MODIFIERKEY_SHIFT][0] = i;
- info->modMap[MIN_KEYCODE + i] = ShiftMask;
- break;
-
- case XK_Shift_R:
-#ifdef NX_MODIFIERKEY_RSHIFT
- info->modifierKeycodes[NX_MODIFIERKEY_RSHIFT][0] = i;
-#else
- info->modifierKeycodes[NX_MODIFIERKEY_SHIFT][0] = i;
-#endif
- info->modMap[MIN_KEYCODE + i] = ShiftMask;
- break;
-
- case XK_Control_L:
- info->modifierKeycodes[NX_MODIFIERKEY_CONTROL][0] = i;
- info->modMap[MIN_KEYCODE + i] = ControlMask;
- break;
-
- case XK_Control_R:
-#ifdef NX_MODIFIERKEY_RCONTROL
- info->modifierKeycodes[NX_MODIFIERKEY_RCONTROL][0] = i;
-#else
- info->modifierKeycodes[NX_MODIFIERKEY_CONTROL][0] = i;
-#endif
- info->modMap[MIN_KEYCODE + i] = ControlMask;
- break;
-
- case XK_Caps_Lock:
- info->modifierKeycodes[NX_MODIFIERKEY_ALPHALOCK][0] = i;
- info->modMap[MIN_KEYCODE + i] = LockMask;
- break;
-
- case XK_Alt_L:
- info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i;
- info->modMap[MIN_KEYCODE + i] = Mod1Mask;
- *k = XK_Mode_switch; // Yes, this is ugly. This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor.
- break;
-
- case XK_Alt_R:
-#ifdef NX_MODIFIERKEY_RALTERNATE
- info->modifierKeycodes[NX_MODIFIERKEY_RALTERNATE][0] = i;
-#else
- info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i;
-#endif
- *k = XK_Mode_switch; // Yes, this is ugly. This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor.
- info->modMap[MIN_KEYCODE + i] = Mod1Mask;
- break;
-
- case XK_Mode_switch:
- info->modMap[MIN_KEYCODE + i] = Mod1Mask;
- break;
-
- case XK_Meta_L:
- info->modifierKeycodes[NX_MODIFIERKEY_COMMAND][0] = i;
- info->modMap[MIN_KEYCODE + i] = Mod2Mask;
- break;
-
- case XK_Meta_R:
-#ifdef NX_MODIFIERKEY_RCOMMAND
- info->modifierKeycodes[NX_MODIFIERKEY_RCOMMAND][0] = i;
-#else
- info->modifierKeycodes[NX_MODIFIERKEY_COMMAND][0] = i;
-#endif
- info->modMap[MIN_KEYCODE + i] = Mod2Mask;
- break;
-
- case XK_Num_Lock:
- info->modMap[MIN_KEYCODE + i] = Mod3Mask;
- break;
- }
- }
-}
-
-/*
- * DarwinLoadKeyboardMapping
- * Load the keyboard map from a file or system and convert
- * it to an equivalent X keyboard map and modifier map.
- */
-static void DarwinLoadKeyboardMapping(KeySymsRec *keySyms) {
- void* callstack[128];
- int i, frames = backtrace(callstack, 128);
- char** strs = backtrace_symbols(callstack, frames);
- for (i = 0; i < frames; ++i) {
- ErrorF("%s\n", strs[i]);
- }
- free(strs);
-
- memset(keyInfo.keyMap, 0, sizeof(keyInfo.keyMap));
-
- /* TODO: Clean this up
- * QuartzReadSystemKeymap is in quartz/quartzKeyboard.c
- * DarwinParseNXKeyMapping is here
- */
- if (!DarwinParseNXKeyMapping(&keyInfo)) {
- DEBUG_LOG("DarwinParseNXKeyMapping returned 0... running QuartzReadSystemKeymap().\n");
- if (!QuartzReadSystemKeymap(&keyInfo)) {
- FatalError("Could not build a valid keymap.");
- }
- }
-
- DarwinBuildModifierMaps(&keyInfo);
-
-#ifdef DUMP_DARWIN_KEYMAP
- int i;
- KeySym *k;
- DEBUG_LOG("Darwin -> X converted keyboard map\n");
- for (i = 0, k = keyInfo.keyMap; i < NX_NUMKEYCODES;
- i++, k += GLYPHS_PER_KEY)
- {
- int j;
- for (j = 0; j < GLYPHS_PER_KEY; j++) {
- if (k[j] == NoSymbol) {
- DEBUG_LOG("0x%02x:\tNoSym\n", i);
- } else {
- DEBUG_LOG("0x%02x:\t0x%lx\n", i, k[j]);
- }
- }
- }
-#endif
-
- keySyms->map = keyInfo.keyMap;
- keySyms->mapWidth = GLYPHS_PER_KEY;
- keySyms->minKeyCode = MIN_KEYCODE;
- keySyms->maxKeyCode = MAX_KEYCODE;
-}
-
-
-/*
- * DarwinKeyboardInit
- * Get the Darwin keyboard map and compute an equivalent
- * X keyboard map and modifier map. Set the new keyboard
- * device structure.
- */
-void DarwinKeyboardInit(DeviceIntPtr pDev) {
- KeySymsRec keySyms;
-
- // Open a shared connection to the HID System.
- // Note that the Event Status Driver is really just a wrapper
- // for a kIOHIDParamConnectType connection.
- assert( darwinParamConnect = NXOpenEventStatus() );
-
- DarwinLoadKeyboardMapping(&keySyms);
- // DarwinKeyboardReload(pDev);
- /* Initialize the seed, so we don't reload the keymap unnecessarily
- (and possibly overwrite xinitrc changes) */
- QuartzSystemKeymapSeed();
-
- assert( InitKeyboardDeviceStruct( (DevicePtr)pDev, &keySyms,
- keyInfo.modMap, QuartzBell,
- DarwinChangeKeyboardControl ));
-}
-
-
-/* Borrowed from dix/devices.c */
-static Bool InitModMap(register KeyClassPtr keyc) {
- int i, j;
- CARD8 keysPerModifier[8];
- CARD8 mask;
-
- // darwinKeyc = keyc;
- if (keyc->modifierKeyMap != NULL)
- xfree (keyc->modifierKeyMap);
-
- keyc->maxKeysPerModifier = 0;
- for (i = 0; i < 8; i++)
- keysPerModifier[i] = 0;
- for (i = 8; i < MAP_LENGTH; i++)
- {
- for (j = 0, mask = 1; j < 8; j++, mask <<= 1)
- {
- if (mask & keyc->modifierMap[i])
- {
- if (++keysPerModifier[j] > keyc->maxKeysPerModifier)
- keyc->maxKeysPerModifier = keysPerModifier[j];
- }
- }
- }
- keyc->modifierKeyMap = (KeyCode *)xalloc(8*keyc->maxKeysPerModifier);
- if (!keyc->modifierKeyMap && keyc->maxKeysPerModifier)
- return (FALSE);
- bzero((char *)keyc->modifierKeyMap, 8*(int)keyc->maxKeysPerModifier);
- for (i = 0; i < 8; i++)
- keysPerModifier[i] = 0;
- for (i = 8; i < MAP_LENGTH; i++)
- {
- for (j = 0, mask = 1; j < 8; j++, mask <<= 1)
- {
- if (mask & keyc->modifierMap[i])
- {
- keyc->modifierKeyMap[(j*keyc->maxKeysPerModifier) +
- keysPerModifier[j]] = i;
- keysPerModifier[j]++;
- }
- }
- }
- return TRUE;
-}
-
-
-void DarwinKeyboardReloadHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents) {
- KeySymsRec keySyms;
- if (dev == NULL) dev = darwinKeyboard;
-
- DEBUG_LOG("DarwinKeyboardReloadHandler(%p)\n", dev);
- DarwinLoadKeyboardMapping(&keySyms);
-
- if (SetKeySymsMap(&dev->key->curKeySyms, &keySyms)) {
- /* now try to update modifiers. */
-
- memmove(dev->key->modifierMap, keyInfo.modMap, MAP_LENGTH);
- InitModMap(dev->key);
- } else DEBUG_LOG("SetKeySymsMap=0\n");
-
- SendMappingNotify(MappingKeyboard, MIN_KEYCODE, NUM_KEYCODES, 0);
- SendMappingNotify(MappingModifier, 0, 0, 0);
-}
-
-
-//-----------------------------------------------------------------------------
-// Modifier translation functions
-//
-// There are three different ways to specify a Mac modifier key:
-// keycode - specifies hardware key, read from keymapping
-// key - NX_MODIFIERKEY_*, really an index
-// mask - NX_*MASK, mask for modifier flags in event record
-// Left and right side have different keycodes but the same key and mask.
-//-----------------------------------------------------------------------------
-
-/*
- * DarwinModifierNXKeyToNXKeycode
- * Return the keycode for an NX_MODIFIERKEY_* modifier.
- * side = 0 for left or 1 for right.
- * Returns 0 if key+side is not a known modifier.
- */
-int DarwinModifierNXKeyToNXKeycode(int key, int side) {
- return keyInfo.modifierKeycodes[key][side];
-}
-
-/*
- * DarwinModifierNXKeycodeToNXKey
- * Returns -1 if keycode+side is not a modifier key
- * outSide may be NULL, else it gets 0 for left and 1 for right.
- */
-int DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide) {
- int key, side;
-
- keycode += MIN_KEYCODE;
- // search modifierKeycodes for this keycode+side
- for (key = 0; key < NX_NUMMODIFIERS; key++) {
- for (side = 0; side <= 1; side++) {
- if (keyInfo.modifierKeycodes[key][side] == keycode) break;
- }
- }
- if (key == NX_NUMMODIFIERS) return -1;
- if (outSide) *outSide = side;
- return key;
-}
-
-/*
- * DarwinModifierNXMaskToNXKey
- * Returns -1 if mask is not a known modifier mask.
- */
-int DarwinModifierNXMaskToNXKey(int mask) {
- switch (mask) {
- case NX_ALPHASHIFTMASK: return NX_MODIFIERKEY_ALPHALOCK;
- case NX_SHIFTMASK: return NX_MODIFIERKEY_SHIFT;
-#ifdef NX_DEVICELSHIFTKEYMASK
- case NX_DEVICELSHIFTKEYMASK: return NX_MODIFIERKEY_SHIFT;
- case NX_DEVICERSHIFTKEYMASK: return NX_MODIFIERKEY_RSHIFT;
-#endif
- case NX_CONTROLMASK: return NX_MODIFIERKEY_CONTROL;
-#ifdef NX_DEVICELCTLKEYMASK
- case NX_DEVICELCTLKEYMASK: return NX_MODIFIERKEY_CONTROL;
- case NX_DEVICERCTLKEYMASK: return NX_MODIFIERKEY_RCONTROL;
-#endif
- case NX_ALTERNATEMASK: return NX_MODIFIERKEY_ALTERNATE;
-#ifdef NX_DEVICELALTKEYMASK
- case NX_DEVICELALTKEYMASK: return NX_MODIFIERKEY_ALTERNATE;
- case NX_DEVICERALTKEYMASK: return NX_MODIFIERKEY_RALTERNATE;
-#endif
- case NX_COMMANDMASK: return NX_MODIFIERKEY_COMMAND;
-#ifdef NX_DEVICELCMDKEYMASK
- case NX_DEVICELCMDKEYMASK: return NX_MODIFIERKEY_COMMAND;
- case NX_DEVICERCMDKEYMASK: return NX_MODIFIERKEY_RCOMMAND;
-#endif
- case NX_NUMERICPADMASK: return NX_MODIFIERKEY_NUMERICPAD;
- case NX_HELPMASK: return NX_MODIFIERKEY_HELP;
- case NX_SECONDARYFNMASK: return NX_MODIFIERKEY_SECONDARYFN;
- }
- return -1;
-}
-
-static const char *DarwinModifierNXMaskTostring(int mask) {
- switch (mask) {
- case NX_ALPHASHIFTMASK: return "NX_ALPHASHIFTMASK";
- case NX_SHIFTMASK: return "NX_SHIFTMASK";
- case NX_DEVICELSHIFTKEYMASK: return "NX_DEVICELSHIFTKEYMASK";
- case NX_DEVICERSHIFTKEYMASK: return "NX_DEVICERSHIFTKEYMASK";
- case NX_CONTROLMASK: return "NX_CONTROLMASK";
- case NX_DEVICELCTLKEYMASK: return "NX_DEVICELCTLKEYMASK";
- case NX_DEVICERCTLKEYMASK: return "NX_DEVICERCTLKEYMASK";
- case NX_ALTERNATEMASK: return "NX_ALTERNATEMASK";
- case NX_DEVICELALTKEYMASK: return "NX_DEVICELALTKEYMASK";
- case NX_DEVICERALTKEYMASK: return "NX_DEVICERALTKEYMASK";
- case NX_COMMANDMASK: return "NX_COMMANDMASK";
- case NX_DEVICELCMDKEYMASK: return "NX_DEVICELCMDKEYMASK";
- case NX_DEVICERCMDKEYMASK: return "NX_DEVICERCMDKEYMASK";
- case NX_NUMERICPADMASK: return "NX_NUMERICPADMASK";
- case NX_HELPMASK: return "NX_HELPMASK";
- case NX_SECONDARYFNMASK: return "NX_SECONDARYFNMASK";
- }
- return "unknown mask";
-}
-
-/*
- * DarwinModifierNXKeyToNXMask
- * Returns 0 if key is not a known modifier key.
- */
-int DarwinModifierNXKeyToNXMask(int key) {
- switch (key) {
- case NX_MODIFIERKEY_ALPHALOCK: return NX_ALPHASHIFTMASK;
- case NX_MODIFIERKEY_SHIFT: return NX_SHIFTMASK;
-#ifdef NX_MODIFIERKEY_RSHIFT
- case NX_MODIFIERKEY_RSHIFT: return NX_SHIFTMASK;
-#endif
- case NX_MODIFIERKEY_CONTROL: return NX_CONTROLMASK;
-#ifdef NX_MODIFIERKEY_RCONTROL
- case NX_MODIFIERKEY_RCONTROL: return NX_CONTROLMASK;
-#endif
- case NX_MODIFIERKEY_ALTERNATE: return NX_ALTERNATEMASK;
-#ifdef NX_MODIFIERKEY_RALTERNATE
- case NX_MODIFIERKEY_RALTERNATE: return NX_ALTERNATEMASK;
-#endif
- case NX_MODIFIERKEY_COMMAND: return NX_COMMANDMASK;
-#ifdef NX_MODIFIERKEY_RCOMMAND
- case NX_MODIFIERKEY_RCOMMAND: return NX_COMMANDMASK;
-#endif
- case NX_MODIFIERKEY_NUMERICPAD: return NX_NUMERICPADMASK;
- case NX_MODIFIERKEY_HELP: return NX_HELPMASK;
- case NX_MODIFIERKEY_SECONDARYFN: return NX_SECONDARYFNMASK;
- }
- return 0;
-}
-
-/*
- * DarwinModifierStringToNXKey
- * Returns -1 if string is not a known modifier.
- */
-int DarwinModifierStringToNXKey(const char *str) {
- if (!strcasecmp(str, "shift")) return NX_MODIFIERKEY_SHIFT;
- else if (!strcasecmp(str, "control")) return NX_MODIFIERKEY_CONTROL;
- else if (!strcasecmp(str, "option")) return NX_MODIFIERKEY_ALTERNATE;
- else if (!strcasecmp(str, "command")) return NX_MODIFIERKEY_COMMAND;
- else if (!strcasecmp(str, "fn")) return NX_MODIFIERKEY_SECONDARYFN;
- else return -1;
-}
-
-/*
- * LegalModifier
- * This allows the ddx layer to prevent some keys from being remapped
- * as modifier keys.
- */
-Bool LegalModifier(unsigned int key, DeviceIntPtr pDev)
-{
- return 1;
-}
diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index 96dc021a6..4d03d02fb 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -28,6 +28,8 @@
* use or other dealings in this Software without prior written authorization.
*/
+#include "sanitizedCarbon.h"
+
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -52,7 +54,7 @@
#include "windowstr.h"
#include "colormapst.h"
#include "globals.h"
-#include "rootlessWindow.h"
+#include "mi.h"
// System headers
#include <sys/types.h>
diff --git a/hw/xquartz/quartz.h b/hw/xquartz/quartz.h
index ffe06f9c6..e11602391 100644
--- a/hw/xquartz/quartz.h
+++ b/hw/xquartz/quartz.h
@@ -131,4 +131,9 @@ void QuartzInitInput(int argc, char **argv);
void QuartzGiveUp(void);
void QuartzProcessEvent(xEvent *xe);
void QuartzDisplayChangedHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents);
+
+void QuartzShow(int x, int y); // (x, y) = cursor loc
+void QuartzHide(void);
+void QuartzSetRootClip(BOOL enable);
+void QuartzSpaceChanged(uint32_t space_id);
#endif
diff --git a/hw/xquartz/quartzAudio.c b/hw/xquartz/quartzAudio.c
index 5dee32f54..d3698d7c9 100644
--- a/hw/xquartz/quartzAudio.c
+++ b/hw/xquartz/quartzAudio.c
@@ -36,6 +36,8 @@
* use or other dealings in this Software without prior written authorization.
*/
+#include "sanitizedCarbon.h"
+
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
diff --git a/hw/xquartz/quartzCocoa.m b/hw/xquartz/quartzCocoa.m
index d8f9c69e4..aa4b9fb1e 100644
--- a/hw/xquartz/quartzCocoa.m
+++ b/hw/xquartz/quartzCocoa.m
@@ -32,6 +32,8 @@
* use or other dealings in this Software without prior written authorization.
*/
+#include "sanitizedCocoa.h"
+
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -40,12 +42,8 @@
#include "inputstr.h"
#include "quartzPasteboard.h"
-#define BOOL xBOOL
#include "darwin.h"
-#include <Cocoa/Cocoa.h>
-#undef BOOL
-
#include "pseudoramiX.h"
extern void FatalError(const char *, ...);
diff --git a/hw/xquartz/quartzCommon.h b/hw/xquartz/quartzCommon.h
index c4bd2d803..e63c2b760 100644
--- a/hw/xquartz/quartzCommon.h
+++ b/hw/xquartz/quartzCommon.h
@@ -35,17 +35,6 @@
#ifndef _QUARTZCOMMON_H
#define _QUARTZCOMMON_H
-// QuickDraw in ApplicationServices has the following conflicts with
-// the basic X server headers. Use QD_<name> to use the QuickDraw
-// definition of any of these symbols, or the normal name for the
-// X11 definition.
-#define Cursor QD_Cursor
-#define WindowPtr QD_WindowPtr
-#define Picture QD_Picture
-#include <ApplicationServices/ApplicationServices.h>
-#undef Cursor
-#undef WindowPtr
-#undef Picture
#include <X11/Xdefs.h>
#include "privates.h"
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 9b899ca67..698f39a22 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -1,51 +1,77 @@
/*
- quartzKeyboard.c
-
- Code to build a keymap using the Carbon Keyboard Layout API.
-
- Copyright (c) 2003-2007 Apple Inc.
-
- 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 ABOVE LISTED COPYRIGHT
- HOLDER(S) 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(s) of the above
- copyright holders shall not be used in advertising or otherwise to
- promote the sale, use or other dealings in this Software without
- prior written authorization.
+ quartzKeyboard.c: Keyboard support for Xquartz
+
+ Copyright (c) 2003-2008 Apple Inc.
+ Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved.
+ Copyright 2004 Kaleb S. KEITHLEY. All Rights Reserved.
+
+ The code to parse the Darwin keymap is derived from dumpkeymap.c
+ by Eric Sunshine, which includes the following copyright:
+
+ Copyright (C) 1999,2000 by Eric Sunshine <sunshine@sunshineco.com>
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
+ NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "sanitizedCarbon.h"
+
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
-#include "quartzCommon.h"
+// Define this to get a diagnostic output to stderr which is helpful
+// in determining how the X server is interpreting the Darwin keymap.
+#define DUMP_DARWIN_KEYMAP
+#define XQUARTZ_USE_XKB
+#define HACK_MISSING 1
+#define HACK_KEYPAD 1
-#include <CoreServices/CoreServices.h>
-#include <Carbon/Carbon.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/stat.h>
+
+#include "quartzCommon.h"
+#include "darwin.h"
#include "quartzKeyboard.h"
+#include "quartzAudio.h"
+
+#ifdef NDEBUG
+#undef NDEBUG
+#include <assert.h>
+#define NDEBUG 1
+#else
+#include <assert.h>
+#endif
+
+#include "xkbsrv.h"
+#include "exevents.h"
#include "X11/keysym.h"
#include "keysym2ucs.h"
-#define HACK_MISSING 1
-#define HACK_KEYPAD 1
+void QuartzXkbUpdate(DeviceIntPtr pDev);
enum {
MOD_COMMAND = 256,
@@ -56,6 +82,143 @@ enum {
#define UKEYSYM(u) ((u) | 0x01000000)
+#define AltMask Mod1Mask
+#define MetaMask Mod2Mask
+#define FunctionMask Mod3Mask
+
+#define UK(a) NoSymbol // unknown symbol
+
+static KeySym const next_to_x[256] = {
+ NoSymbol, NoSymbol, NoSymbol, XK_KP_Enter,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
+ NoSymbol, XK_Return, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, XK_Escape,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
+ XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
+ XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
+ XK_comma, XK_minus, XK_period, XK_slash,
+ XK_0, XK_1, XK_2, XK_3,
+ XK_4, XK_5, XK_6, XK_7,
+ XK_8, XK_9, XK_colon, XK_semicolon,
+ XK_less, XK_equal, XK_greater, XK_question,
+ XK_at, XK_A, XK_B, XK_C,
+ XK_D, XK_E, XK_F, XK_G,
+ XK_H, XK_I, XK_J, XK_K,
+ XK_L, XK_M, XK_N, XK_O,
+ XK_P, XK_Q, XK_R, XK_S,
+ XK_T, XK_U, XK_V, XK_W,
+ XK_X, XK_Y, XK_Z, XK_bracketleft,
+ XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
+ XK_grave, XK_a, XK_b, XK_c,
+ XK_d, XK_e, XK_f, XK_g,
+ XK_h, XK_i, XK_j, XK_k,
+ XK_l, XK_m, XK_n, XK_o,
+ XK_p, XK_q, XK_r, XK_s,
+ XK_t, XK_u, XK_v, XK_w,
+ XK_x, XK_y, XK_z, XK_braceleft,
+ XK_bar, XK_braceright, XK_asciitilde, XK_BackSpace,
+// 128
+ NoSymbol, XK_Agrave, XK_Aacute, XK_Acircumflex,
+ XK_Atilde, XK_Adiaeresis, XK_Aring, XK_Ccedilla,
+ XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis,
+ XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis,
+// 144
+ XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute,
+ XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_Ugrave,
+ XK_Uacute, XK_Ucircumflex, XK_Udiaeresis, XK_Yacute,
+ XK_THORN, XK_mu, XK_multiply, XK_division,
+// 160
+ XK_copyright, XK_exclamdown, XK_cent, XK_sterling,
+ UK(fraction), XK_yen, UK(fhook), XK_section,
+ XK_currency, XK_rightsinglequotemark,
+ XK_leftdoublequotemark,
+ XK_guillemotleft,
+ XK_leftanglebracket,
+ XK_rightanglebracket,
+ UK(filigature), UK(flligature),
+// 176
+ XK_registered, XK_endash, XK_dagger, XK_doubledagger,
+ XK_periodcentered,XK_brokenbar, XK_paragraph, UK(bullet),
+ XK_singlelowquotemark,
+ XK_doublelowquotemark,
+ XK_rightdoublequotemark,
+ XK_guillemotright,
+ XK_ellipsis, UK(permille), XK_notsign, XK_questiondown,
+// 192
+ XK_onesuperior, XK_dead_grave, XK_dead_acute, XK_dead_circumflex,
+ XK_dead_tilde, XK_dead_macron, XK_dead_breve, XK_dead_abovedot,
+ XK_dead_diaeresis,
+ XK_twosuperior, XK_dead_abovering,
+ XK_dead_cedilla,
+ XK_threesuperior,
+ XK_dead_doubleacute,
+ XK_dead_ogonek, XK_dead_caron,
+// 208
+ XK_emdash, XK_plusminus, XK_onequarter, XK_onehalf,
+ XK_threequarters,
+ XK_agrave, XK_aacute, XK_acircumflex,
+ XK_atilde, XK_adiaeresis, XK_aring, XK_ccedilla,
+ XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis,
+// 224
+ XK_igrave, XK_AE, XK_iacute, XK_ordfeminine,
+ XK_icircumflex, XK_idiaeresis, XK_eth, XK_ntilde,
+ XK_Lstroke, XK_Ooblique, XK_OE, XK_masculine,
+ XK_ograve, XK_oacute, XK_ocircumflex, XK_otilde,
+// 240
+ XK_odiaeresis, XK_ae, XK_ugrave, XK_uacute,
+ XK_ucircumflex, XK_idotless, XK_udiaeresis, XK_ygrave,
+ XK_lstroke, XK_ooblique, XK_oe, XK_ssharp,
+ XK_thorn, XK_ydiaeresis, NoSymbol, NoSymbol,
+ };
+
+#define MIN_SYMBOL 0xAC
+static KeySym const symbol_to_x[] = {
+ XK_Left, XK_Up, XK_Right, XK_Down
+ };
+static int const NUM_SYMBOL = sizeof(symbol_to_x) / sizeof(symbol_to_x[0]);
+
+#define MIN_FUNCKEY 0x20
+static KeySym const funckey_to_x[] = {
+ XK_F1, XK_F2, XK_F3, XK_F4,
+ XK_F5, XK_F6, XK_F7, XK_F8,
+ XK_F9, XK_F10, XK_F11, XK_F12,
+ XK_Insert, XK_Delete, XK_Home, XK_End,
+ XK_Page_Up, XK_Page_Down, XK_F13, XK_F14,
+ XK_F15
+ };
+static int const NUM_FUNCKEY = sizeof(funckey_to_x) / sizeof(funckey_to_x[0]);
+
+typedef struct {
+ KeySym normalSym;
+ KeySym keypadSym;
+} darwinKeyPad_t;
+
+static darwinKeyPad_t const normal_to_keypad[] = {
+ { XK_0, XK_KP_0 },
+ { XK_1, XK_KP_1 },
+ { XK_2, XK_KP_2 },
+ { XK_3, XK_KP_3 },
+ { XK_4, XK_KP_4 },
+ { XK_5, XK_KP_5 },
+ { XK_6, XK_KP_6 },
+ { XK_7, XK_KP_7 },
+ { XK_8, XK_KP_8 },
+ { XK_9, XK_KP_9 },
+ { XK_equal, XK_KP_Equal },
+ { XK_asterisk, XK_KP_Multiply },
+ { XK_plus, XK_KP_Add },
+ { XK_comma, XK_KP_Separator },
+ { XK_minus, XK_KP_Subtract },
+ { XK_period, XK_KP_Decimal },
+ { XK_slash, XK_KP_Divide }
+};
+
+static int const NUM_KEYPAD = sizeof(normal_to_keypad) / sizeof(normal_to_keypad[0]);
+
/* Table of keycode->keysym mappings we use to fallback on for important
keys that are often not in the Unicode mapping. */
@@ -146,6 +309,783 @@ const static struct {
{UKEYSYM (0x31b), XK_dead_horn}, /* COMBINING HORN */
};
+darwinKeyboardInfo keyInfo;
+static FILE *fref = NULL;
+static char *inBuffer = NULL;
+
+static void DarwinChangeKeyboardControl( DeviceIntPtr device, KeybdCtrl *ctrl )
+{
+ // FIXME: to be implemented
+ // keyclick, bell volume / pitch, autorepead, LED's
+}
+
+//-----------------------------------------------------------------------------
+// Data Stream Object
+// Can be configured to treat embedded "numbers" as being composed of
+// either 1, 2, or 4 bytes, apiece.
+//-----------------------------------------------------------------------------
+typedef struct _DataStream {
+ unsigned char const *data;
+ unsigned char const *data_end;
+ short number_size; // Size in bytes of a "number" in the stream.
+} DataStream;
+
+static DataStream* new_data_stream(unsigned char const* data, int size) {
+ DataStream* s = (DataStream*)xalloc( sizeof(DataStream) );
+ if(s) {
+ s->data = data;
+ s->data_end = data + size;
+ s->number_size = 1; // Default to byte-sized numbers.
+ }
+ return s;
+}
+
+static void destroy_data_stream(DataStream* s) {
+ xfree(s);
+}
+
+static unsigned char get_byte(DataStream* s) {
+ assert(s->data + 1 <= s->data_end);
+ return *s->data++;
+}
+
+static short get_word(DataStream* s) {
+ short hi, lo;
+ assert(s->data + 2 <= s->data_end);
+ hi = *s->data++;
+ lo = *s->data++;
+ return ((hi << 8) | lo);
+}
+
+static int get_dword(DataStream* s) {
+ int b1, b2, b3, b4;
+ assert(s->data + 4 <= s->data_end);
+ b4 = *s->data++;
+ b3 = *s->data++;
+ b2 = *s->data++;
+ b1 = *s->data++;
+ return ((b4 << 24) | (b3 << 16) | (b2 << 8) | b1);
+}
+
+static int get_number(DataStream* s) {
+ switch (s->number_size) {
+ case 4: return get_dword(s);
+ case 2: return get_word(s);
+ default: return get_byte(s);
+ }
+}
+
+//-----------------------------------------------------------------------------
+// Utility functions to help parse Darwin keymap
+//-----------------------------------------------------------------------------
+
+/*
+ * bits_set
+ * Calculate number of bits set in the modifier mask.
+ */
+static short bits_set(short mask) {
+ short n = 0;
+
+ for ( ; mask != 0; mask >>= 1)
+ if ((mask & 0x01) != 0)
+ n++;
+ return n;
+}
+
+/*
+ * parse_next_char_code
+ * Read the next character code from the Darwin keymapping
+ * and write it to the X keymap.
+ */
+static void parse_next_char_code(DataStream *s, KeySym *k) {
+ const short charSet = get_number(s);
+ const short charCode = get_number(s);
+
+ if (charSet == 0) { // ascii character
+ if (charCode >= 0 && charCode < 256)
+ *k = next_to_x[charCode];
+ } else if (charSet == 0x01) { // symbol character
+ if (charCode >= MIN_SYMBOL &&
+ charCode <= MIN_SYMBOL + NUM_SYMBOL)
+ *k = symbol_to_x[charCode - MIN_SYMBOL];
+ } else if (charSet == 0xFE) { // function key
+ if (charCode >= MIN_FUNCKEY &&
+ charCode <= MIN_FUNCKEY + NUM_FUNCKEY)
+ *k = funckey_to_x[charCode - MIN_FUNCKEY];
+ }
+}
+
+
+/*
+ * DarwinReadKeymapFile
+ * Read the appropriate keymapping from a keymapping file.
+ */
+static Bool DarwinReadKeymapFile(NXKeyMapping *keyMap) {
+ struct stat st;
+ NXEventSystemDevice info[20];
+ int interface = 0, handler_id = 0;
+ int map_interface, map_handler_id, map_size = 0;
+ unsigned int i, size;
+ int *bufferEnd;
+ union km_tag {
+ int *intP;
+ char *charP;
+ } km;
+
+ fref = fopen( darwinKeymapFile, "rb" );
+ if (fref == NULL) {
+ ErrorF("Unable to open keymapping file '%s': %s.\n",
+ darwinKeymapFile, strerror(errno));
+ return FALSE;
+ }
+ if (fstat(fileno(fref), &st) == -1) {
+ ErrorF("Could not stat keymapping file '%s': %s.\n",
+ darwinKeymapFile, strerror(errno));
+ return FALSE;
+ }
+
+ // check to make sure we don't crash later
+ if (st.st_size <= 16*sizeof(int)) {
+ ErrorF("Keymapping file '%s' is invalid (too small).\n",
+ darwinKeymapFile);
+ return FALSE;
+ }
+
+ inBuffer = (char*) xalloc( st.st_size );
+ bufferEnd = (int *) (inBuffer + st.st_size);
+ if (fread(inBuffer, st.st_size, 1, fref) != 1) {
+ ErrorF("Could not read %qd bytes from keymapping file '%s': %s.\n",
+ st.st_size, darwinKeymapFile, strerror(errno));
+ return FALSE;
+ }
+
+ if (strncmp( inBuffer, "KYM1", 4 ) == 0) {
+ // Magic number OK.
+ } else if (strncmp( inBuffer, "KYMP", 4 ) == 0) {
+ ErrorF("Keymapping file '%s' is intended for use with the original NeXT keyboards and cannot be used by XDarwin.\n", darwinKeymapFile);
+ return FALSE;
+ } else {
+ ErrorF("Keymapping file '%s' has a bad magic number and cannot be used by XDarwin.\n", darwinKeymapFile);
+ return FALSE;
+ }
+
+ // find the keyboard interface and handler id
+ size = sizeof( info ) / sizeof( int );
+ if (!NXEventSystemInfo( darwinParamConnect, NX_EVS_DEVICE_INFO,
+ (NXEventSystemInfoType) info, &size )) {
+ ErrorF("Error reading event status driver info.\n");
+ return FALSE;
+ }
+
+ size = size * sizeof( int ) / sizeof( info[0] );
+ for( i = 0; i < size; i++) {
+ if (info[i].dev_type == NX_EVS_DEVICE_TYPE_KEYBOARD) {
+ Bool hasInterface = FALSE;
+ Bool hasMatch = FALSE;
+
+ interface = info[i].interface;
+ handler_id = info[i].id;
+
+ // Find an appropriate keymapping:
+ // The first time we try to match both interface and handler_id.
+ // If we can't match both, we take the first match for interface.
+
+ do {
+ km.charP = inBuffer;
+ km.intP++;
+ while (km.intP+3 < bufferEnd) {
+ map_interface = NXSwapBigIntToHost(*(km.intP++));
+ map_handler_id = NXSwapBigIntToHost(*(km.intP++));
+ map_size = NXSwapBigIntToHost(*(km.intP++));
+ if (map_interface == interface) {
+ if (map_handler_id == handler_id || hasInterface) {
+ hasMatch = TRUE;
+ break;
+ } else {
+ hasInterface = TRUE;
+ }
+ }
+ km.charP += map_size;
+ }
+ } while (hasInterface && !hasMatch);
+
+ if (hasMatch) {
+ // fill in NXKeyMapping structure
+ keyMap->size = map_size;
+ keyMap->mapping = (char*) xalloc(map_size);
+ memcpy(keyMap->mapping, km.charP, map_size);
+ return TRUE;
+ }
+ } // if dev_id == keyboard device
+ } // foreach info struct
+
+ // The keymapping file didn't match any of the info structs
+ // returned by NXEventSystemInfo.
+ ErrorF("Keymapping file '%s' did not contain appropriate keyboard interface.\n", darwinKeymapFile);
+ return FALSE;
+}
+
+
+/*
+ * DarwinParseNXKeyMapping
+ */
+static Bool DarwinParseNXKeyMapping(darwinKeyboardInfo *info) {
+ KeySym *k;
+ int i;
+ short numMods, numKeys, numPadKeys = 0;
+ Bool haveKeymap = FALSE;
+ NXKeyMapping keyMap;
+ DataStream *keyMapStream;
+ unsigned char const *numPadStart = 0;
+
+ if (darwinKeymapFile) {
+ haveKeymap = DarwinReadKeymapFile(&keyMap);
+ if (fref)
+ fclose(fref);
+ if (inBuffer)
+ xfree(inBuffer);
+ if (!haveKeymap) {
+ ErrorF("Reverting to kernel keymapping.\n");
+ }
+ }
+
+ if (!haveKeymap) {
+ // get the Darwin keyboard map
+ keyMap.size = NXKeyMappingLength( darwinParamConnect );
+ keyMap.mapping = (char*) xalloc( keyMap.size );
+ if (!NXGetKeyMapping( darwinParamConnect, &keyMap )) {
+ return FALSE;
+ }
+ }
+
+ keyMapStream = new_data_stream( (unsigned char const*)keyMap.mapping,
+ keyMap.size );
+
+ // check the type of map
+ if (get_word(keyMapStream)) {
+ keyMapStream->number_size = 2;
+ ErrorF("Current 16-bit keymapping may not be interpreted correctly.\n");
+ }
+
+ // Insert X modifier KeySyms into the keyboard map.
+ numMods = get_number(keyMapStream);
+ while (numMods-- > 0) {
+ int left = 1; // first keycode is left
+ short const charCode = get_number(keyMapStream);
+ short numKeyCodes = get_number(keyMapStream);
+
+ // This is just a marker, not a real modifier.
+ // Store numeric keypad keys for later.
+ if (charCode == NX_MODIFIERKEY_NUMERICPAD) {
+ numPadStart = keyMapStream->data;
+ numPadKeys = numKeyCodes;
+ }
+
+ while (numKeyCodes-- > 0) {
+ const short keyCode = get_number(keyMapStream);
+ if (charCode != NX_MODIFIERKEY_NUMERICPAD) {
+ switch (charCode) {
+ case NX_MODIFIERKEY_ALPHALOCK:
+ info->keyMap[keyCode * GLYPHS_PER_KEY] = XK_Caps_Lock;
+ break;
+ case NX_MODIFIERKEY_SHIFT:
+ info->keyMap[keyCode * GLYPHS_PER_KEY] =
+ (left ? XK_Shift_L : XK_Shift_R);
+ break;
+ case NX_MODIFIERKEY_CONTROL:
+ info->keyMap[keyCode * GLYPHS_PER_KEY] =
+ (left ? XK_Control_L : XK_Control_R);
+ break;
+ case NX_MODIFIERKEY_ALTERNATE:
+ // info->keyMap[keyCode * GLYPHS_PER_KEY] = XK_Mode_switch;
+ info->keyMap[keyCode * GLYPHS_PER_KEY] =
+ (left ? XK_Alt_L : XK_Alt_R);
+ break;
+ case NX_MODIFIERKEY_COMMAND:
+ info->keyMap[keyCode * GLYPHS_PER_KEY] =
+ (left ? XK_Meta_L : XK_Meta_R);
+ break;
+ case NX_MODIFIERKEY_SECONDARYFN:
+ info->keyMap[keyCode * GLYPHS_PER_KEY] =
+ (left ? XK_Control_L : XK_Control_R);
+ break;
+ case NX_MODIFIERKEY_HELP:
+ // Help is not an X11 modifier; treat as normal key
+ info->keyMap[keyCode * GLYPHS_PER_KEY] = XK_Help;
+ break;
+ }
+ }
+ left = 0;
+ }
+ }
+
+ // Convert the Darwin keyboard mapping to an X keyboard map.
+ // A key can have a different character code for each combination of
+ // modifiers. We currently ignore all modifier combinations except
+ // those with Shift, AlphaLock, and Alt.
+ numKeys = get_number(keyMapStream);
+ for (i = 0, k = info->keyMap; i < numKeys; i++, k += GLYPHS_PER_KEY) {
+ short const charGenMask = get_number(keyMapStream);
+ if (charGenMask != 0xFF) { // is key bound?
+ short numKeyCodes = 1 << bits_set(charGenMask);
+
+ // Record unmodified case
+ parse_next_char_code( keyMapStream, k );
+ numKeyCodes--;
+
+ // If AlphaLock and Shift modifiers produce different codes,
+ // we record the Shift case since X handles AlphaLock.
+ if (charGenMask & 0x01) { // AlphaLock
+ parse_next_char_code( keyMapStream, k+1 );
+ numKeyCodes--;
+ }
+
+ if (charGenMask & 0x02) { // Shift
+ parse_next_char_code( keyMapStream, k+1 );
+ numKeyCodes--;
+
+ if (charGenMask & 0x01) { // Shift-AlphaLock
+ get_number(keyMapStream); get_number(keyMapStream);
+ numKeyCodes--;
+ }
+ }
+
+ // Skip the Control cases
+ if (charGenMask & 0x04) { // Control
+ get_number(keyMapStream); get_number(keyMapStream);
+ numKeyCodes--;
+
+ if (charGenMask & 0x01) { // Control-AlphaLock
+ get_number(keyMapStream); get_number(keyMapStream);
+ numKeyCodes--;
+ }
+
+ if (charGenMask & 0x02) { // Control-Shift
+ get_number(keyMapStream); get_number(keyMapStream);
+ numKeyCodes--;
+
+ if (charGenMask & 0x01) { // Shift-Control-AlphaLock
+ get_number(keyMapStream); get_number(keyMapStream);
+ numKeyCodes--;
+ }
+ }
+ }
+
+ // Process Alt cases
+ if (charGenMask & 0x08) { // Alt
+ parse_next_char_code( keyMapStream, k+2 );
+ numKeyCodes--;
+
+ if (charGenMask & 0x01) { // Alt-AlphaLock
+ parse_next_char_code( keyMapStream, k+3 );
+ numKeyCodes--;
+ }
+
+ if (charGenMask & 0x02) { // Alt-Shift
+ parse_next_char_code( keyMapStream, k+3 );
+ numKeyCodes--;
+
+ if (charGenMask & 0x01) { // Alt-Shift-AlphaLock
+ get_number(keyMapStream); get_number(keyMapStream);
+ numKeyCodes--;
+ }
+ }
+ }
+
+ while (numKeyCodes-- > 0) {
+ get_number(keyMapStream); get_number(keyMapStream);
+ }
+
+ if (k[3] == k[2]) k[3] = NoSymbol;
+ if (k[2] == k[1]) k[2] = NoSymbol;
+ if (k[1] == k[0]) k[1] = NoSymbol;
+ if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol;
+ }
+ }
+
+ // Now we have to go back through the list of keycodes that are on the
+ // numeric keypad and update the X keymap.
+ keyMapStream->data = numPadStart;
+ while(numPadKeys-- > 0) {
+ const short keyCode = get_number(keyMapStream);
+ k = &info->keyMap[keyCode * GLYPHS_PER_KEY];
+ for (i = 0; i < NUM_KEYPAD; i++) {
+ if (*k == normal_to_keypad[i].normalSym) {
+ k[0] = normal_to_keypad[i].keypadSym;
+ break;
+ }
+ }
+ }
+
+ // free Darwin keyboard map
+ destroy_data_stream( keyMapStream );
+ xfree( keyMap.mapping );
+
+ return TRUE;
+}
+
+/*
+ * DarwinBuildModifierMaps
+ * Use the keyMap field of keyboard info structure to populate
+ * the modMap and modifierKeycodes fields.
+ */
+static void DarwinBuildModifierMaps(darwinKeyboardInfo *info) {
+ int i;
+ KeySym *k;
+
+ memset(info->modMap, NoSymbol, sizeof(info->modMap));
+ memset(info->modifierKeycodes, 0, sizeof(info->modifierKeycodes));
+
+ for (i = 0; i < NUM_KEYCODES; i++) {
+ k = info->keyMap + i * GLYPHS_PER_KEY;
+
+ switch (*k) {
+ case XK_Shift_L:
+ info->modifierKeycodes[NX_MODIFIERKEY_SHIFT][0] = i;
+ info->modMap[MIN_KEYCODE + i] = ShiftMask;
+ break;
+
+ case XK_Shift_R:
+#ifdef NX_MODIFIERKEY_RSHIFT
+ info->modifierKeycodes[NX_MODIFIERKEY_RSHIFT][0] = i;
+#else
+ info->modifierKeycodes[NX_MODIFIERKEY_SHIFT][0] = i;
+#endif
+ info->modMap[MIN_KEYCODE + i] = ShiftMask;
+ break;
+
+ case XK_Control_L:
+ info->modifierKeycodes[NX_MODIFIERKEY_CONTROL][0] = i;
+ info->modMap[MIN_KEYCODE + i] = ControlMask;
+ break;
+
+ case XK_Control_R:
+#ifdef NX_MODIFIERKEY_RCONTROL
+ info->modifierKeycodes[NX_MODIFIERKEY_RCONTROL][0] = i;
+#else
+ info->modifierKeycodes[NX_MODIFIERKEY_CONTROL][0] = i;
+#endif
+ info->modMap[MIN_KEYCODE + i] = ControlMask;
+ break;
+
+ case XK_Caps_Lock:
+ info->modifierKeycodes[NX_MODIFIERKEY_ALPHALOCK][0] = i;
+ info->modMap[MIN_KEYCODE + i] = LockMask;
+ break;
+
+ case XK_Alt_L:
+ info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i;
+ info->modMap[MIN_KEYCODE + i] = Mod1Mask;
+ *k = XK_Mode_switch; // Yes, this is ugly. This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor.
+ break;
+
+ case XK_Alt_R:
+#ifdef NX_MODIFIERKEY_RALTERNATE
+ info->modifierKeycodes[NX_MODIFIERKEY_RALTERNATE][0] = i;
+#else
+ info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i;
+#endif
+ *k = XK_Mode_switch; // Yes, this is ugly. This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor.
+ info->modMap[MIN_KEYCODE + i] = Mod1Mask;
+ break;
+
+ case XK_Mode_switch:
+ info->modMap[MIN_KEYCODE + i] = Mod1Mask;
+ break;
+
+ case XK_Meta_L:
+ info->modifierKeycodes[NX_MODIFIERKEY_COMMAND][0] = i;
+ info->modMap[MIN_KEYCODE + i] = Mod2Mask;
+ break;
+
+ case XK_Meta_R:
+#ifdef NX_MODIFIERKEY_RCOMMAND
+ info->modifierKeycodes[NX_MODIFIERKEY_RCOMMAND][0] = i;
+#else
+ info->modifierKeycodes[NX_MODIFIERKEY_COMMAND][0] = i;
+#endif
+ info->modMap[MIN_KEYCODE + i] = Mod2Mask;
+ break;
+
+ case XK_Num_Lock:
+ info->modMap[MIN_KEYCODE + i] = Mod3Mask;
+ break;
+ }
+ }
+}
+
+/*
+ * DarwinLoadKeyboardMapping
+ * Load the keyboard map from a file or system and convert
+ * it to an equivalent X keyboard map and modifier map.
+ */
+static void DarwinLoadKeyboardMapping(KeySymsRec *keySyms) {
+ memset(keyInfo.keyMap, 0, sizeof(keyInfo.keyMap));
+
+ /* TODO: Clean this up
+ * QuartzReadSystemKeymap is in quartz/quartzKeyboard.c
+ * DarwinParseNXKeyMapping is here
+ */
+ if (!DarwinParseNXKeyMapping(&keyInfo)) {
+ DEBUG_LOG("DarwinParseNXKeyMapping returned 0... running QuartzReadSystemKeymap().\n");
+ if (!QuartzReadSystemKeymap(&keyInfo)) {
+ FatalError("Could not build a valid keymap.");
+ }
+ }
+
+ DarwinBuildModifierMaps(&keyInfo);
+
+#ifdef DUMP_DARWIN_KEYMAP
+ int i;
+ KeySym *k;
+ DEBUG_LOG("Darwin -> X converted keyboard map\n");
+ for (i = 0, k = keyInfo.keyMap; i < NX_NUMKEYCODES;
+ i++, k += GLYPHS_PER_KEY)
+ {
+ int j;
+ for (j = 0; j < GLYPHS_PER_KEY; j++) {
+ if (k[j] == NoSymbol) {
+ DEBUG_LOG("0x%02x:\tNoSym\n", i);
+ } else {
+ DEBUG_LOG("0x%02x:\t0x%lx\n", i, k[j]);
+ }
+ }
+ }
+#endif
+
+ keySyms->map = keyInfo.keyMap;
+ keySyms->mapWidth = GLYPHS_PER_KEY;
+ keySyms->minKeyCode = MIN_KEYCODE;
+ keySyms->maxKeyCode = MAX_KEYCODE;
+}
+
+void QuartzXkbUpdate(DeviceIntPtr pDev) {
+#ifdef XQUARTZ_USE_XKB
+ SendDeviceMappingNotify(serverClient, MappingKeyboard,
+ pDev->key->curKeySyms.minKeyCode,
+ pDev->key->curKeySyms.maxKeyCode - pDev->key->curKeySyms.minKeyCode, pDev);
+ SendDeviceMappingNotify(serverClient, MappingModifier, 0, 0, pDev);
+ SwitchCoreKeyboard(pDev);
+#endif
+}
+
+/*
+ * DarwinKeyboardInit
+ * Get the Darwin keyboard map and compute an equivalent
+ * X keyboard map and modifier map. Set the new keyboard
+ * device structure.
+ */
+void DarwinKeyboardInit(DeviceIntPtr pDev) {
+ KeySymsRec keySyms;
+
+ // Open a shared connection to the HID System.
+ // Note that the Event Status Driver is really just a wrapper
+ // for a kIOHIDParamConnectType connection.
+ assert( darwinParamConnect = NXOpenEventStatus() );
+
+ DarwinLoadKeyboardMapping(&keySyms);
+ /* Initialize the seed, so we don't reload the keymap unnecessarily
+ (and possibly overwrite xinitrc changes) */
+ QuartzSystemKeymapSeed();
+
+#ifdef XQUARTZ_USE_XKB
+ XkbComponentNamesRec names;
+ bzero(&names, sizeof(names));
+ XkbSetRulesDflts("base", "pc105", "us", NULL, NULL);
+ assert(XkbInitKeyboardDeviceStruct(pDev, &names, &keySyms, keyInfo.modMap,
+ QuartzBell, DarwinChangeKeyboardControl));
+ assert(SetKeySymsMap(&pDev->key->curKeySyms, &keySyms));
+ assert(keyInfo.modMap!=NULL);
+ assert(pDev->key->modifierMap!=NULL);
+ memcpy(pDev->key->modifierMap, keyInfo.modMap, sizeof(keyInfo.modMap));
+
+ QuartzXkbUpdate(pDev);
+#else
+#error FAIL
+ assert( InitKeyboardDeviceStruct( (DevicePtr)pDev, &keySyms,
+ keyInfo.modMap, QuartzBell,
+ DarwinChangeKeyboardControl ));
+ SwitchCoreKeyboard(pDev);
+#endif
+}
+
+
+void DarwinKeyboardReloadHandler(int screenNum, xEventPtr xe, DeviceIntPtr pDev, int nevents) {
+ if (pDev == NULL) pDev = darwinKeyboard;
+
+ DEBUG_LOG("DarwinKeyboardReloadHandler(%p)\n", pDev);
+
+#ifdef XQUARTZ_USE_XKB
+ QuartzXkbUpdate(pDev);
+#else
+#error FAIL
+ if (pDev->key) {
+ if (pDev->key->curKeySyms.map) xfree(pDev->key->curKeySyms.map);
+ if (pDev->key->modifierKeyMap) xfree(pDev->key->modifierKeyMap);
+ xfree(pDev->key);
+ }
+
+ KeySymsRec keySyms;
+ if (!InitKeyClassDeviceStruct(pDev, &keySyms, keyInfo.modMap)) {
+ DEBUG_LOG("InitKeyClassDeviceStruct failed\n");
+ return;
+ }
+
+ SendMappingNotify(MappingKeyboard, MIN_KEYCODE, NUM_KEYCODES, 0);
+ SendMappingNotify(MappingModifier, 0, 0, 0);
+#endif
+}
+
+
+//-----------------------------------------------------------------------------
+// Modifier translation functions
+//
+// There are three different ways to specify a Mac modifier key:
+// keycode - specifies hardware key, read from keymapping
+// key - NX_MODIFIERKEY_*, really an index
+// mask - NX_*MASK, mask for modifier flags in event record
+// Left and right side have different keycodes but the same key and mask.
+//-----------------------------------------------------------------------------
+
+/*
+ * DarwinModifierNXKeyToNXKeycode
+ * Return the keycode for an NX_MODIFIERKEY_* modifier.
+ * side = 0 for left or 1 for right.
+ * Returns 0 if key+side is not a known modifier.
+ */
+int DarwinModifierNXKeyToNXKeycode(int key, int side) {
+ return keyInfo.modifierKeycodes[key][side];
+}
+
+/*
+ * DarwinModifierNXKeycodeToNXKey
+ * Returns -1 if keycode+side is not a modifier key
+ * outSide may be NULL, else it gets 0 for left and 1 for right.
+ */
+int DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide) {
+ int key, side;
+
+ keycode += MIN_KEYCODE;
+ // search modifierKeycodes for this keycode+side
+ for (key = 0; key < NX_NUMMODIFIERS; key++) {
+ for (side = 0; side <= 1; side++) {
+ if (keyInfo.modifierKeycodes[key][side] == keycode) break;
+ }
+ }
+ if (key == NX_NUMMODIFIERS) return -1;
+ if (outSide) *outSide = side;
+ return key;
+}
+
+/*
+ * DarwinModifierNXMaskToNXKey
+ * Returns -1 if mask is not a known modifier mask.
+ */
+int DarwinModifierNXMaskToNXKey(int mask) {
+ switch (mask) {
+ case NX_ALPHASHIFTMASK: return NX_MODIFIERKEY_ALPHALOCK;
+ case NX_SHIFTMASK: return NX_MODIFIERKEY_SHIFT;
+#ifdef NX_DEVICELSHIFTKEYMASK
+ case NX_DEVICELSHIFTKEYMASK: return NX_MODIFIERKEY_SHIFT;
+ case NX_DEVICERSHIFTKEYMASK: return NX_MODIFIERKEY_RSHIFT;
+#endif
+ case NX_CONTROLMASK: return NX_MODIFIERKEY_CONTROL;
+#ifdef NX_DEVICELCTLKEYMASK
+ case NX_DEVICELCTLKEYMASK: return NX_MODIFIERKEY_CONTROL;
+ case NX_DEVICERCTLKEYMASK: return NX_MODIFIERKEY_RCONTROL;
+#endif
+ case NX_ALTERNATEMASK: return NX_MODIFIERKEY_ALTERNATE;
+#ifdef NX_DEVICELALTKEYMASK
+ case NX_DEVICELALTKEYMASK: return NX_MODIFIERKEY_ALTERNATE;
+ case NX_DEVICERALTKEYMASK: return NX_MODIFIERKEY_RALTERNATE;
+#endif
+ case NX_COMMANDMASK: return NX_MODIFIERKEY_COMMAND;
+#ifdef NX_DEVICELCMDKEYMASK
+ case NX_DEVICELCMDKEYMASK: return NX_MODIFIERKEY_COMMAND;
+ case NX_DEVICERCMDKEYMASK: return NX_MODIFIERKEY_RCOMMAND;
+#endif
+ case NX_NUMERICPADMASK: return NX_MODIFIERKEY_NUMERICPAD;
+ case NX_HELPMASK: return NX_MODIFIERKEY_HELP;
+ case NX_SECONDARYFNMASK: return NX_MODIFIERKEY_SECONDARYFN;
+ }
+ return -1;
+}
+
+static const char *DarwinModifierNXMaskTostring(int mask) {
+ switch (mask) {
+ case NX_ALPHASHIFTMASK: return "NX_ALPHASHIFTMASK";
+ case NX_SHIFTMASK: return "NX_SHIFTMASK";
+ case NX_DEVICELSHIFTKEYMASK: return "NX_DEVICELSHIFTKEYMASK";
+ case NX_DEVICERSHIFTKEYMASK: return "NX_DEVICERSHIFTKEYMASK";
+ case NX_CONTROLMASK: return "NX_CONTROLMASK";
+ case NX_DEVICELCTLKEYMASK: return "NX_DEVICELCTLKEYMASK";
+ case NX_DEVICERCTLKEYMASK: return "NX_DEVICERCTLKEYMASK";
+ case NX_ALTERNATEMASK: return "NX_ALTERNATEMASK";
+ case NX_DEVICELALTKEYMASK: return "NX_DEVICELALTKEYMASK";
+ case NX_DEVICERALTKEYMASK: return "NX_DEVICERALTKEYMASK";
+ case NX_COMMANDMASK: return "NX_COMMANDMASK";
+ case NX_DEVICELCMDKEYMASK: return "NX_DEVICELCMDKEYMASK";
+ case NX_DEVICERCMDKEYMASK: return "NX_DEVICERCMDKEYMASK";
+ case NX_NUMERICPADMASK: return "NX_NUMERICPADMASK";
+ case NX_HELPMASK: return "NX_HELPMASK";
+ case NX_SECONDARYFNMASK: return "NX_SECONDARYFNMASK";
+ }
+ return "unknown mask";
+}
+
+/*
+ * DarwinModifierNXKeyToNXMask
+ * Returns 0 if key is not a known modifier key.
+ */
+int DarwinModifierNXKeyToNXMask(int key) {
+ switch (key) {
+ case NX_MODIFIERKEY_ALPHALOCK: return NX_ALPHASHIFTMASK;
+ case NX_MODIFIERKEY_SHIFT: return NX_SHIFTMASK;
+#ifdef NX_MODIFIERKEY_RSHIFT
+ case NX_MODIFIERKEY_RSHIFT: return NX_SHIFTMASK;
+#endif
+ case NX_MODIFIERKEY_CONTROL: return NX_CONTROLMASK;
+#ifdef NX_MODIFIERKEY_RCONTROL
+ case NX_MODIFIERKEY_RCONTROL: return NX_CONTROLMASK;
+#endif
+ case NX_MODIFIERKEY_ALTERNATE: return NX_ALTERNATEMASK;
+#ifdef NX_MODIFIERKEY_RALTERNATE
+ case NX_MODIFIERKEY_RALTERNATE: return NX_ALTERNATEMASK;
+#endif
+ case NX_MODIFIERKEY_COMMAND: return NX_COMMANDMASK;
+#ifdef NX_MODIFIERKEY_RCOMMAND
+ case NX_MODIFIERKEY_RCOMMAND: return NX_COMMANDMASK;
+#endif
+ case NX_MODIFIERKEY_NUMERICPAD: return NX_NUMERICPADMASK;
+ case NX_MODIFIERKEY_HELP: return NX_HELPMASK;
+ case NX_MODIFIERKEY_SECONDARYFN: return NX_SECONDARYFNMASK;
+ }
+ return 0;
+}
+
+/*
+ * DarwinModifierStringToNXKey
+ * Returns -1 if string is not a known modifier.
+ */
+int DarwinModifierStringToNXKey(const char *str) {
+ if (!strcasecmp(str, "shift")) return NX_MODIFIERKEY_SHIFT;
+ else if (!strcasecmp(str, "control")) return NX_MODIFIERKEY_CONTROL;
+ else if (!strcasecmp(str, "option")) return NX_MODIFIERKEY_ALTERNATE;
+ else if (!strcasecmp(str, "command")) return NX_MODIFIERKEY_COMMAND;
+ else if (!strcasecmp(str, "fn")) return NX_MODIFIERKEY_SECONDARYFN;
+ else return -1;
+}
+
+/*
+ * LegalModifier
+ * This allows the ddx layer to prevent some keys from being remapped
+ * as modifier keys.
+ */
+Bool LegalModifier(unsigned int key, DeviceIntPtr pDev)
+{
+ return 1;
+}
+
unsigned int QuartzSystemKeymapSeed(void) {
static unsigned int seed;
static KeyboardLayoutRef last_key_layout;
diff --git a/hw/xquartz/quartzKeyboard.h b/hw/xquartz/quartzKeyboard.h
index 4f495bb46..964ea012e 100644
--- a/hw/xquartz/quartzKeyboard.h
+++ b/hw/xquartz/quartzKeyboard.h
@@ -49,4 +49,17 @@ typedef struct darwinKeyboardInfo_struct {
Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info);
unsigned int QuartzSystemKeymapSeed(void);
+/* Provided for darwinEvents.c */
+extern darwinKeyboardInfo keyInfo;
+void DarwinKeyboardReloadHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents);
+void DarwinKeyboardInit(DeviceIntPtr pDev);
+int DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide);
+int DarwinModifierNXKeyToNXKeycode(int key, int side);
+int DarwinModifierNXKeyToNXMask(int key);
+int DarwinModifierNXMaskToNXKey(int mask);
+int DarwinModifierStringToNXKey(const char *string);
+
+/* Provided for darwin.c */
+void DarwinKeyboardInit(DeviceIntPtr pDev);
+
#endif /* QUARTZ_KEYBOARD_H */
diff --git a/hw/xquartz/quartzStartup.c b/hw/xquartz/quartzStartup.c
index e25e15583..233e6e630 100644
--- a/hw/xquartz/quartzStartup.c
+++ b/hw/xquartz/quartzStartup.c
@@ -27,6 +27,8 @@
* use or other dealings in this Software without prior written authorization.
*/
+#include "sanitizedCarbon.h"
+
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -41,13 +43,7 @@
#include "opaque.h"
#include "micmap.h"
-#ifdef NDEBUG
-#undef NDEBUG
-#include <assert.h>
-#define NDEBUG 1
-#else
#include <assert.h>
-#endif
char **envpGlobal; // argcGlobal and argvGlobal
// are from dix/globals.c
diff --git a/hw/xquartz/sanitizedCarbon.h b/hw/xquartz/sanitizedCarbon.h
new file mode 100644
index 000000000..cc6ef198d
--- /dev/null
+++ b/hw/xquartz/sanitizedCarbon.h
@@ -0,0 +1,32 @@
+/*
+ * Don't #include any of the AppKit, etc stuff directly since it will
+ * pollute the X11 namespace.
+ */
+
+#ifndef _XQ_SANITIZED_CARBON_H_
+#define _XQ_SANITIZED_CARBON_H_
+
+// QuickDraw in ApplicationServices has the following conflicts with
+// the basic X server headers. Use QD_<name> to use the QuickDraw
+// definition of any of these symbols, or the normal name for the
+// X11 definition.
+#define Cursor QD_Cursor
+#define WindowPtr QD_WindowPtr
+#define Picture QD_Picture
+#define BOOL OSX_BOOL
+#define EventType HIT_EventType
+
+#include <ApplicationServices/ApplicationServices.h>
+#include <CoreServices/CoreServices.h>
+#include <Carbon/Carbon.h>
+#include <IOKit/hidsystem/event_status_driver.h>
+#include <IOKit/hidsystem/ev_keymap.h>
+#include <architecture/byte_order.h> // For the NXSwap*
+
+#undef Cursor
+#undef WindowPtr
+#undef Picture
+#undef BOOL
+#undef EventType
+
+#endif /* _XQ_SANITIZED_CARBON_H_ */
diff --git a/hw/xquartz/sanitizedCocoa.h b/hw/xquartz/sanitizedCocoa.h
new file mode 100644
index 000000000..58de64c1c
--- /dev/null
+++ b/hw/xquartz/sanitizedCocoa.h
@@ -0,0 +1,27 @@
+/*
+ * Don't #include any of the AppKit, etc stuff directly since it will
+ * pollute the X11 namespace.
+ */
+
+#ifndef _XQ_SANITIZED_COCOA_H_
+#define _XQ_SANITIZED_COCOA_H_
+
+// QuickDraw in ApplicationServices has the following conflicts with
+// the basic X server headers. Use QD_<name> to use the QuickDraw
+// definition of any of these symbols, or the normal name for the
+// X11 definition.
+#define Cursor QD_Cursor
+#define WindowPtr QD_WindowPtr
+#define Picture QD_Picture
+#define BOOL OSX_BOOL
+#define EventType HIT_EventType
+
+#include <Cocoa/Cocoa.h>
+
+#undef Cursor
+#undef WindowPtr
+#undef Picture
+#undef BOOL
+#undef EventType
+
+#endif /* _XQ_SANITIZED_COCOA_H_ */
diff --git a/hw/xquartz/threadSafety.c b/hw/xquartz/threadSafety.c
new file mode 100644
index 000000000..7835de68d
--- /dev/null
+++ b/hw/xquartz/threadSafety.c
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2008 Apple, Inc.
+ *
+ * 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 ABOVE LISTED COPYRIGHT HOLDER(S) 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(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "threadSafety.h"
+#include "os.h"
+
+#include <execinfo.h>
+
+pthread_t SERVER_THREAD;
+pthread_t APPKIT_THREAD;
+
+void spewCallStack(void) {
+ void* callstack[128];
+ int i, frames = backtrace(callstack, 128);
+ char** strs = backtrace_symbols(callstack, frames);
+
+ for (i = 0; i < frames; ++i) {
+ ErrorF("%s\n", strs[i]);
+ }
+
+ free(strs);
+}
+
+void _threadAssert(pthread_t tid, const char *file, const char *fun, int line) {
+ if(pthread_equal(pthread_self(), tid))
+ return;
+
+ /* NOOOO! */
+ ErrorF("Thread Assertion Failed: self=%s, expected=%s\n%s:%s:%d\n",
+ threadSafetyID(pthread_self()), threadSafetyID(tid),
+ file, fun, line);
+ spewCallStack();
+}
diff --git a/hw/xquartz/darwinKeyboard.h b/hw/xquartz/threadSafety.h
index 762f65919..ed2ad9ff5 100644
--- a/hw/xquartz/darwinKeyboard.h
+++ b/hw/xquartz/threadSafety.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003-2004 Torrey T. Lyons. All Rights Reserved.
+ * Copyright (C) 2008 Apple, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -24,22 +24,32 @@
* use or other dealings in this Software without prior written authorization.
*/
-#ifndef DARWIN_KEYBOARD_H
-#define DARWIN_KEYBOARD_H 1
+#ifndef _XQ_THREAD_SAFETY_H_
+#define _XQ_THREAD_SAFETY_H_
-#include "quartzKeyboard.h"
+#define DEBUG_THREADS 1
-/* Provided for darwinEvents.c */
-extern darwinKeyboardInfo keyInfo;
-void DarwinKeyboardReloadHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents);
-void DarwinKeyboardInit(DeviceIntPtr pDev);
-int DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide);
-int DarwinModifierNXKeyToNXKeycode(int key, int side);
-int DarwinModifierNXKeyToNXMask(int key);
-int DarwinModifierNXMaskToNXKey(int mask);
-int DarwinModifierStringToNXKey(const char *string);
+#include <pthread.h>
-/* Provided for darwin.c */
-void DarwinKeyboardInit(DeviceIntPtr pDev);
+extern pthread_t SERVER_THREAD;
+extern pthread_t APPKIT_THREAD;
-#endif /* DARWIN_KEYBOARD_H */
+#define threadSafetyID(tid) (pthread_equal((tid), SERVER_THREAD) ? "X Server Thread" : "Appkit Thread")
+
+/* Dump the call stack */
+void spewCallStack(void);
+
+/* Print message to ErrorF if we're in the wrong thread */
+void _threadAssert(pthread_t tid, const char *file, const char *fun, int line);
+
+#define threadAssert(tid) _threadAssert(tid, __FILE__, __FUNCTION__, __LINE__)
+
+#ifdef DEBUG_THREADS
+#define TA_SERVER() threadAssert(SERVER_THREAD)
+#define TA_APPKIT() threadAssert(APPKIT_THREAD)
+#else
+#define TA_SERVER()
+#define TA_APPKIT()
+#endif
+
+#endif _XQ_THREAD_SAFETY_H_
diff --git a/hw/xquartz/xpr/Makefile.am b/hw/xquartz/xpr/Makefile.am
index b4d67c7b7..60074238c 100644
--- a/hw/xquartz/xpr/Makefile.am
+++ b/hw/xquartz/xpr/Makefile.am
@@ -11,6 +11,7 @@ Xquartz_SOURCES = \
dri.c \
xprAppleWM.c \
xprCursor.c \
+ xprEvent.c \
xprFrame.c \
xprScreen.c \
x-hash.c \
@@ -27,11 +28,9 @@ Xquartz_LDADD = \
$(top_builddir)/miext/shadow/libshadow.la \
$(top_builddir)/fb/libfb.la \
$(top_builddir)/mi/libmi.la \
- $(top_builddir)/composite/libcomposite.la \
$(top_builddir)/damageext/libdamageext.la \
$(top_builddir)/miext/damage/libdamage.la \
$(top_builddir)/xfixes/libxfixes.la \
- $(top_builddir)/miext/cw/libcw.la \
$(top_builddir)/Xext/libXext.la \
$(top_builddir)/xkb/libxkb.la \
$(top_builddir)/xkb/libxkbstubs.la \
@@ -40,7 +39,6 @@ Xquartz_LDADD = \
$(top_builddir)/record/librecord.la \
$(top_builddir)/XTrap/libxtrap.la \
$(top_builddir)/miext/rootless/librootless.la \
- $(top_builddir)/miext/rootless/accel/librlAccel.la \
$(DARWIN_LIBS) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) -lXplugin
Xquartz_LDFLAGS = \
@@ -73,4 +71,5 @@ EXTRA_DIST = \
x-hash.h \
x-hook.h \
x-list.h \
- xpr.h
+ xpr.h \
+ xprEvent.h
diff --git a/hw/xquartz/xpr/dri.h b/hw/xquartz/xpr/dri.h
index cf2638a9f..8bb2e9e80 100644
--- a/hw/xquartz/xpr/dri.h
+++ b/hw/xquartz/xpr/dri.h
@@ -41,7 +41,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "scrnintstr.h"
#define _APPLEDRI_SERVER_
#include "appledri.h"
-#include "Xplugin.h"
+#include <Xplugin.h>
typedef void (*ClipNotifyPtr)( WindowPtr, int, int );
diff --git a/hw/xquartz/xpr/xpr.h b/hw/xquartz/xpr/xpr.h
index b8c69df0d..ab79a42cd 100644
--- a/hw/xquartz/xpr/xpr.h
+++ b/hw/xquartz/xpr/xpr.h
@@ -29,7 +29,9 @@
#ifndef XPR_H
#define XPR_H
+#include "windowstr.h"
#include "screenint.h"
+#include <Xplugin.h>
Bool QuartzModeBundleInit(void);
@@ -37,6 +39,7 @@ void AppleDRIExtensionInit(void);
void xprAppleWMInit(void);
Bool xprInit(ScreenPtr pScreen);
Bool xprIsX11Window(void *nsWindow, int windowNumber);
+WindowPtr xprGetXWindow(xp_window_id wid);
void xprHideWindows(Bool hide);
diff --git a/hw/xquartz/xpr/xprAppleWM.c b/hw/xquartz/xpr/xprAppleWM.c
index bd82df03c..aa5f29159 100644
--- a/hw/xquartz/xpr/xprAppleWM.c
+++ b/hw/xquartz/xpr/xprAppleWM.c
@@ -34,7 +34,7 @@
#include "xpr.h"
#include "applewmExt.h"
#include "rootless.h"
-#include "Xplugin.h"
+#include <Xplugin.h>
#include <X11/X.h>
static int xprSetWindowLevel(
diff --git a/hw/xquartz/xpr/xprCursor.c b/hw/xquartz/xpr/xprCursor.c
index 2ad8d6f56..76ab75c02 100644
--- a/hw/xquartz/xpr/xprCursor.c
+++ b/hw/xquartz/xpr/xprCursor.c
@@ -29,6 +29,8 @@
* use or other dealings in this Software without prior written authorization.
*/
+#include "sanitizedCarbon.h"
+
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -37,7 +39,7 @@
#include "xpr.h"
#include "darwin.h"
#include "darwinEvents.h"
-#include "Xplugin.h"
+#include <Xplugin.h>
#include "mi.h"
#include "scrnintstr.h"
diff --git a/hw/xquartz/xpr/xprEvent.c b/hw/xquartz/xpr/xprEvent.c
new file mode 100644
index 000000000..617d6e146
--- /dev/null
+++ b/hw/xquartz/xpr/xprEvent.c
@@ -0,0 +1,91 @@
+/* Copyright (c) 2008 Apple Inc.
+ *
+ * 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 ABOVE LISTED COPYRIGHT
+ * HOLDER(S) 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(s) of the above
+ * copyright holders shall not be used in advertising or otherwise to
+ * promote the sale, use or other dealings in this Software without
+ * prior written authorization.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "xpr.h"
+
+#define NEED_EVENTS
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/Xproto.h>
+#include "misc.h"
+#include "windowstr.h"
+#include "pixmapstr.h"
+#include "inputstr.h"
+#include "mi.h"
+#include "scrnintstr.h"
+#include "mipointer.h"
+
+#include "darwin.h"
+#include "quartz.h"
+#include "quartzKeyboard.h"
+#include "darwinEvents.h"
+
+#include <sys/types.h>
+#include <sys/uio.h>
+#include <unistd.h>
+
+#include "rootlessWindow.h"
+#include "xprEvent.h"
+
+static void xprEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents) {
+ int i;
+
+ TA_SERVER();
+
+ DEBUG_LOG("DarwinEventHandler(%d, %p, %p, %d)\n", screenNum, xe, dev, nevents);
+ for (i=0; i<nevents; i++) {
+ switch(xe[i].u.u.type) {
+
+ case kXquartzWindowState:
+ DEBUG_LOG("kXquartzWindowState\n");
+ RootlessNativeWindowStateChanged(xprGetXWindow(xe[i].u.clientMessage.u.l.longs0),
+ xe[i].u.clientMessage.u.l.longs1);
+ break;
+
+ case kXquartzWindowMoved:
+ DEBUG_LOG("kXquartzWindowMoved\n");
+ RootlessNativeWindowMoved ((WindowPtr)xe[i].u.clientMessage.u.l.longs0);
+ break;
+
+ case kXquartzBringAllToFront:
+ DEBUG_LOG("kXquartzBringAllToFront\n");
+ RootlessOrderAllWindows();
+ break;
+ }
+ }
+}
+
+void QuartzModeEQInit(void) {
+ mieqSetHandler(kXquartzWindowState, xprEventHandler);
+ mieqSetHandler(kXquartzWindowMoved, xprEventHandler);
+ mieqSetHandler(kXquartzBringAllToFront, xprEventHandler);
+}
diff --git a/hw/xquartz/xpr/xprEvent.h b/hw/xquartz/xpr/xprEvent.h
new file mode 100644
index 000000000..5af9dfd77
--- /dev/null
+++ b/hw/xquartz/xpr/xprEvent.h
@@ -0,0 +1,34 @@
+/* Copyright (c) 2008 Apple Inc.
+ *
+ * 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 ABOVE LISTED COPYRIGHT
+ * HOLDER(S) 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(s) of the above
+ * copyright holders shall not be used in advertising or otherwise to
+ * promote the sale, use or other dealings in this Software without
+ * prior written authorization.
+ */
+
+#ifndef __XPR_EVENT_H__
+#define __XPR_EVENT_H__
+
+void QuartzModeEQInit(void);
+
+#endif
diff --git a/hw/xquartz/xpr/xprFrame.c b/hw/xquartz/xpr/xprFrame.c
index 864ef0d40..901efca12 100644
--- a/hw/xquartz/xpr/xprFrame.c
+++ b/hw/xquartz/xpr/xprFrame.c
@@ -33,7 +33,7 @@
#include "xpr.h"
#include "rootlessCommon.h"
-#include "Xplugin.h"
+#include <Xplugin.h>
#include "x-hash.h"
#include "x-list.h"
#include "applewmExt.h"
diff --git a/hw/xquartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c
index d685fca33..6f7598f1c 100644
--- a/hw/xquartz/xpr/xprScreen.c
+++ b/hw/xquartz/xpr/xprScreen.c
@@ -27,6 +27,8 @@
* use or other dealings in this Software without prior written authorization.
*/
+#include "sanitizedCarbon.h"
+
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -35,18 +37,16 @@
#include "inputstr.h"
#include "quartz.h"
#include "xpr.h"
+#include "xprEvent.h"
#include "pseudoramiX.h"
#include "darwin.h"
#include "rootless.h"
#include "dri.h"
#include "globals.h"
-#include "Xplugin.h"
+#include <Xplugin.h>
#include "applewmExt.h"
#include "micmap.h"
-// From xprFrame.c
-WindowPtr xprGetXWindow(xp_window_id wid);
-
#ifdef DAMAGE
# include "damage.h"
#endif
@@ -150,7 +150,7 @@ displayScreenBounds(CGDirectDisplayID id)
/* Remove menubar to help standard X11 window managers. */
- if (frame.origin.x == 0 && frame.origin.y == 0)
+ if (frame.origin.y == 0)
{
frame.origin.y += aquaMenuBarHeight;
frame.size.height -= aquaMenuBarHeight;
@@ -352,7 +352,9 @@ xprSetupScreen(int index, ScreenPtr pScreen)
{
// Initialize accelerated rootless drawing
// Note that this must be done before DamageSetup().
- RootlessAccelInit(pScreen);
+
+ // These are crashing ugly... better to be stable and not crash for now.
+ //RootlessAccelInit(pScreen);
#ifdef DAMAGE
// The Damage extension needs to wrap underneath the
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index 38639d684..177908265 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -258,15 +258,9 @@
/* Support os-specific local connections */
#undef LOCALCONN
-/* Support MIT Misc extension */
-#undef MITMISC
-
/* Support MIT-SHM Extension */
#undef MITSHM
-/* Disable some debugging code */
-#undef NDEBUG
-
/* Enable some debugging code */
#undef DEBUG
@@ -419,15 +413,6 @@
/* Support Xv extension */
#undef XV
-/* Build APPGROUP extension */
-#undef XAPPGROUP
-
-/* Build TOG-CUP extension */
-#undef TOGCUP
-
-/* Build Extended-Visual-Information extension */
-#undef EVI
-
/* Build Multibuffer extension */
#undef MULTIBUFFER
diff --git a/include/dixstruct.h b/include/dixstruct.h
index ae144cf73..306870c9b 100644
--- a/include/dixstruct.h
+++ b/include/dixstruct.h
@@ -125,9 +125,7 @@ typedef struct _Client {
int requestLogIndex;
#endif
unsigned long replyBytesRemaining;
-#ifdef XAPPGROUP
- struct _AppGroupRec* appgroup;
-#endif
+ void *appgroup; /* Can't remove, ABI */
struct _FontResolution * (*fontResFunc) ( /* no need for font.h */
ClientPtr /* pClient */,
int * /* num */);
diff --git a/include/globals.h b/include/globals.h
index 2ca9531d9..9e5060d5f 100644
--- a/include/globals.h
+++ b/include/globals.h
@@ -66,10 +66,6 @@ extern Bool noDbeExtension;
extern Bool noDPMSExtension;
#endif
-#ifdef EVI
-extern Bool noEVIExtension;
-#endif
-
#ifdef FONTCACHE
extern Bool noFontCacheExtension;
#endif
@@ -86,10 +82,6 @@ extern Bool noScreenSaverExtension;
extern Bool noMITShmExtension;
#endif
-#ifdef MITMISC
-extern Bool noMITMiscExtension;
-#endif
-
#ifdef MULTIBUFFER
extern Bool noMultibufferExtension;
#endif
@@ -114,18 +106,10 @@ extern Bool noSecurityExtension;
extern Bool noSyncExtension;
#endif
-#ifdef TOGCUP
-extern Bool noXcupExtension;
-#endif
-
#ifdef RES
extern Bool noResExtension;
#endif
-#ifdef XAPPGROUP
-extern Bool noXagExtension;
-#endif
-
#ifdef XCMISC
extern Bool noXCMiscExtension;
#endif
diff --git a/include/servermd.h b/include/servermd.h
index 2f511dabe..616841089 100644
--- a/include/servermd.h
+++ b/include/servermd.h
@@ -393,7 +393,7 @@ SOFTWARE.
#endif /* ia64 */
-#if defined(__amd64__) || defined(amd64) || defined(__amd64)
+#if defined(__amd64__) || defined(amd64) || defined(__amd64) || defined(__x86_64__)
# define IMAGE_BYTE_ORDER LSBFirst
# if defined(XF86MONOVGA) || defined(XF86VGA16) || defined(XF86MONO)
diff --git a/include/windowstr.h b/include/windowstr.h
index a36dc2972..a895a8805 100644
--- a/include/windowstr.h
+++ b/include/windowstr.h
@@ -189,6 +189,9 @@ typedef struct _Window {
unsigned forcedBS:1; /* system-supplied backingStore */
unsigned redirectDraw:2; /* COMPOSITE rendering redirect */
unsigned forcedBG:1; /* must have an opaque background */
+#ifdef ROOTLESS
+ unsigned rootlessUnhittable:1; /* doesn't hit-test */
+#endif
} WindowRec;
/*
diff --git a/include/xorg-server.h.in b/include/xorg-server.h.in
index 1d41b4ce6..5a253c7c6 100644
--- a/include/xorg-server.h.in
+++ b/include/xorg-server.h.in
@@ -46,15 +46,9 @@
/* Support IPv6 for TCP connections */
#undef IPv6
-/* Support MIT Misc extension */
-#undef MITMISC
-
/* Support MIT-SHM Extension */
#undef MITSHM
-/* Disable some debugging code */
-#undef NDEBUG
-
/* Need XFree86 helper functions */
#undef NEED_XF86_PROTOTYPES
diff --git a/mi/micoord.h b/mi/micoord.h
index 16d086117..876e88c95 100644
--- a/mi/micoord.h
+++ b/mi/micoord.h
@@ -48,7 +48,7 @@
defined(__alpha) || defined(__alpha__) || \
defined(__i386__) || defined(__i386) || defined(__ia64__) || \
defined(__s390x__) || defined(__s390__) || \
- defined(__amd64__) || defined(amd64) || defined(__amd64)
+ defined(__amd64__) || defined(amd64) || defined(__amd64) || defined(__x86_64__)
#define GetHighWord(x) (((int) (x)) >> 16)
#else
#define GetHighWord(x) (((int) (x)) / 65536)
diff --git a/mi/miinitext.c b/mi/miinitext.c
index cdcba1bfe..4f3b92e31 100644
--- a/mi/miinitext.c
+++ b/mi/miinitext.c
@@ -130,9 +130,6 @@ extern Bool noDbeExtension;
#ifdef DPMSExtension
extern Bool noDPMSExtension;
#endif
-#ifdef EVI
-extern Bool noEVIExtension;
-#endif
#ifdef FONTCACHE
extern Bool noFontCacheExtension;
#endif
@@ -145,9 +142,6 @@ extern Bool noScreenSaverExtension;
#ifdef MITSHM
extern Bool noMITShmExtension;
#endif
-#ifdef MITMISC
-extern Bool noMITMiscExtension;
-#endif
#ifdef MULTIBUFFER
extern Bool noMultibufferExtension;
#endif
@@ -166,15 +160,9 @@ extern Bool noSecurityExtension;
#ifdef XSYNC
extern Bool noSyncExtension;
#endif
-#ifdef TOGCUP
-extern Bool noXcupExtension;
-#endif
#ifdef RES
extern Bool noResExtension;
#endif
-#ifdef XAPPGROUP
-extern Bool noXagExtension;
-#endif
#ifdef XCMISC
extern Bool noXCMiscExtension;
#endif
@@ -244,10 +232,6 @@ typedef void (*InitExtension)(INITARGS);
#ifdef XPRINT
#include <X11/extensions/Print.h>
#endif
-#ifdef XAPPGROUP
-#define _XAG_SERVER_
-#include <X11/extensions/Xagstr.h>
-#endif
#ifdef XCSECURITY
#include "securitysrv.h"
#include <X11/extensions/securstr.h>
@@ -266,9 +250,6 @@ typedef void (*InitExtension)(INITARGS);
#endif
/* FIXME: this whole block of externs should be from the appropriate headers */
-#ifdef EVI
-extern void EVIExtensionInit(INITARGS);
-#endif
#ifdef MITSHM
extern void ShmExtensionInit(INITARGS);
#endif
@@ -290,9 +271,6 @@ extern void XTestExtensionInit(INITARGS);
#ifdef BIGREQS
extern void BigReqExtensionInit(INITARGS);
#endif
-#ifdef MITMISC
-extern void MITMiscExtensionInit(INITARGS);
-#endif
#ifdef XIDLE
extern void XIdleExtensionInit(INITARGS);
#endif
@@ -321,9 +299,6 @@ extern void RecordExtensionInit(INITARGS);
#ifdef DBE
extern void DbeExtensionInit(INITARGS);
#endif
-#ifdef XAPPGROUP
-extern void XagExtensionInit(INITARGS);
-#endif
#ifdef XCSECURITY
extern void SecurityExtensionInit(INITARGS);
#endif
@@ -354,9 +329,6 @@ extern void GlxExtensionInit(INITARGS);
#ifdef XF86DRI
extern void XFree86DRIExtensionInit(INITARGS);
#endif
-#ifdef TOGCUP
-extern void XcupExtensionInit(INITARGS);
-#endif
#ifdef DPMSExtension
extern void DPMSExtensionInit(INITARGS);
#endif
@@ -416,9 +388,6 @@ static ExtensionToggle ExtensionToggleList[] =
#ifdef DPMSExtension
{ "DPMS", &noDPMSExtension },
#endif
-#ifdef EVI
- { "Extended-Visual-Information", &noEVIExtension },
-#endif
#ifdef FONTCACHE
{ "FontCache", &noFontCacheExtension },
#endif
@@ -431,9 +400,6 @@ static ExtensionToggle ExtensionToggleList[] =
#ifdef MITSHM
{ SHMNAME, &noMITShmExtension },
#endif
-#ifdef MITMISC
- { "MIT-SUNDRY-NONSTANDARD", &noMITMiscExtension },
-#endif
#ifdef MULTIBUFFER
{ "Multi-Buffering", &noMultibufferExtension },
#endif
@@ -452,15 +418,9 @@ static ExtensionToggle ExtensionToggleList[] =
#ifdef XSYNC
{ "SYNC", &noSyncExtension },
#endif
-#ifdef TOGCUP
- { "TOG-CUP", &noXcupExtension },
-#endif
#ifdef RES
{ "X-Resource", &noResExtension },
#endif
-#ifdef XAPPGROUP
- { "XC-APPGROUP", &noXagExtension },
-#endif
#ifdef XCMISC
{ "XC-MISC", &noXCMiscExtension },
#endif
@@ -553,9 +513,6 @@ InitExtensions(argc, argv)
#ifdef MITSHM
if (!noMITShmExtension) ShmExtensionInit();
#endif
-#ifdef EVI
- if (!noEVIExtension) EVIExtensionInit();
-#endif
#ifdef MULTIBUFFER
if (!noMultibufferExtension) MultibufferExtensionInit();
#endif
@@ -568,9 +525,6 @@ InitExtensions(argc, argv)
#ifdef BIGREQS
if (!noBigReqExtension) BigReqExtensionInit();
#endif
-#ifdef MITMISC
- if (!noMITMiscExtension) MITMiscExtensionInit();
-#endif
#ifdef XIDLE
if (!noXIdleExtension) XIdleExtensionInit();
#endif
@@ -601,9 +555,6 @@ InitExtensions(argc, argv)
#ifdef DBE
if (!noDbeExtension) DbeExtensionInit();
#endif
-#ifdef XAPPGROUP
- if (!noXagExtension) XagExtensionInit();
-#endif
#ifdef XCSECURITY
if (!noSecurityExtension) SecurityExtensionInit();
#endif
@@ -613,9 +564,6 @@ InitExtensions(argc, argv)
#ifdef XPRINT
XpExtensionInit(); /* server-specific extension, cannot be disabled */
#endif
-#ifdef TOGCUP
- if (!noXcupExtension) XcupExtensionInit();
-#endif
#if defined(DPMSExtension) && !defined(NO_HW_ONLY_EXTS)
if (!noDPMSExtension) DPMSExtensionInit();
#endif
@@ -696,9 +644,6 @@ static ExtensionModule staticExtensions[] = {
#ifdef XKB
{ XkbExtensionInit, XkbName, &noXkbExtension, NULL, NULL },
#endif
-#ifdef XAPPGROUP
- { XagExtensionInit, XAGNAME, &noXagExtension, NULL, NULL },
-#endif
#ifdef XCSECURITY
{ SecurityExtensionInit, SECURITY_EXTENSION_NAME, &noSecurityExtension, NULL, NULL },
#endif
diff --git a/miext/rootless/Makefile.am b/miext/rootless/Makefile.am
index dc851702f..f09300d5c 100644
--- a/miext/rootless/Makefile.am
+++ b/miext/rootless/Makefile.am
@@ -1,8 +1,6 @@
AM_CFLAGS = $(DIX_CFLAGS) $(XSERVER_CFLAGS)
AM_CPPFLAGS = -I$(top_srcdir)/hw/xfree86/os-support
-SUBDIRS = accel
-
noinst_LTLIBRARIES = librootless.la
librootless_la_SOURCES = \
rootlessCommon.c \
diff --git a/miext/rootless/README.txt b/miext/rootless/README.txt
index ffd17902f..2c3fbb05a 100644
--- a/miext/rootless/README.txt
+++ b/miext/rootless/README.txt
@@ -76,10 +76,6 @@ rootlessConfig.h to specify compile time options for its platform.
The following compile-time options are defined in
rootlessConfig.h:
- o ROOTLESS_ACCEL: If true, use the optional rootless acceleration
- functions where possible to a accelerate X11 drawing primitives.
- If false, all drawing will be done with fb.
-
o ROOTLESS_GLOBAL_COORDS: This option controls the way that frame
coordinates are passed to the rootless implementation. If false,
the coordinates are passed per screen relative to the origin of
diff --git a/miext/rootless/accel/Makefile.am b/miext/rootless/accel/Makefile.am
deleted file mode 100644
index ca41653b7..000000000
--- a/miext/rootless/accel/Makefile.am
+++ /dev/null
@@ -1,15 +0,0 @@
-AM_CFLAGS = $(DIX_CFLAGS) $(XSERVER_CFLAGS)
-AM_CPPFLAGS = -I$(srcdir)/.. -I$(top_srcdir)/hw/xfree86/os-support
-
-noinst_LTLIBRARIES = librlAccel.la
-librlAccel_la_SOURCES = \
- rlAccel.c \
- rlBlt.c \
- rlCopy.c \
- rlFill.c \
- rlFillRect.c \
- rlFillSpans.c \
- rlGlyph.c \
- rlSolid.c
-
-EXTRA_DIST = rlAccel.h
diff --git a/miext/rootless/accel/rlAccel.c b/miext/rootless/accel/rlAccel.c
deleted file mode 100644
index f3cb21569..000000000
--- a/miext/rootless/accel/rlAccel.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Support for accelerated rootless code
- */
-/*
- * Copyright (c) 2004 Torrey T. Lyons. 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 ABOVE LISTED COPYRIGHT HOLDER(S) 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(s) of the above copyright
- * holders shall not be used in advertising or otherwise to promote the sale,
- * use or other dealings in this Software without prior written authorization.
- */
-
-/*
- * The accelerated rootless code replaces some GC operations from fb with
- * versions that call the rootless acceleration functions where appropriate.
- * To work properly, this must be wrapped directly on top of fb. Nothing
- * underneath this layer besides fb will get called.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "rootless.h"
-#include "rlAccel.h"
-
-typedef struct _rlAccelScreenRec {
- CreateGCProcPtr CreateGC;
- CloseScreenProcPtr CloseScreen;
-} rlAccelScreenRec, *rlAccelScreenPtr;
-
-static DevPrivateKey rlAccelScreenPrivateKey = &rlAccelScreenPrivateKey;
-
-#define RLACCELREC(pScreen) ((rlAccelScreenRec *) \
- dixLookupPrivate(&(pScreen)->devPrivates, rlAccelScreenPrivateKey))
-
-#define SETRLACCELREC(pScreen, v) \
- dixSetPrivate(&(pScreen)->devPrivates, rlAccelScreenPrivateKey, v)
-
-/* This is mostly identical to fbGCOps. */
-static GCOps rlAccelOps = {
- rlFillSpans,
- fbSetSpans,
- fbPutImage,
- rlCopyArea,
- fbCopyPlane,
- fbPolyPoint,
- fbPolyLine,
- fbPolySegment,
- fbPolyRectangle,
- fbPolyArc,
- miFillPolygon,
- rlPolyFillRect,
- fbPolyFillArc,
- miPolyText8,
- miPolyText16,
- miImageText8,
- miImageText16,
- rlImageGlyphBlt,
- fbPolyGlyphBlt,
- fbPushPixels
-};
-
-
-/*
- * Screen function to create a graphics context
- */
-static Bool
-rlCreateGC(GCPtr pGC)
-{
- ScreenPtr pScreen = pGC->pScreen;
- rlAccelScreenRec *s = RLACCELREC(pScreen);
- Bool result;
-
- // Unwrap and call
- pScreen->CreateGC = s->CreateGC;
- result = s->CreateGC(pGC);
-
- // Accelerated GC ops replace some fb GC ops
- pGC->ops = &rlAccelOps;
-
- // Rewrap
- s->CreateGC = pScreen->CreateGC;
- pScreen->CreateGC = rlCreateGC;
-
- return result;
-}
-
-
-/*
- * Clean up when closing a screen on server reset
- */
-static Bool
-rlCloseScreen (int iScreen, ScreenPtr pScreen)
-{
- rlAccelScreenRec *s = RLACCELREC(pScreen);
- Bool result;
-
- // Unwrap
- pScreen->CloseScreen = s->CloseScreen;
- result = pScreen->CloseScreen(iScreen, pScreen);
-
- xfree(s);
-
- return result;
-}
-
-
-/*
- * RootlessAccelInit
- * Called by the rootless implementation to initialize accelerated
- * rootless drawing.
- */
-Bool
-RootlessAccelInit(ScreenPtr pScreen)
-{
- rlAccelScreenRec *s;
-
- s = xalloc(sizeof(rlAccelScreenRec));
- if (!s) return FALSE;
- SETRLACCELREC(pScreen, s);
-
- // Wrap the screen functions we need
- s->CreateGC = pScreen->CreateGC;
- pScreen->CreateGC = rlCreateGC;
- s->CloseScreen = pScreen->CloseScreen;
- pScreen->CloseScreen = rlCloseScreen;
-
- return TRUE;
-}
diff --git a/miext/rootless/accel/rlAccel.h b/miext/rootless/accel/rlAccel.h
deleted file mode 100644
index a3fc6321e..000000000
--- a/miext/rootless/accel/rlAccel.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Rootless Acceleration Code
- */
-/*
- * Copyright (c) 2003 Torrey T. Lyons. 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 ABOVE LISTED COPYRIGHT HOLDER(S) 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(s) of the above copyright
- * holders shall not be used in advertising or otherwise to promote the sale,
- * use or other dealings in this Software without prior written authorization.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "fb.h"
-
-/*
- * rlBlt.c
- */
-void
-rlBlt (FbBits *srcLine,
- FbStride srcStride,
- int srcX,
-
- ScreenPtr pDstScreen,
- FbBits *dstLine,
- FbStride dstStride,
- int dstX,
-
- int width,
- int height,
-
- int alu,
- FbBits pm,
- int bpp,
-
- Bool reverse,
- Bool upsidedown);
-
-/*
- * rlCopy.c
- */
-RegionPtr
-rlCopyArea (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- int xIn,
- int yIn,
- int widthSrc,
- int heightSrc,
- int xOut,
- int yOut);
-
-/*
- * rlFill.c
- */
-void
-rlFill (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- int width,
- int height);
-
-void
-rlSolidBoxClipped (DrawablePtr pDrawable,
- RegionPtr pClip,
- int x1,
- int y1,
- int x2,
- int y2,
- FbBits and,
- FbBits xor);
-
-/*
- * rlFillRect.c
- */
-void
-rlPolyFillRect(DrawablePtr pDrawable,
- GCPtr pGC,
- int nrect,
- xRectangle *prect);
-
-/*
- * rlFillSpans.c
- */
-void
-rlFillSpans (DrawablePtr pDrawable,
- GCPtr pGC,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted);
-
-/*
- * rlGlyph.c
- */
-void
-rlImageGlyphBlt (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nglyph,
- CharInfoPtr *ppciInit,
- pointer pglyphBase);
-
-/*
- * rlSolid.c
- */
-void
-rlSolid (ScreenPtr pScreen,
- FbBits *dst,
- FbStride dstStride,
- int dstX,
- int bpp,
-
- int width,
- int height,
-
- FbBits and,
- FbBits xor);
diff --git a/miext/rootless/accel/rlBlt.c b/miext/rootless/accel/rlBlt.c
deleted file mode 100644
index b5fe74085..000000000
--- a/miext/rootless/accel/rlBlt.c
+++ /dev/null
@@ -1,408 +0,0 @@
-/*
- * Accelerated rootless blit
- */
-/*
- * This code is largely copied from fbBlt.c.
- *
- * Copyright © 1998 Keith Packard
- * Copyright (c) 2002 Apple Computer, Inc. All Rights Reserved.
- * Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved.
- *
- * 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, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stddef.h> /* For NULL */
-#include <string.h>
-#include "fb.h"
-#include "rootlessCommon.h"
-#include "rlAccel.h"
-
-#define InitializeShifts(sx,dx,ls,rs) { \
- if (sx != dx) { \
- if (sx > dx) { \
- ls = sx - dx; \
- rs = FB_UNIT - ls; \
- } else { \
- rs = dx - sx; \
- ls = FB_UNIT - rs; \
- } \
- } \
-}
-
-void
-rlBlt (FbBits *srcLine,
- FbStride srcStride,
- int srcX,
-
- ScreenPtr pDstScreen,
- FbBits *dstLine,
- FbStride dstStride,
- int dstX,
-
- int width,
- int height,
-
- int alu,
- FbBits pm,
- int bpp,
-
- Bool reverse,
- Bool upsidedown)
-{
- FbBits *src, *dst;
- int leftShift, rightShift;
- FbBits startmask, endmask;
- FbBits bits, bits1;
- int n, nmiddle;
- Bool destInvarient;
- int startbyte, endbyte;
- FbDeclareMergeRop ();
-
-#ifdef FB_24BIT
- if (bpp == 24 && !FbCheck24Pix (pm))
- {
- fbBlt24 (srcLine, srcStride, srcX, dstLine, dstStride, dstX,
- width, height, alu, pm, reverse, upsidedown);
- return;
- }
-#endif
-
- if (alu == GXcopy && pm == FB_ALLONES && !reverse &&
- !(srcX & 7) && !(dstX & 7) && !(width & 7)) {
- int i;
- CARD8 *src = (CARD8 *) srcLine;
- CARD8 *dst = (CARD8 *) dstLine;
-
- srcStride *= sizeof(FbBits);
- dstStride *= sizeof(FbBits);
- width >>= 3;
- src += (srcX >> 3);
- dst += (dstX >> 3);
-
- if (!upsidedown)
- for (i = 0; i < height; i++)
- memcpy(dst + i * dstStride, src + i * srcStride, width);
- else
- for (i = height - 1; i >= 0; i--)
- memcpy(dst + i * dstStride, src + i * srcStride, width);
-
- return;
- }
-
- FbInitializeMergeRop(alu, pm);
- destInvarient = FbDestInvarientMergeRop();
- if (upsidedown)
- {
- srcLine += (height - 1) * (srcStride);
- dstLine += (height - 1) * (dstStride);
- srcStride = -srcStride;
- dstStride = -dstStride;
- }
- FbMaskBitsBytes (dstX, width, destInvarient, startmask, startbyte,
- nmiddle, endmask, endbyte);
-
- /*
- * Beginning of the rootless acceleration code
- */
- if (!startmask && !endmask && alu == GXcopy &&
- height * nmiddle * sizeof(*dst) > rootless_CopyBytes_threshold)
- {
- if (pm == FB_ALLONES && SCREENREC(pDstScreen)->imp->CopyBytes)
- {
- SCREENREC(pDstScreen)->imp->CopyBytes(
- nmiddle * sizeof(*dst), height,
- (char *) srcLine + (srcX >> 3),
- srcStride * sizeof (*src),
- (char *) dstLine + (dstX >> 3),
- dstStride * sizeof (*dst));
- return;
- }
-
- /* FIXME: the pm test here isn't super-wonderful - just because
- we don't care about the top eight bits doesn't necessarily
- mean we want them set to 255. But doing this does give a
- factor of two performance improvement when copying from a
- pixmap to a window, which is pretty common.. */
-
- else if (bpp == 32 && sizeof(FbBits) == 4 &&
- pm == 0x00FFFFFFUL && !reverse &&
- SCREENREC(pDstScreen)->imp->CompositePixels)
- {
- /* need to copy XRGB to ARGB. */
-
- void *src[2], *dest[2];
- unsigned int src_rowbytes[2], dest_rowbytes[2];
- unsigned int fn;
-
- src[0] = (char *) srcLine + (srcX >> 3);
- src[1] = NULL;
- src_rowbytes[0] = srcStride * sizeof(*src);
- src_rowbytes[1] = 0;
-
- dest[0] = (char *) dstLine + (dstX >> 3);
- dest[1] = dest[0];
- dest_rowbytes[0] = dstStride * sizeof(*dst);
- dest_rowbytes[1] = dest_rowbytes[0];
-
- fn = RL_COMPOSITE_FUNCTION(RL_COMPOSITE_SRC, RL_DEPTH_ARGB8888,
- RL_DEPTH_NIL, RL_DEPTH_ARGB8888);
-
- if (SCREENREC(pDstScreen)->imp->CompositePixels(
- nmiddle, height,
- fn, src, src_rowbytes,
- NULL, 0, dest, dest_rowbytes) == Success)
- {
- return;
- }
- }
- }
- /* End of the rootless acceleration code */
-
- if (reverse)
- {
- srcLine += ((srcX + width - 1) >> FB_SHIFT) + 1;
- dstLine += ((dstX + width - 1) >> FB_SHIFT) + 1;
- srcX = (srcX + width - 1) & FB_MASK;
- dstX = (dstX + width - 1) & FB_MASK;
- }
- else
- {
- srcLine += srcX >> FB_SHIFT;
- dstLine += dstX >> FB_SHIFT;
- srcX &= FB_MASK;
- dstX &= FB_MASK;
- }
- if (srcX == dstX)
- {
- while (height--)
- {
- src = srcLine;
- srcLine += srcStride;
- dst = dstLine;
- dstLine += dstStride;
- if (reverse)
- {
- if (endmask)
- {
- bits = *--src;
- --dst;
- FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask);
- }
- n = nmiddle;
- if (destInvarient)
- {
- while (n--)
- *--dst = FbDoDestInvarientMergeRop(*--src);
- }
- else
- {
- while (n--)
- {
- bits = *--src;
- --dst;
- *dst = FbDoMergeRop (bits, *dst);
- }
- }
- if (startmask)
- {
- bits = *--src;
- --dst;
- FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask);
- }
- }
- else
- {
- if (startmask)
- {
- bits = *src++;
- FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask);
- dst++;
- }
- n = nmiddle;
- if (destInvarient)
- {
-#if 0
- /*
- * This provides some speedup on screen->screen blts
- * over the PCI bus, usually about 10%. But fb
- * isn't usually used for this operation...
- */
- if (_ca2 + 1 == 0 && _cx2 == 0)
- {
- FbBits t1, t2, t3, t4;
- while (n >= 4)
- {
- t1 = *src++;
- t2 = *src++;
- t3 = *src++;
- t4 = *src++;
- *dst++ = t1;
- *dst++ = t2;
- *dst++ = t3;
- *dst++ = t4;
- n -= 4;
- }
- }
-#endif
- while (n--)
- *dst++ = FbDoDestInvarientMergeRop(*src++);
- }
- else
- {
- while (n--)
- {
- bits = *src++;
- *dst = FbDoMergeRop (bits, *dst);
- dst++;
- }
- }
- if (endmask)
- {
- bits = *src;
- FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask);
- }
- }
- }
- }
- else
- {
- if (srcX > dstX)
- {
- leftShift = srcX - dstX;
- rightShift = FB_UNIT - leftShift;
- }
- else
- {
- rightShift = dstX - srcX;
- leftShift = FB_UNIT - rightShift;
- }
- while (height--)
- {
- src = srcLine;
- srcLine += srcStride;
- dst = dstLine;
- dstLine += dstStride;
-
- bits1 = 0;
- if (reverse)
- {
- if (srcX < dstX)
- bits1 = *--src;
- if (endmask)
- {
- bits = FbScrRight(bits1, rightShift);
- if (FbScrRight(endmask, leftShift))
- {
- bits1 = *--src;
- bits |= FbScrLeft(bits1, leftShift);
- }
- --dst;
- FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask);
- }
- n = nmiddle;
- if (destInvarient)
- {
- while (n--)
- {
- bits = FbScrRight(bits1, rightShift);
- bits1 = *--src;
- bits |= FbScrLeft(bits1, leftShift);
- --dst;
- *dst = FbDoDestInvarientMergeRop(bits);
- }
- }
- else
- {
- while (n--)
- {
- bits = FbScrRight(bits1, rightShift);
- bits1 = *--src;
- bits |= FbScrLeft(bits1, leftShift);
- --dst;
- *dst = FbDoMergeRop(bits, *dst);
- }
- }
- if (startmask)
- {
- bits = FbScrRight(bits1, rightShift);
- if (FbScrRight(startmask, leftShift))
- {
- bits1 = *--src;
- bits |= FbScrLeft(bits1, leftShift);
- }
- --dst;
- FbDoLeftMaskByteMergeRop (dst, bits, startbyte, startmask);
- }
- }
- else
- {
- if (srcX > dstX)
- bits1 = *src++;
- if (startmask)
- {
- bits = FbScrLeft(bits1, leftShift);
- if (FbScrLeft(startmask, rightShift))
- {
- bits1 = *src++;
- bits |= FbScrRight(bits1, rightShift);
- }
- FbDoLeftMaskByteMergeRop (dst, bits, startbyte, startmask);
- dst++;
- }
- n = nmiddle;
- if (destInvarient)
- {
- while (n--)
- {
- bits = FbScrLeft(bits1, leftShift);
- bits1 = *src++;
- bits |= FbScrRight(bits1, rightShift);
- *dst = FbDoDestInvarientMergeRop(bits);
- dst++;
- }
- }
- else
- {
- while (n--)
- {
- bits = FbScrLeft(bits1, leftShift);
- bits1 = *src++;
- bits |= FbScrRight(bits1, rightShift);
- *dst = FbDoMergeRop(bits, *dst);
- dst++;
- }
- }
- if (endmask)
- {
- bits = FbScrLeft(bits1, leftShift);
- if (FbScrLeft(endmask, rightShift))
- {
- bits1 = *src;
- bits |= FbScrRight(bits1, rightShift);
- }
- FbDoRightMaskByteMergeRop (dst, bits, endbyte, endmask);
- }
- }
- }
- }
-}
diff --git a/miext/rootless/accel/rlCopy.c b/miext/rootless/accel/rlCopy.c
deleted file mode 100644
index df6fc11a7..000000000
--- a/miext/rootless/accel/rlCopy.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * This code is largely copied from fbcopy.c.
- *
- * Copyright © 1998 Keith Packard
- * Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved.
- *
- * 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, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "fb.h"
-#include "rlAccel.h"
-
-
-void
-rlCopyNtoN (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- BoxPtr pbox,
- int nbox,
- int dx,
- int dy,
- Bool reverse,
- Bool upsidedown,
- Pixel bitplane,
- void *closure)
-{
- CARD8 alu = pGC ? pGC->alu : GXcopy;
- FbBits pm = pGC ? fbGetGCPrivate(pGC)->pm : FB_ALLONES;
- FbBits *src;
- FbStride srcStride;
- int srcBpp;
- int srcXoff, srcYoff;
- FbBits *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
-
- fbGetDrawable (pSrcDrawable, src, srcStride, srcBpp, srcXoff, srcYoff);
- fbGetDrawable (pDstDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
-
- while (nbox--)
- {
- rlBlt (src + (pbox->y1 + dy + srcYoff) * srcStride,
- srcStride,
- (pbox->x1 + dx + srcXoff) * srcBpp,
-
- pDstDrawable->pScreen,
- dst + (pbox->y1 + dstYoff) * dstStride,
- dstStride,
- (pbox->x1 + dstXoff) * dstBpp,
-
- (pbox->x2 - pbox->x1) * dstBpp,
- (pbox->y2 - pbox->y1),
-
- alu,
- pm,
- dstBpp,
-
- reverse,
- upsidedown);
- pbox++;
- }
-}
-
-RegionPtr
-rlCopyArea (DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- int xIn,
- int yIn,
- int widthSrc,
- int heightSrc,
- int xOut,
- int yOut)
-{
- fbCopyProc copy;
-
-#ifdef FB_24_32BIT
- if (pSrcDrawable->bitsPerPixel != pDstDrawable->bitsPerPixel)
- copy = fb24_32CopyMtoN;
- else
-#endif
- copy = rlCopyNtoN;
- return fbDoCopy (pSrcDrawable, pDstDrawable, pGC, xIn, yIn,
- widthSrc, heightSrc, xOut, yOut, copy, 0, 0);
-}
diff --git a/miext/rootless/accel/rlFill.c b/miext/rootless/accel/rlFill.c
deleted file mode 100644
index a80c7769f..000000000
--- a/miext/rootless/accel/rlFill.c
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * This code is largely copied from fbfill.c.
- *
- * Copyright © 1998 Keith Packard
- * Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved.
- *
- * 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, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "fb.h"
-#include "rlAccel.h"
-
-
-void
-rlFill (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- int width,
- int height)
-{
- FbBits *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
-
- fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
-
- switch (pGC->fillStyle) {
- case FillSolid:
- rlSolid (pDrawable->pScreen,
- dst + (y + dstYoff) * dstStride,
- dstStride,
- (x + dstXoff) * dstBpp,
- dstBpp,
- width * dstBpp, height,
- pPriv->and, pPriv->xor);
- break;
- case FillStippled:
- case FillOpaqueStippled: {
- PixmapPtr pStip = pGC->stipple;
- int stipWidth = pStip->drawable.width;
- int stipHeight = pStip->drawable.height;
-
- if (dstBpp == 1)
- {
- int alu;
- FbBits *stip;
- FbStride stipStride;
- int stipBpp;
- int stipXoff, stipYoff; /* XXX assumed to be zero */
-
- if (pGC->fillStyle == FillStippled)
- alu = FbStipple1Rop(pGC->alu,pGC->fgPixel);
- else
- alu = FbOpaqueStipple1Rop(pGC->alu,pGC->fgPixel,pGC->bgPixel);
- fbGetDrawable (&pStip->drawable, stip, stipStride, stipBpp, stipXoff, stipYoff);
- fbTile (dst + (y + dstYoff) * dstStride,
- dstStride,
- x + dstXoff,
- width, height,
- stip,
- stipStride,
- stipWidth,
- stipHeight,
- alu,
- pPriv->pm,
- dstBpp,
-
- (pGC->patOrg.x + pDrawable->x + dstXoff),
- pGC->patOrg.y + pDrawable->y - y);
- }
- else
- {
- FbStip *stip;
- FbStride stipStride;
- int stipBpp;
- int stipXoff, stipYoff; /* XXX assumed to be zero */
- FbBits fgand, fgxor, bgand, bgxor;
-
- fgand = pPriv->and;
- fgxor = pPriv->xor;
- if (pGC->fillStyle == FillStippled)
- {
- bgand = fbAnd(GXnoop,(FbBits) 0,FB_ALLONES);
- bgxor = fbXor(GXnoop,(FbBits) 0,FB_ALLONES);
- }
- else
- {
- bgand = pPriv->bgand;
- bgxor = pPriv->bgxor;
- }
-
- fbGetStipDrawable (&pStip->drawable, stip, stipStride, stipBpp, stipXoff, stipYoff);
- fbStipple (dst + (y + dstYoff) * dstStride,
- dstStride,
- (x + dstXoff) * dstBpp,
- dstBpp,
- width * dstBpp, height,
- stip,
- stipStride,
- stipWidth,
- stipHeight,
- pPriv->evenStipple,
- fgand, fgxor,
- bgand, bgxor,
- pGC->patOrg.x + pDrawable->x + dstXoff,
- pGC->patOrg.y + pDrawable->y - y);
- }
- break;
- }
- case FillTiled: {
- PixmapPtr pTile = pGC->tile.pixmap;
- FbBits *tile;
- FbStride tileStride;
- int tileBpp;
- int tileWidth;
- int tileHeight;
- int tileXoff, tileYoff; /* XXX assumed to be zero */
-
- fbGetDrawable (&pTile->drawable, tile, tileStride, tileBpp, tileXoff, tileYoff);
- tileWidth = pTile->drawable.width;
- tileHeight = pTile->drawable.height;
- fbTile (dst + (y + dstYoff) * dstStride,
- dstStride,
- (x + dstXoff) * dstBpp,
- width * dstBpp, height,
- tile,
- tileStride,
- tileWidth * tileBpp,
- tileHeight,
- pGC->alu,
- pPriv->pm,
- dstBpp,
- (pGC->patOrg.x + pDrawable->x + dstXoff) * dstBpp,
- pGC->patOrg.y + pDrawable->y - y);
- break;
- }
- }
- fbValidateDrawable (pDrawable);
-}
-
-void
-rlSolidBoxClipped (DrawablePtr pDrawable,
- RegionPtr pClip,
- int x1,
- int y1,
- int x2,
- int y2,
- FbBits and,
- FbBits xor)
-{
- FbBits *dst;
- FbStride dstStride;
- int dstBpp;
- int dstXoff, dstYoff;
- BoxPtr pbox;
- int nbox;
- int partX1, partX2, partY1, partY2;
-
- fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
-
- for (nbox = REGION_NUM_RECTS(pClip), pbox = REGION_RECTS(pClip);
- nbox--;
- pbox++)
- {
- partX1 = pbox->x1;
- if (partX1 < x1)
- partX1 = x1;
-
- partX2 = pbox->x2;
- if (partX2 > x2)
- partX2 = x2;
-
- if (partX2 <= partX1)
- continue;
-
- partY1 = pbox->y1;
- if (partY1 < y1)
- partY1 = y1;
-
- partY2 = pbox->y2;
- if (partY2 > y2)
- partY2 = y2;
-
- if (partY2 <= partY1)
- continue;
-
- rlSolid (pDrawable->pScreen,
- dst + (partY1 + dstYoff) * dstStride,
- dstStride,
- (partX1 + dstXoff) * dstBpp,
- dstBpp,
-
- (partX2 - partX1) * dstBpp,
- (partY2 - partY1),
- and, xor);
- }
-}
diff --git a/miext/rootless/accel/rlFillRect.c b/miext/rootless/accel/rlFillRect.c
deleted file mode 100644
index 6efed3bd9..000000000
--- a/miext/rootless/accel/rlFillRect.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * This code is largely copied from fbfillrect.c.
- *
- * Copyright © 1998 Keith Packard
- * Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved.
- *
- * 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, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "fb.h"
-#include "rlAccel.h"
-
-
-void
-rlPolyFillRect(DrawablePtr pDrawable,
- GCPtr pGC,
- int nrect,
- xRectangle *prect)
-{
- RegionPtr pClip = fbGetCompositeClip(pGC);
- register BoxPtr pbox;
- BoxPtr pextent;
- int extentX1, extentX2, extentY1, extentY2;
- int fullX1, fullX2, fullY1, fullY2;
- int partX1, partX2, partY1, partY2;
- int xorg, yorg;
- int n;
-
- xorg = pDrawable->x;
- yorg = pDrawable->y;
-
- pextent = REGION_EXTENTS(pGC->pScreen, pClip);
- extentX1 = pextent->x1;
- extentY1 = pextent->y1;
- extentX2 = pextent->x2;
- extentY2 = pextent->y2;
- while (nrect--)
- {
- fullX1 = prect->x + xorg;
- fullY1 = prect->y + yorg;
- fullX2 = fullX1 + (int) prect->width;
- fullY2 = fullY1 + (int) prect->height;
- prect++;
-
- if (fullX1 < extentX1)
- fullX1 = extentX1;
-
- if (fullY1 < extentY1)
- fullY1 = extentY1;
-
- if (fullX2 > extentX2)
- fullX2 = extentX2;
-
- if (fullY2 > extentY2)
- fullY2 = extentY2;
-
- if ((fullX1 >= fullX2) || (fullY1 >= fullY2))
- continue;
- n = REGION_NUM_RECTS (pClip);
- if (n == 1)
- {
- rlFill (pDrawable,
- pGC,
- fullX1, fullY1, fullX2-fullX1, fullY2-fullY1);
- }
- else
- {
- pbox = REGION_RECTS(pClip);
- /*
- * clip the rectangle to each box in the clip region
- * this is logically equivalent to calling Intersect()
- */
- while(n--)
- {
- partX1 = pbox->x1;
- if (partX1 < fullX1)
- partX1 = fullX1;
- partY1 = pbox->y1;
- if (partY1 < fullY1)
- partY1 = fullY1;
- partX2 = pbox->x2;
- if (partX2 > fullX2)
- partX2 = fullX2;
- partY2 = pbox->y2;
- if (partY2 > fullY2)
- partY2 = fullY2;
-
- pbox++;
-
- if (partX1 < partX2 && partY1 < partY2)
- rlFill (pDrawable, pGC,
- partX1, partY1,
- partX2 - partX1, partY2 - partY1);
- }
- }
- }
-}
diff --git a/miext/rootless/accel/rlFillSpans.c b/miext/rootless/accel/rlFillSpans.c
deleted file mode 100644
index ab8bff065..000000000
--- a/miext/rootless/accel/rlFillSpans.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * This code is largely copied from fbfillsp.c.
- *
- * Copyright © 1998 Keith Packard
- * Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved.
- *
- * 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, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "fb.h"
-#include "rlAccel.h"
-
-
-void
-rlFillSpans (DrawablePtr pDrawable,
- GCPtr pGC,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted)
-{
- RegionPtr pClip = fbGetCompositeClip(pGC);
- BoxPtr pextent, pbox;
- int nbox;
- int extentX1, extentX2, extentY1, extentY2;
- int fullX1, fullX2, fullY1;
- int partX1, partX2;
-
- pextent = REGION_EXTENTS(pGC->pScreen, pClip);
- extentX1 = pextent->x1;
- extentY1 = pextent->y1;
- extentX2 = pextent->x2;
- extentY2 = pextent->y2;
- while (n--)
- {
- fullX1 = ppt->x;
- fullY1 = ppt->y;
- fullX2 = fullX1 + (int) *pwidth;
- ppt++;
- pwidth++;
-
- if (fullY1 < extentY1 || extentY2 <= fullY1)
- continue;
-
- if (fullX1 < extentX1)
- fullX1 = extentX1;
-
- if (fullX2 > extentX2)
- fullX2 = extentX2;
-
- if (fullX1 >= fullX2)
- continue;
-
- nbox = REGION_NUM_RECTS (pClip);
- if (nbox == 1)
- {
- rlFill (pDrawable,
- pGC,
- fullX1, fullY1, fullX2-fullX1, 1);
- }
- else
- {
- pbox = REGION_RECTS(pClip);
- while(nbox--)
- {
- if (pbox->y1 <= fullY1 && fullY1 < pbox->y2)
- {
- partX1 = pbox->x1;
- if (partX1 < fullX1)
- partX1 = fullX1;
- partX2 = pbox->x2;
- if (partX2 > fullX2)
- partX2 = fullX2;
- if (partX2 > partX1)
- {
- rlFill (pDrawable, pGC,
- partX1, fullY1,
- partX2 - partX1, 1);
- }
- }
- pbox++;
- }
- }
- }
-}
diff --git a/miext/rootless/accel/rlGlyph.c b/miext/rootless/accel/rlGlyph.c
deleted file mode 100644
index 82cd06c7f..000000000
--- a/miext/rootless/accel/rlGlyph.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * This code is largely copied from fbglyph.c.
- *
- * Copyright © 1998 Keith Packard
- * Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved.
- *
- * 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, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "fb.h"
-#include <X11/fonts/fontstruct.h>
-#include "dixfontstr.h"
-#include "rlAccel.h"
-
-
-void
-rlImageGlyphBlt (DrawablePtr pDrawable,
- GCPtr pGC,
- int x,
- int y,
- unsigned int nglyph,
- CharInfoPtr *ppciInit,
- pointer pglyphBase)
-{
- FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
- CharInfoPtr *ppci;
- CharInfoPtr pci;
- unsigned char *pglyph; /* pointer bits in glyph */
- int gWidth, gHeight; /* width and height of glyph */
- FbStride gStride; /* stride of glyph */
- Bool opaque;
- int n;
- int gx, gy;
-#ifndef FBNOPIXADDR
- void (*glyph) (FbBits *,
- FbStride,
- int,
- FbStip *,
- FbBits,
- int,
- int);
- FbBits *dst = 0;
- FbStride dstStride = 0;
- int dstBpp = 0;
- int dstXoff = 0, dstYoff = 0;
-
- glyph = 0;
- if (pPriv->and == 0)
- {
- fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
- switch (dstBpp) {
- case 8: glyph = fbGlyph8; break;
- case 16: glyph = fbGlyph16; break;
-#ifdef FB_24BIT
- case 24: glyph = fbGlyph24; break;
-#endif
- case 32: glyph = fbGlyph32; break;
- }
- }
-#endif
-
- x += pDrawable->x;
- y += pDrawable->y;
-
- if (TERMINALFONT (pGC->font)
-#ifndef FBNOPIXADDR
- && !glyph
-#endif
- )
- {
- opaque = TRUE;
- }
- else
- {
- int xBack, widthBack;
- int yBack, heightBack;
-
- ppci = ppciInit;
- n = nglyph;
- widthBack = 0;
- while (n--)
- widthBack += (*ppci++)->metrics.characterWidth;
-
- xBack = x;
- if (widthBack < 0)
- {
- xBack += widthBack;
- widthBack = -widthBack;
- }
- yBack = y - FONTASCENT(pGC->font);
- heightBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);
- rlSolidBoxClipped (pDrawable,
- fbGetCompositeClip(pGC),
- xBack,
- yBack,
- xBack + widthBack,
- yBack + heightBack,
- fbAnd(GXcopy,pPriv->bg,pPriv->pm),
- fbXor(GXcopy,pPriv->bg,pPriv->pm));
- opaque = FALSE;
- }
-
- ppci = ppciInit;
- while (nglyph--)
- {
- pci = *ppci++;
- pglyph = FONTGLYPHBITS(pglyphBase, pci);
- gWidth = GLYPHWIDTHPIXELS(pci);
- gHeight = GLYPHHEIGHTPIXELS(pci);
- if (gWidth && gHeight)
- {
- gx = x + pci->metrics.leftSideBearing;
- gy = y - pci->metrics.ascent;
-#ifndef FBNOPIXADDR
- if (glyph && gWidth <= sizeof (FbStip) * 8 &&
- fbGlyphIn (fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight))
- {
- (*glyph) (dst + (gy + dstYoff) * dstStride,
- dstStride,
- dstBpp,
- (FbStip *) pglyph,
- pPriv->fg,
- gx + dstXoff,
- gHeight);
- }
- else
-#endif
- {
- gStride = GLYPHWIDTHBYTESPADDED(pci) / sizeof (FbStip);
- fbPutXYImage (pDrawable,
- fbGetCompositeClip(pGC),
- pPriv->fg,
- pPriv->bg,
- pPriv->pm,
- GXcopy,
- opaque,
-
- gx,
- gy,
- gWidth, gHeight,
-
- (FbStip *) pglyph,
- gStride,
- 0);
- }
- }
- x += pci->metrics.characterWidth;
- }
-}
diff --git a/miext/rootless/accel/rlSolid.c b/miext/rootless/accel/rlSolid.c
deleted file mode 100644
index fa4160f38..000000000
--- a/miext/rootless/accel/rlSolid.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Accelerated rootless fill
- */
-/*
- * This code is largely copied from fbsolid.c.
- *
- * Copyright © 1998 Keith Packard
- * Copyright (c) 2002 Apple Computer, Inc. All Rights Reserved.
- * Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved.
- *
- * 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, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "fb.h"
-#include "rootlessCommon.h"
-
-
-void
-rlSolid (ScreenPtr pScreen,
- FbBits *dst,
- FbStride dstStride,
- int dstX,
- int bpp,
-
- int width,
- int height,
-
- FbBits and,
- FbBits xor)
-{
- FbBits startmask, endmask;
- int n, nmiddle;
- int startbyte, endbyte;
-
-#ifdef FB_24BIT
- if (bpp == 24 && (!FbCheck24Pix(and) || !FbCheck24Pix(xor)))
- {
- fbSolid24 (dst, dstStride, dstX, width, height, and, xor);
- return;
- }
-#endif
-
- dst += dstX >> FB_SHIFT;
- dstX &= FB_MASK;
- FbMaskBitsBytes(dstX, width, and == 0, startmask, startbyte,
- nmiddle, endmask, endbyte);
-
- /*
- * Beginning of the rootless acceleration code
- */
- if (!startmask && !endmask && !and &&
- height * nmiddle * sizeof (*dst) > rootless_FillBytes_threshold &&
- SCREENREC(pScreen)->imp->FillBytes)
- {
- if (bpp <= 8)
- xor |= xor << 8;
- if (bpp <= 16)
- xor |= xor << 16;
-
- SCREENREC(pScreen)->imp->FillBytes(nmiddle * sizeof (*dst), height,
- xor, (char *) dst + (dstX >> 3),
- dstStride * sizeof (*dst));
- return;
- }
- /* End of the rootless acceleration code */
-
- if (startmask)
- dstStride--;
- dstStride -= nmiddle;
- while (height--)
- {
- if (startmask)
- {
- FbDoLeftMaskByteRRop(dst,startbyte,startmask,and,xor);
- dst++;
- }
- n = nmiddle;
- if (!and)
- while (n--)
- *dst++ = xor;
- else
- while (n--)
- {
- *dst = FbDoRRop (*dst, and, xor);
- dst++;
- }
- if (endmask)
- FbDoRightMaskByteRRop(dst,endbyte,endmask,and,xor);
- dst += dstStride;
- }
-}
diff --git a/miext/rootless/rootlessConfig.h b/miext/rootless/rootlessConfig.h
index ab0187e83..50bac3f51 100644
--- a/miext/rootless/rootlessConfig.h
+++ b/miext/rootless/rootlessConfig.h
@@ -36,12 +36,12 @@
#ifdef __APPLE__
-# define ROOTLESS_ACCEL TRUE
# define ROOTLESS_GLOBAL_COORDS TRUE
# define ROOTLESS_PROTECT_ALPHA TRUE
# define ROOTLESS_REDISPLAY_DELAY 10
# define ROOTLESS_RESIZE_GRAVITY TRUE
# undef ROOTLESS_TRACK_DAMAGE
+/*# define ROOTLESSDEBUG*/
/* 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
@@ -52,7 +52,6 @@
#if defined(__CYGWIN__) || defined(WIN32)
-# define ROOTLESS_ACCEL YES
# define ROOTLESS_GLOBAL_COORDS TRUE
# define ROOTLESS_PROTECT_ALPHA NO
# define ROOTLESS_REDISPLAY_DELAY 10
diff --git a/miext/rootless/rootlessGC.c b/miext/rootless/rootlessGC.c
index c80b11f1d..1c787b6ad 100644
--- a/miext/rootless/rootlessGC.c
+++ b/miext/rootless/rootlessGC.c
@@ -118,7 +118,7 @@ static GCOps rootlessGCOps = {
/*
There are two issues we must contend with when drawing. These are
- controlled with ROOTLESS_PROTECT_ALPHA and ROOTLESS_ACCEL.
+ controlled with ROOTLESS_PROTECT_ALPHA and RootlessAccelInit().
If ROOTLESS_PROTECT_ALPHA is set, we have to make sure that the alpha
channel of the on screen windows is always opaque. fb makes this harder
@@ -141,9 +141,9 @@ static GCOps rootlessGCOps = {
from another window since its alpha channel must also be opaque.
The other issue to consider is that the rootless implementation may
- provide accelerated drawing functions if ROOTLESS_ACCEL is set. For some
- drawing primitives we swap in rootless acceleration functions, which use
- the accelerated drawing functions where possible.
+ provide accelerated drawing functions if RootlessAccelInit() is called.For
+ some drawing primitives we swap in rootless acceleration functions, which
+ use the accelerated drawing functions where possible.
Where both alpha protection and acceleration is used, it is even a bigger
win to relax the planemask to all ones because most accelerated drawing
diff --git a/miext/rootless/rootlessWindow.c b/miext/rootless/rootlessWindow.c
index 0dad44a99..df1d3a879 100644
--- a/miext/rootless/rootlessWindow.c
+++ b/miext/rootless/rootlessWindow.c
@@ -117,12 +117,10 @@ rootlessHasRoot (ScreenPtr pScreen)
}
void
-RootlessNativeWindowStateChanged (xp_window_id id, unsigned int state)
+RootlessNativeWindowStateChanged (WindowPtr pWin, unsigned int state)
{
- WindowPtr pWin;
RootlessWindowRec *winRec;
- pWin = xprGetXWindow (id);
if (pWin == NULL) return;
winRec = WINREC (pWin);
@@ -130,39 +128,41 @@ RootlessNativeWindowStateChanged (xp_window_id id, unsigned int state)
winRec->is_offscreen = ((state & XP_WINDOW_STATE_OFFSCREEN) != 0);
winRec->is_obscured = ((state & XP_WINDOW_STATE_OBSCURED) != 0);
- // pWin->rootlessUnhittable = winRec->is_offscreen;
+ pWin->rootlessUnhittable = winRec->is_offscreen;
}
-void
-RootlessNativeWindowMoved (WindowPtr pWin)
-{
- xp_box bounds;
- int sx, sy;
- XID vlist[2];
- Mask mask;
- ClientPtr client;
- RootlessWindowRec *winRec = WINREC(pWin);
-
- if (xp_get_window_bounds (winRec->wid, &bounds) != Success) return;
-
- sx = dixScreenOrigins[pWin->drawable.pScreen->myNum].x + darwinMainScreenX;
- sy = dixScreenOrigins[pWin->drawable.pScreen->myNum].y + darwinMainScreenY;
-
- /* Fake up a ConfigureWindow packet to resize the window to the current bounds. */
-
- vlist[0] = (INT16) bounds.x1 - sx;
- vlist[1] = (INT16) bounds.y1 - sy;
- mask = CWX | CWY;
-
- /* pretend we're the owner of the window! */
- client = LookupClient (pWin->drawable.id, NullClient);
-
- /* Don't want to do anything to the physical window (avoids
+void RootlessNativeWindowMoved (WindowPtr pWin) {
+ xp_box bounds;
+ int sx, sy, err;
+ XID vlist[2];
+ Mask mask;
+ ClientPtr client, pClient;
+ RootlessWindowRec *winRec = WINREC(pWin);
+
+ if (xp_get_window_bounds ((xp_window_id)winRec->wid, &bounds) != Success) return;
+
+ sx = dixScreenOrigins[pWin->drawable.pScreen->myNum].x + darwinMainScreenX;
+ sy = dixScreenOrigins[pWin->drawable.pScreen->myNum].y + darwinMainScreenY;
+
+ /* Fake up a ConfigureWindow packet to resize the window to the current bounds. */
+
+ vlist[0] = (INT16) bounds.x1 - sx;
+ vlist[1] = (INT16) bounds.y1 - sy;
+ mask = CWX | CWY;
+
+ /* pretend we're the owner of the window! */
+ err = dixLookupClient(&pClient, pWin->drawable.id, NullClient, DixUnknownAccess);
+ if(err != Success) {
+ ErrorF("RootlessNativeWindowMoved(): Failed to lookup window: 0x%x\n", pWin->drawable.id);
+ return;
+ }
+
+ /* Don't want to do anything to the physical window (avoids
notification-response feedback loops) */
-
- no_configure_window = TRUE;
- ConfigureWindow (pWin, mask, vlist, client);
- no_configure_window = FALSE;
+
+ no_configure_window = TRUE;
+ ConfigureWindow (pWin, mask, vlist, client);
+ no_configure_window = FALSE;
}
/* Updates the _NATIVE_SCREEN_ORIGIN property on the given root window. */
@@ -1426,6 +1426,10 @@ RootlessReparentWindow(WindowPtr pWin, WindowPtr pPriorParent)
pTopWin = TopLevelParent(pWin);
assert(pTopWin != pWin);
+
+ pWin->rootlessUnhittable = FALSE;
+
+ DeleteProperty (serverClient, pWin, xa_native_window_id ());
if (WINREC(pTopWin) != NULL) {
/* We're screwed. */
@@ -1482,7 +1486,7 @@ RootlessFlushWindowColormap (WindowPtr pWin)
wc.colormap = RootlessColormapCallback;
wc.colormap_data = pWin->drawable.pScreen;
- configure_window (winRec->wid, XP_COLORMAP, &wc);
+ configure_window ((xp_window_id)winRec->wid, XP_COLORMAP, &wc);
}
/*
diff --git a/miext/rootless/rootlessWindow.h b/miext/rootless/rootlessWindow.h
index 055589e79..45bc4c202 100644
--- a/miext/rootless/rootlessWindow.h
+++ b/miext/rootless/rootlessWindow.h
@@ -36,8 +36,6 @@
#include "rootlessCommon.h"
-#include <Xplugin.h>
-
Bool RootlessCreateWindow(WindowPtr pWin);
Bool RootlessDestroyWindow(WindowPtr pWin);
@@ -57,6 +55,6 @@ void RootlessResizeWindow(WindowPtr pWin, int x, int y,
void RootlessReparentWindow(WindowPtr pWin, WindowPtr pPriorParent);
void RootlessChangeBorderWidth(WindowPtr pWin, unsigned int width);
void RootlessNativeWindowMoved (WindowPtr pWin);
-void RootlessNativeWindowStateChanged (xp_window_id id, unsigned int state);
+void RootlessNativeWindowStateChanged (WindowPtr pWin, unsigned int state);
#endif
diff --git a/os/WaitFor.c b/os/WaitFor.c
index 36e01ca38..da12976ca 100644
--- a/os/WaitFor.c
+++ b/os/WaitFor.c
@@ -332,13 +332,9 @@ WaitForSomething(int *pClientsReady)
if (XFD_ANYSET (&devicesReadable) || XFD_ANYSET (&clientsReadable))
break;
-#ifdef WIN32
- /* Windows keyboard and mouse events are added to the input queue
- in Block- and WakupHandlers. There is no device to check if
- data is ready. So check here if new input is available */
+ /* check here for DDXes that queue events during Block/Wakeup */
if (*checkForInput[0] != *checkForInput[1])
return 0;
-#endif
}
}
diff --git a/os/connection.c b/os/connection.c
index 1ae50fef0..396593698 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -139,9 +139,6 @@ SOFTWARE.
#include <X11/Xpoll.h>
#include "opaque.h"
#include "dixstruct.h"
-#ifdef XAPPGROUP
-#include "appgroup.h"
-#endif
#include "xace.h"
#ifdef X_NOT_POSIX
diff --git a/os/utils.c b/os/utils.c
index d2b567484..d1bc1a18a 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -149,9 +149,6 @@ _X_EXPORT Bool noDbeExtension = FALSE;
#ifdef DPMSExtension
_X_EXPORT Bool noDPMSExtension = FALSE;
#endif
-#ifdef EVI
-_X_EXPORT Bool noEVIExtension = FALSE;
-#endif
#ifdef FONTCACHE
_X_EXPORT Bool noFontCacheExtension = FALSE;
#endif
@@ -165,9 +162,6 @@ _X_EXPORT Bool noScreenSaverExtension = FALSE;
#ifdef MITSHM
_X_EXPORT Bool noMITShmExtension = FALSE;
#endif
-#ifdef MITMISC
-_X_EXPORT Bool noMITMiscExtension = FALSE;
-#endif
#ifdef MULTIBUFFER
_X_EXPORT Bool noMultibufferExtension = FALSE;
#endif
@@ -186,15 +180,9 @@ _X_EXPORT Bool noSecurityExtension = FALSE;
#ifdef XSYNC
_X_EXPORT Bool noSyncExtension = FALSE;
#endif
-#ifdef TOGCUP
-_X_EXPORT Bool noXcupExtension = FALSE;
-#endif
#ifdef RES
_X_EXPORT Bool noResExtension = FALSE;
#endif
-#ifdef XAPPGROUP
-_X_EXPORT Bool noXagExtension = FALSE;
-#endif
#ifdef XCMISC
_X_EXPORT Bool noXCMiscExtension = FALSE;
#endif
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index 7d099f261..41b4e4c8e 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -1023,7 +1023,7 @@ _XkbFilterDeviceBtn( XkbSrvInfoPtr xkbi,
DeviceIntPtr dev;
int button;
- if (dev == inputInfo.keyboard)
+ if (xkbi->device == inputInfo.keyboard)
return 0;
if (filter->keycode==0) { /* initial press */
diff --git a/xorg-server.pc.in b/xorg-server.pc.in
index 53b4ed28c..139adf487 100644
--- a/xorg-server.pc.in
+++ b/xorg-server.pc.in
@@ -14,6 +14,6 @@ abi_font=@abi_font@
Name: xorg-server
Description: Modular X.Org X Server
Version: @PACKAGE_VERSION@
-Requires: pixman-1
+Requires: pixman-1 pciaccess
Cflags: -I${sdkdir}
Libs: -L${libdir}