Speed up checkout and autogen by removing disused iplan2p4 and ilbm.
This commit is contained in:
@@ -20,6 +20,12 @@
|
|||||||
Remove xf8_32wid, it's dead code with no maintainer interest. Also
|
Remove xf8_32wid, it's dead code with no maintainer interest. Also
|
||||||
remove cfb24, since xf8_32wid was the only user.
|
remove cfb24, since xf8_32wid was the only user.
|
||||||
|
|
||||||
|
* configure.ac:
|
||||||
|
* Makefile.am:
|
||||||
|
* ilbm/*:
|
||||||
|
* iplan2p4/*:
|
||||||
|
Speed up checkout and autogen by removing disused iplan2p4 and ilbm.
|
||||||
|
|
||||||
2006-01-19 Daniel Stone <daniel@freedesktop.org>
|
2006-01-19 Daniel Stone <daniel@freedesktop.org>
|
||||||
|
|
||||||
* GL/symlink-mesa.sh:
|
* GL/symlink-mesa.sh:
|
||||||
|
|||||||
@@ -91,10 +91,7 @@ DIST_SUBDIRS = \
|
|||||||
afb \
|
afb \
|
||||||
cfb \
|
cfb \
|
||||||
cfb16 \
|
cfb16 \
|
||||||
cfb24 \
|
|
||||||
cfb32 \
|
cfb32 \
|
||||||
ilbm \
|
|
||||||
iplan2p4 \
|
|
||||||
record \
|
record \
|
||||||
xfixes \
|
xfixes \
|
||||||
damageext \
|
damageext \
|
||||||
|
|||||||
@@ -1521,8 +1521,6 @@ mfb/Makefile
|
|||||||
cfb/Makefile
|
cfb/Makefile
|
||||||
cfb16/Makefile
|
cfb16/Makefile
|
||||||
cfb32/Makefile
|
cfb32/Makefile
|
||||||
ilbm/Makefile
|
|
||||||
iplan2p4/Makefile
|
|
||||||
mi/Makefile
|
mi/Makefile
|
||||||
miext/Makefile
|
miext/Makefile
|
||||||
miext/damage/Makefile
|
miext/damage/Makefile
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
EXTRA_DIST = \
|
|
||||||
ilbm.h \
|
|
||||||
ilbmbitblt.c \
|
|
||||||
ilbmblt.c \
|
|
||||||
ilbmbres.c \
|
|
||||||
ilbmbresd.c \
|
|
||||||
ilbmbstore.c \
|
|
||||||
ilbmclip.c \
|
|
||||||
ilbmcmap.c \
|
|
||||||
ilbmfillarc.c \
|
|
||||||
ilbmfillrct.c \
|
|
||||||
ilbmfillsp.c \
|
|
||||||
ilbmfont.c \
|
|
||||||
ilbmgc.c \
|
|
||||||
ilbmgetsp.c \
|
|
||||||
ilbmhrzvert.c \
|
|
||||||
ilbmimage.c \
|
|
||||||
ilbmimggblt.c \
|
|
||||||
ilbmline.c \
|
|
||||||
ilbmmisc.c \
|
|
||||||
ilbmpixmap.c \
|
|
||||||
ilbmply1rct.c \
|
|
||||||
ilbmplygblt.c \
|
|
||||||
ilbmpntarea.c \
|
|
||||||
ilbmpntwin.c \
|
|
||||||
ilbmpolypnt.c \
|
|
||||||
ilbmpushpxl.c \
|
|
||||||
ilbmscrinit.c \
|
|
||||||
ilbmsetsp.c \
|
|
||||||
ilbmtegblt.c \
|
|
||||||
ilbmtile.c \
|
|
||||||
ilbmwindow.c \
|
|
||||||
ilbmzerarc.c \
|
|
||||||
README
|
|
||||||
17
ilbm/README
17
ilbm/README
@@ -1,17 +0,0 @@
|
|||||||
|
|
||||||
ilbm -- Interleaved bitplanes for Amiga
|
|
||||||
© Copyright 1995 by Geert Uytterhoeven and Others (read the sources)
|
|
||||||
|
|
||||||
All stuff in this directory is based on Xdaniver, which is based on mfb (read
|
|
||||||
../afb/Xdaniver.doc).
|
|
||||||
|
|
||||||
I made changes to support the interleaved mode of the Linux/68k Amiga Color
|
|
||||||
Frame Buffer Device, which uses interleaved bitplanes instead of normal
|
|
||||||
bitplanes.
|
|
||||||
|
|
||||||
Note: there are still some annoying bugs left in ilbmimage.
|
|
||||||
|
|
||||||
--
|
|
||||||
Geert Uytterhoeven Geert.Uytterhoeven@cs.kuleuven.ac.be
|
|
||||||
Wavelets, Linux/m68k on Amiga http://www.cs.kuleuven.ac.be/~geert/
|
|
||||||
Department of Computer Science -- Katholieke Universiteit Leuven -- Belgium
|
|
||||||
1051
ilbm/ilbm.h
1051
ilbm/ilbm.h
File diff suppressed because it is too large
Load Diff
@@ -1,483 +0,0 @@
|
|||||||
/* $XFree86: xc/programs/Xserver/ilbm/ilbmbitblt.c,v 3.2tsi Exp $ */
|
|
||||||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
|
||||||
/***********************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
******************************************************************/
|
|
||||||
/* $XConsortium: ilbmbitblt.c,v 5.25 94/04/17 20:28:16 dpw Exp $ */
|
|
||||||
|
|
||||||
/* Modified jun 95 by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
|
|
||||||
to use interleaved bitplanes instead of normal bitplanes */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include <X11/Xprotostr.h>
|
|
||||||
|
|
||||||
#include "miscstruct.h"
|
|
||||||
#include "regionstr.h"
|
|
||||||
#include "gcstruct.h"
|
|
||||||
#include "windowstr.h"
|
|
||||||
#include "pixmapstr.h"
|
|
||||||
#include "scrnintstr.h"
|
|
||||||
|
|
||||||
#include "mi.h"
|
|
||||||
|
|
||||||
#include "ilbm.h"
|
|
||||||
#include "maskbits.h"
|
|
||||||
|
|
||||||
|
|
||||||
static unsigned char ilbmRropsOS[AFB_MAX_DEPTH];
|
|
||||||
|
|
||||||
/* CopyArea and CopyPlane for a monchrome frame buffer
|
|
||||||
|
|
||||||
|
|
||||||
clip the source rectangle to the source's available bits. (this
|
|
||||||
avoids copying unnecessary pieces that will just get exposed anyway.)
|
|
||||||
this becomes the new shape of the destination.
|
|
||||||
clip the destination region to the composite clip in the
|
|
||||||
GC. this requires translating the destination region to (dstx, dsty).
|
|
||||||
build a list of source points, one for each rectangle in the
|
|
||||||
destination. this is a simple translation.
|
|
||||||
go do the multiple rectangle copies
|
|
||||||
do graphics exposures
|
|
||||||
*/
|
|
||||||
/** Optimized for drawing pixmaps into windows, especially when drawing into
|
|
||||||
** unobscured windows. Calls to the general-purpose region code were
|
|
||||||
** replaced with rectangle-to-rectangle clipping comparisions. This is
|
|
||||||
** possible, since the pixmap is a single rectangle. In an unobscured
|
|
||||||
** window, the destination clip is also a single rectangle, and region
|
|
||||||
** code can be avoided entirely. This is a big savings, since the region
|
|
||||||
** code uses XAlloc() and makes many function calls.
|
|
||||||
**
|
|
||||||
** In addition, if source is a pixmap, there is no need to call the
|
|
||||||
** expensive miHandleExposures() routine. Instead, we simply return NULL.
|
|
||||||
**
|
|
||||||
** Previously, drawing a pixmap into an unobscured window executed at least
|
|
||||||
** 8 XAlloc()'s, 30 function calls, and hundreds of lines of code.
|
|
||||||
**
|
|
||||||
** Now, the same operation requires no XAlloc()'s, no region function calls,
|
|
||||||
** and much less overhead. Nice for drawing lots of small pixmaps.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
ilbmDoBitblt(pSrc, pDst, alu, prgnDst, pptSrc, planemask)
|
|
||||||
DrawablePtr pSrc, pDst;
|
|
||||||
int alu;
|
|
||||||
RegionPtr prgnDst;
|
|
||||||
DDXPointPtr pptSrc;
|
|
||||||
unsigned long planemask;
|
|
||||||
{
|
|
||||||
switch (alu) {
|
|
||||||
case GXcopy:
|
|
||||||
ilbmDoBitbltCopy(pSrc, pDst, alu, prgnDst, pptSrc, planemask);
|
|
||||||
break;
|
|
||||||
case GXxor:
|
|
||||||
ilbmDoBitbltXor(pSrc, pDst, alu, prgnDst, pptSrc, planemask);
|
|
||||||
break;
|
|
||||||
case GXcopyInverted:
|
|
||||||
ilbmDoBitbltCopyInverted(pSrc, pDst, alu, prgnDst, pptSrc, planemask);
|
|
||||||
break;
|
|
||||||
case GXor:
|
|
||||||
ilbmDoBitbltOr(pSrc, pDst, alu, prgnDst, pptSrc, planemask);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
ilbmDoBitbltGeneral(pSrc, pDst, alu, prgnDst, pptSrc, planemask);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RegionPtr
|
|
||||||
ilbmCopyArea(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height,
|
|
||||||
dstx, dsty)
|
|
||||||
DrawablePtr pSrcDrawable;
|
|
||||||
DrawablePtr pDstDrawable;
|
|
||||||
GC *pGC;
|
|
||||||
int srcx, srcy;
|
|
||||||
int width, height;
|
|
||||||
int dstx, dsty;
|
|
||||||
{
|
|
||||||
void (*doBitBlt)();
|
|
||||||
|
|
||||||
switch (pGC->alu) {
|
|
||||||
case GXcopy:
|
|
||||||
doBitBlt = ilbmDoBitbltCopy;
|
|
||||||
break;
|
|
||||||
case GXxor:
|
|
||||||
doBitBlt = ilbmDoBitbltXor;
|
|
||||||
break;
|
|
||||||
case GXcopyInverted:
|
|
||||||
doBitBlt = ilbmDoBitbltCopyInverted;
|
|
||||||
break;
|
|
||||||
case GXor:
|
|
||||||
doBitBlt = ilbmDoBitbltOr;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
doBitBlt = ilbmDoBitbltGeneral;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return(ilbmBitBlt(pSrcDrawable, pDstDrawable, pGC, srcx, srcy,
|
|
||||||
width, height, dstx, dsty, doBitBlt, pGC->planemask));
|
|
||||||
}
|
|
||||||
|
|
||||||
RegionPtr
|
|
||||||
ilbmBitBlt(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height,
|
|
||||||
dstx, dsty, doBitBlt, planemask)
|
|
||||||
register DrawablePtr pSrcDrawable;
|
|
||||||
register DrawablePtr pDstDrawable;
|
|
||||||
register GC *pGC;
|
|
||||||
int srcx, srcy;
|
|
||||||
int width, height;
|
|
||||||
int dstx, dsty;
|
|
||||||
void (*doBitBlt)();
|
|
||||||
unsigned long planemask;
|
|
||||||
{
|
|
||||||
RegionPtr prgnSrcClip; /* 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 */
|
|
||||||
void (*localDoBitBlt)();
|
|
||||||
|
|
||||||
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 = pGC->pCompositeClip;
|
|
||||||
else
|
|
||||||
fastClip = 1;
|
|
||||||
else if (pGC->subWindowMode == IncludeInferiors)
|
|
||||||
if (!((WindowPtr)pSrcDrawable)->parent)
|
|
||||||
/*
|
|
||||||
* 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 = pGC->pCompositeClip;
|
|
||||||
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 */
|
|
||||||
cclip = pGC->pCompositeClip;
|
|
||||||
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, pGC->pCompositeClip);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Do bit blitting */
|
|
||||||
numRects = REGION_NUM_RECTS(&rgnDst);
|
|
||||||
if (numRects && width && height) {
|
|
||||||
if (!(pptSrc = (DDXPointPtr)ALLOCATE_LOCAL(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,
|
|
||||||
planemask);
|
|
||||||
|
|
||||||
DEALLOCATE_LOCAL(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, (unsigned long)0);
|
|
||||||
}
|
|
||||||
REGION_UNINIT(pGC->pScreen, &rgnDst);
|
|
||||||
if (freeSrcClip)
|
|
||||||
REGION_DESTROY(pGC->pScreen, prgnSrcClip);
|
|
||||||
return prgnExposed;
|
|
||||||
}
|
|
||||||
|
|
||||||
RegionPtr
|
|
||||||
ilbmCopyPlane(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height,
|
|
||||||
dstx, dsty, plane)
|
|
||||||
DrawablePtr pSrcDrawable, pDstDrawable;
|
|
||||||
register GC *pGC;
|
|
||||||
int srcx, srcy;
|
|
||||||
int width, height;
|
|
||||||
int dstx, dsty;
|
|
||||||
unsigned long plane;
|
|
||||||
{
|
|
||||||
int alu;
|
|
||||||
RegionPtr prgnExposed = NULL;
|
|
||||||
unsigned long old_planemask;
|
|
||||||
PixmapPtr pPixmap = NULL;
|
|
||||||
|
|
||||||
if (pDstDrawable->depth == 1) {
|
|
||||||
old_planemask = pGC->planemask;
|
|
||||||
pGC->planemask = plane;
|
|
||||||
if ((pGC->fgPixel & 1) == 1 && (pGC->bgPixel & 1) == 0) {
|
|
||||||
prgnExposed = (*pGC->ops->CopyArea)(pSrcDrawable, pDstDrawable,
|
|
||||||
pGC, srcx, srcy, width, height, dstx, dsty);
|
|
||||||
} else if ((pGC->fgPixel & 1) == (pGC->bgPixel & 1)) {
|
|
||||||
unsigned char rop;
|
|
||||||
|
|
||||||
ilbmReduceRop(pGC->alu, pGC->fgPixel, 1, 1, &rop);
|
|
||||||
alu = pGC->alu;
|
|
||||||
pGC->alu = rop;
|
|
||||||
prgnExposed = (*pGC->ops->CopyArea)(pSrcDrawable, pDstDrawable, pGC,
|
|
||||||
srcx, srcy, width, height, dstx,
|
|
||||||
dsty);
|
|
||||||
pGC->alu = alu;
|
|
||||||
} else { /* need to invert the src */
|
|
||||||
alu = pGC->alu;
|
|
||||||
pGC->alu = ilbmInverseAlu[alu];
|
|
||||||
prgnExposed = (*pGC->ops->CopyArea)(pSrcDrawable, pDstDrawable, pGC,
|
|
||||||
srcx, srcy, width, height, dstx,
|
|
||||||
dsty);
|
|
||||||
pGC->alu = alu;
|
|
||||||
}
|
|
||||||
pGC->planemask = old_planemask;
|
|
||||||
} else {
|
|
||||||
int free_pixmap = FALSE;
|
|
||||||
PixmapPtr pBitmap = (PixmapPtr)pSrcDrawable;
|
|
||||||
ScreenPtr pScreen = pSrcDrawable->pScreen;
|
|
||||||
GCPtr pGC1;
|
|
||||||
|
|
||||||
if (pSrcDrawable == pDstDrawable ||
|
|
||||||
pSrcDrawable->type == DRAWABLE_WINDOW || pSrcDrawable->depth != 1) {
|
|
||||||
/* Copy a plane from source drawable to a tmp 1-bit deep pixmap */
|
|
||||||
/* XXX: Range check width and height */
|
|
||||||
pBitmap = (*pScreen->CreatePixmap)(pScreen, width, height, 1);
|
|
||||||
|
|
||||||
if (!pBitmap)
|
|
||||||
return(NULL);
|
|
||||||
pGC1 = GetScratchGC(1, pScreen);
|
|
||||||
if (!pGC1) {
|
|
||||||
(*pScreen->DestroyPixmap)(pBitmap);
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
ValidateGC((DrawablePtr)pBitmap, pGC1);
|
|
||||||
(void)ilbmBitBlt(pSrcDrawable, (DrawablePtr)pBitmap, pGC1, srcx, srcy,
|
|
||||||
width, height, 0, 0, ilbmDoBitbltCopy, plane);
|
|
||||||
free_pixmap = TRUE;
|
|
||||||
}
|
|
||||||
#if 0
|
|
||||||
else {
|
|
||||||
/* XXX: could cope with N-deep pixmap source case without using tmp
|
|
||||||
* src bitmap by setting up a scratch pixmap header and fiddle
|
|
||||||
* around with the pbits pointer.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
ilbmReduceOpaqueStipple(pGC->fgPixel, pGC->bgPixel, pGC->planemask,
|
|
||||||
pGC->depth, ilbmRropsOS);
|
|
||||||
(void)ilbmBitBlt((DrawablePtr)pBitmap, pDstDrawable, pGC, 0, 0, width,
|
|
||||||
height, dstx, dsty, ilbmCopy1ToN, pGC->planemask);
|
|
||||||
if (free_pixmap) {
|
|
||||||
(*pScreen->DestroyPixmap)(pBitmap);
|
|
||||||
FreeScratchGC(pGC1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pGC->fExpose)
|
|
||||||
prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC, srcx,
|
|
||||||
srcy, width, height, dstx, dsty,
|
|
||||||
plane);
|
|
||||||
}
|
|
||||||
return prgnExposed;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ilbmCopy1ToN(pSrc, pDst, alu, prgnDst, pptSrc, planemask)
|
|
||||||
DrawablePtr pSrc, pDst;
|
|
||||||
int alu;
|
|
||||||
RegionPtr prgnDst;
|
|
||||||
DDXPointPtr pptSrc;
|
|
||||||
unsigned long planemask;
|
|
||||||
{
|
|
||||||
int numRects = REGION_NUM_RECTS(prgnDst);
|
|
||||||
BoxPtr pbox = REGION_RECTS(prgnDst);
|
|
||||||
int r;
|
|
||||||
|
|
||||||
for (r = 0; r < numRects; r++, pbox++, pptSrc++) {
|
|
||||||
int dx = pptSrc->x;
|
|
||||||
int dy = pptSrc->y;
|
|
||||||
|
|
||||||
if (alu == GXcopy)
|
|
||||||
ilbmOpaqueStippleAreaCopy(pDst, 1, pbox, alu, (PixmapPtr)pSrc, dx, dy,
|
|
||||||
ilbmRropsOS, planemask);
|
|
||||||
else
|
|
||||||
ilbmOpaqueStippleAreaGeneral(pDst, 1, pbox, alu, (PixmapPtr)pSrc, dx,
|
|
||||||
dy, ilbmRropsOS, planemask);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
573
ilbm/ilbmblt.c
573
ilbm/ilbmblt.c
@@ -1,573 +0,0 @@
|
|||||||
/* $XFree86$ */
|
|
||||||
/*
|
|
||||||
* ilbm copy area
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
Copyright (c) 1989 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
Author: Keith Packard
|
|
||||||
|
|
||||||
*/
|
|
||||||
/* $XConsortium: ilbmblt.c,v 1.11 94/04/17 20:28:16 dpw Exp $ */
|
|
||||||
|
|
||||||
/* Modified jun 95 by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
|
|
||||||
to use interleaved bitplanes instead of normal bitplanes */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include <X11/Xmd.h>
|
|
||||||
#include <X11/Xproto.h>
|
|
||||||
#include "ilbm.h"
|
|
||||||
#include "gcstruct.h"
|
|
||||||
#include "windowstr.h"
|
|
||||||
#include "scrnintstr.h"
|
|
||||||
#include "pixmapstr.h"
|
|
||||||
#include "regionstr.h"
|
|
||||||
#include "maskbits.h"
|
|
||||||
#include "fastblt.h"
|
|
||||||
#include "mergerop.h"
|
|
||||||
|
|
||||||
void
|
|
||||||
MROP_NAME(ilbmDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc, planemask)
|
|
||||||
DrawablePtr pSrc, pDst;
|
|
||||||
int alu;
|
|
||||||
RegionPtr prgnDst;
|
|
||||||
DDXPointPtr pptSrc;
|
|
||||||
unsigned long planemask;
|
|
||||||
{
|
|
||||||
PixelType *psrcBase, *pdstBase; /* start of src and dst bitmaps */
|
|
||||||
int widthSrc, widthDst; /* add to get to same position in next line */
|
|
||||||
int heightSrc, heightDst;
|
|
||||||
int auxSrc, auxDst;
|
|
||||||
|
|
||||||
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 */
|
|
||||||
|
|
||||||
PixelType *psrcLine, *pdstLine;
|
|
||||||
/* pointers to line with current src and dst */
|
|
||||||
register PixelType *psrc; /* pointer to current src longword */
|
|
||||||
register PixelType *pdst; /* pointer to current dst longword */
|
|
||||||
|
|
||||||
MROP_DECLARE_REG()
|
|
||||||
|
|
||||||
/* following used for looping through a line */
|
|
||||||
PixelType startmask, endmask; /* masks for writing ends of dst */
|
|
||||||
int nlMiddle; /* whole longwords in dst */
|
|
||||||
int xoffSrc, xoffDst;
|
|
||||||
register int leftShift, rightShift;
|
|
||||||
register PixelType bits;
|
|
||||||
register PixelType bits1;
|
|
||||||
register int nl; /* temp copy of nlMiddle */
|
|
||||||
|
|
||||||
/* place to store full source word */
|
|
||||||
int nstart; /* number of ragged bits at start of dst */
|
|
||||||
int nend; /* number of ragged bits at end of dst */
|
|
||||||
int srcStartOver; /* pulling nstart bits from src
|
|
||||||
overflows into the next word? */
|
|
||||||
int careful;
|
|
||||||
int tmpSrc;
|
|
||||||
int depthSrc;
|
|
||||||
int depthDst;
|
|
||||||
|
|
||||||
MROP_INITIALIZE(alu,0);
|
|
||||||
|
|
||||||
ilbmGetPixelWidthAuxDepthAndPointer(pSrc, widthSrc, auxSrc, depthSrc,
|
|
||||||
psrcBase);
|
|
||||||
ilbmGetPixelWidthAuxDepthAndPointer(pDst, widthDst, auxDst, depthDst,
|
|
||||||
pdstBase);
|
|
||||||
|
|
||||||
/* Special case where depth of dest pixmap is 1 but source pixmap isn't
|
|
||||||
* Used for GetImage to copy a plane from a source pixmap to a particular
|
|
||||||
* dest pixmap plane.
|
|
||||||
* Note: planemask should have only one bit set or several planes from
|
|
||||||
* the source will be copied to the same dest plane.
|
|
||||||
*/
|
|
||||||
if (depthDst == 1 && depthDst != depthSrc)
|
|
||||||
widthDst = 0;
|
|
||||||
|
|
||||||
/* 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;
|
|
||||||
auxSrc = -auxSrc;
|
|
||||||
auxDst = -auxDst;
|
|
||||||
|
|
||||||
if (nbox > 1) {
|
|
||||||
/* keep ordering in each band, reverse order of bands */
|
|
||||||
pboxNew1 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec)*nbox);
|
|
||||||
if (!pboxNew1)
|
|
||||||
return;
|
|
||||||
pptNew1 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec)*nbox);
|
|
||||||
if (!pptNew1) {
|
|
||||||
DEALLOCATE_LOCAL(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)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox);
|
|
||||||
pptNew2 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox);
|
|
||||||
if (!pboxNew2 || !pptNew2) {
|
|
||||||
if (pptNew2)
|
|
||||||
DEALLOCATE_LOCAL(pptNew2);
|
|
||||||
if (pboxNew2)
|
|
||||||
DEALLOCATE_LOCAL(pboxNew2);
|
|
||||||
if (pboxNew1) {
|
|
||||||
DEALLOCATE_LOCAL(pptNew1);
|
|
||||||
DEALLOCATE_LOCAL(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--) {
|
|
||||||
int d;
|
|
||||||
for (d = 0; d < depthSrc; d++) {
|
|
||||||
PixelType *psrcB;
|
|
||||||
PixelType *pdstB;
|
|
||||||
|
|
||||||
if (!(planemask & (1 << d)))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
psrcB = psrcBase + widthSrc * d; /* @@@ NEXT PLANE @@@ */
|
|
||||||
pdstB = pdstBase + widthDst * d; /* @@@ NEXT PLANE @@@ */
|
|
||||||
|
|
||||||
w = pbox->x2 - pbox->x1;
|
|
||||||
h = pbox->y2 - pbox->y1;
|
|
||||||
|
|
||||||
if (ydir == -1) { /* start at last scanline of rectangle */
|
|
||||||
psrcLine = ilbmScanlineDeltaSrc(psrcB, -(pptSrc->y+h-1), auxSrc);
|
|
||||||
pdstLine = ilbmScanlineDeltaDst(pdstB, -(pbox->y2-1), auxDst);
|
|
||||||
} else { /* start at first scanline */
|
|
||||||
psrcLine = ilbmScanlineDeltaSrc(psrcB, pptSrc->y, auxSrc);
|
|
||||||
pdstLine = ilbmScanlineDeltaDst(pdstB, pbox->y1, auxDst);
|
|
||||||
}
|
|
||||||
if ((pbox->x1 & PIM) + w <= PPW) {
|
|
||||||
maskpartialbits (pbox->x1, w, startmask);
|
|
||||||
endmask = 0;
|
|
||||||
nlMiddle = 0;
|
|
||||||
} else {
|
|
||||||
maskbits(pbox->x1, w, startmask, endmask, nlMiddle);
|
|
||||||
}
|
|
||||||
if (xdir == 1) {
|
|
||||||
xoffSrc = pptSrc->x & PIM;
|
|
||||||
xoffDst = pbox->x1 & PIM;
|
|
||||||
pdstLine += (pbox->x1 >> PWSH);
|
|
||||||
psrcLine += (pptSrc->x >> PWSH);
|
|
||||||
#ifdef DO_UNALIGNED_BITBLT
|
|
||||||
nl = xoffSrc - xoffDst;
|
|
||||||
psrcLine = (PixelType *)(((unsigned char *) psrcLine) + nl);
|
|
||||||
#else
|
|
||||||
if (xoffSrc == xoffDst)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
while (h--) {
|
|
||||||
psrc = psrcLine;
|
|
||||||
pdst = pdstLine;
|
|
||||||
if (startmask) {
|
|
||||||
*pdst = MROP_MASK(*psrc, *pdst, startmask);
|
|
||||||
psrc++;
|
|
||||||
pdst++;
|
|
||||||
}
|
|
||||||
nl = nlMiddle;
|
|
||||||
|
|
||||||
#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
|
|
||||||
#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
|
|
||||||
DuffL(nl, label1,
|
|
||||||
*pdst = MROP_SOLID (*psrc, *pdst);
|
|
||||||
pdst++; psrc++;)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (endmask)
|
|
||||||
*pdst = MROP_MASK(*psrc, *pdst, endmask);
|
|
||||||
ilbmScanlineIncDst(pdstLine, auxDst);
|
|
||||||
ilbmScanlineIncSrc(psrcLine, auxSrc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#ifndef DO_UNALIGNED_BITBLT
|
|
||||||
else {
|
|
||||||
if (xoffSrc > xoffDst) {
|
|
||||||
leftShift = (xoffSrc - xoffDst);
|
|
||||||
rightShift = PPW - leftShift;
|
|
||||||
} else {
|
|
||||||
rightShift = (xoffDst - xoffSrc);
|
|
||||||
leftShift = PPW - rightShift;
|
|
||||||
}
|
|
||||||
while (h--) {
|
|
||||||
psrc = psrcLine;
|
|
||||||
pdst = pdstLine;
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
ilbmScanlineIncDst(pdstLine, auxDst);
|
|
||||||
ilbmScanlineIncSrc(psrcLine, auxSrc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* DO_UNALIGNED_BITBLT */
|
|
||||||
} else { /* xdir == -1 */
|
|
||||||
xoffSrc = (pptSrc->x + w - 1) & PIM;
|
|
||||||
xoffDst = (pbox->x2 - 1) & PIM;
|
|
||||||
pdstLine += ((pbox->x2-1) >> PWSH) + 1;
|
|
||||||
psrcLine += ((pptSrc->x+w - 1) >> PWSH) + 1;
|
|
||||||
#ifdef DO_UNALIGNED_BITBLT
|
|
||||||
nl = xoffSrc - xoffDst;
|
|
||||||
psrcLine = (PixelType *)
|
|
||||||
(((unsigned char *) psrcLine) + nl);
|
|
||||||
#else
|
|
||||||
if (xoffSrc == xoffDst)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
while (h--) {
|
|
||||||
psrc = psrcLine;
|
|
||||||
pdst = pdstLine;
|
|
||||||
if (endmask) {
|
|
||||||
pdst--;
|
|
||||||
psrc--;
|
|
||||||
*pdst = MROP_MASK (*psrc, *pdst, endmask);
|
|
||||||
}
|
|
||||||
nl = nlMiddle;
|
|
||||||
|
|
||||||
#ifdef LARGE_INSTRUCTION_CACHE
|
|
||||||
#ifdef FAST_CONSTANT_OFFSET_MODE
|
|
||||||
psrc -= nl & (UNROLL - 1);
|
|
||||||
pdst -= nl & (UNROLL - 1);
|
|
||||||
|
|
||||||
#define BodyOdd(n) pdst[n-1] = MROP_SOLID (psrc[n-1], pdst[n-1]);
|
|
||||||
|
|
||||||
#define BodyEven(n) BodyOdd(n)
|
|
||||||
|
|
||||||
#define LoopReset \
|
|
||||||
pdst -= UNROLL;\
|
|
||||||
psrc -= UNROLL;
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#define BodyOdd(n) --pdst; --psrc; *pdst = MROP_SOLID(*psrc, *pdst);
|
|
||||||
#define BodyEven(n) BodyOdd(n)
|
|
||||||
#define LoopReset ;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
PackedLoop
|
|
||||||
|
|
||||||
#undef BodyOdd
|
|
||||||
#undef BodyEven
|
|
||||||
#undef LoopReset
|
|
||||||
|
|
||||||
#else
|
|
||||||
DuffL(nl,label3,
|
|
||||||
--pdst; --psrc; *pdst = MROP_SOLID (*psrc, *pdst);)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (startmask) {
|
|
||||||
--pdst;
|
|
||||||
--psrc;
|
|
||||||
*pdst = MROP_MASK(*psrc, *pdst, startmask);
|
|
||||||
}
|
|
||||||
ilbmScanlineIncDst(pdstLine, auxDst);
|
|
||||||
ilbmScanlineIncSrc(psrcLine, auxSrc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#ifndef DO_UNALIGNED_BITBLT
|
|
||||||
else {
|
|
||||||
if (xoffDst > xoffSrc) {
|
|
||||||
rightShift = (xoffDst - xoffSrc);
|
|
||||||
leftShift = PPW - rightShift;
|
|
||||||
} else {
|
|
||||||
leftShift = (xoffSrc - xoffDst);
|
|
||||||
rightShift = PPW - leftShift;
|
|
||||||
}
|
|
||||||
while (h--) {
|
|
||||||
psrc = psrcLine;
|
|
||||||
pdst = pdstLine;
|
|
||||||
bits = 0;
|
|
||||||
if (xoffDst > xoffSrc)
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
ilbmScanlineIncDst(pdstLine, auxDst);
|
|
||||||
ilbmScanlineIncSrc(psrcLine, auxSrc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pbox++;
|
|
||||||
pptSrc++;
|
|
||||||
}
|
|
||||||
if (pboxNew2) {
|
|
||||||
DEALLOCATE_LOCAL(pptNew2);
|
|
||||||
DEALLOCATE_LOCAL(pboxNew2);
|
|
||||||
}
|
|
||||||
if (pboxNew1) {
|
|
||||||
DEALLOCATE_LOCAL(pptNew1);
|
|
||||||
DEALLOCATE_LOCAL(pboxNew1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
328
ilbm/ilbmbres.c
328
ilbm/ilbmbres.c
@@ -1,328 +0,0 @@
|
|||||||
/* $XFree86$ */
|
|
||||||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
|
||||||
/***********************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
******************************************************************/
|
|
||||||
/* $XConsortium: ilbmbres.c,v 1.22 94/04/17 20:28:17 dpw Exp $ */
|
|
||||||
|
|
||||||
/* Modified jun 95 by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
|
|
||||||
to use interleaved bitplanes instead of normal bitplanes */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include "misc.h"
|
|
||||||
#include "ilbm.h"
|
|
||||||
#include "maskbits.h"
|
|
||||||
#include "miline.h"
|
|
||||||
|
|
||||||
/* Solid bresenham line */
|
|
||||||
/* NOTES
|
|
||||||
e2 is used less often than e1, so it's not in a register
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
ilbmBresS(addrlbase, nlwidth, auxDst, depthDst, signdx, signdy, axis, x1, y1,
|
|
||||||
e, e1, e2, len, rrops)
|
|
||||||
PixelType *addrlbase; /* pointer to base of bitmap */
|
|
||||||
int nlwidth; /* width in longwords of bitmap */
|
|
||||||
int auxDst;
|
|
||||||
int depthDst;
|
|
||||||
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 */
|
|
||||||
unsigned char *rrops;
|
|
||||||
{
|
|
||||||
register int yinc; /* increment to next scanline, in bytes */
|
|
||||||
register PixelType *addrl; /* bitmask long pointer */
|
|
||||||
register PixelType bit; /* current bit being set/cleared/etc. */
|
|
||||||
PixelType leftbit = mask[0]; /* leftmost bit to process in new word */
|
|
||||||
PixelType rightbit = mask[PPW-1]; /* rightmost bit to process in new word */
|
|
||||||
|
|
||||||
register int e3 = e2-e1;
|
|
||||||
PixelType tmp;
|
|
||||||
int saveE;
|
|
||||||
int saveLen;
|
|
||||||
int d;
|
|
||||||
|
|
||||||
/* point to longword containing first point */
|
|
||||||
yinc = signdy * auxDst;
|
|
||||||
e = e-e1; /* to make looping easier */
|
|
||||||
|
|
||||||
if (!len)
|
|
||||||
return;
|
|
||||||
|
|
||||||
saveLen = len;
|
|
||||||
saveE = e;
|
|
||||||
|
|
||||||
for (d = 0; d < depthDst; d++) {
|
|
||||||
addrl = ilbmScanline(addrlbase, x1, y1, auxDst);
|
|
||||||
addrlbase += nlwidth; /* @@@ NEXT PLANE @@@ */
|
|
||||||
len = saveLen;
|
|
||||||
e = saveE;
|
|
||||||
bit = mask[x1 & PIM];
|
|
||||||
|
|
||||||
switch (rrops[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
if (axis == X_AXIS) {
|
|
||||||
if (signdx > 0) {
|
|
||||||
tmp = *addrl;
|
|
||||||
for (;;) {
|
|
||||||
tmp &= ~bit;
|
|
||||||
if (!--len)
|
|
||||||
break;
|
|
||||||
bit = SCRRIGHT(bit,1);
|
|
||||||
e += e1;
|
|
||||||
if (e >= 0) {
|
|
||||||
*addrl = tmp;
|
|
||||||
ilbmScanlineInc(addrl, yinc);
|
|
||||||
e += e3;
|
|
||||||
if (!bit) {
|
|
||||||
bit = leftbit;
|
|
||||||
addrl ++;
|
|
||||||
}
|
|
||||||
tmp = *addrl;
|
|
||||||
} else if (!bit) {
|
|
||||||
*addrl = tmp;
|
|
||||||
bit = leftbit;
|
|
||||||
addrl ++;
|
|
||||||
tmp = *addrl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*addrl = tmp;
|
|
||||||
} else {
|
|
||||||
tmp = *addrl;
|
|
||||||
for (;;) {
|
|
||||||
tmp &= ~bit;
|
|
||||||
if (!--len)
|
|
||||||
break;
|
|
||||||
e += e1;
|
|
||||||
bit = SCRLEFT(bit,1);
|
|
||||||
if (e >= 0) {
|
|
||||||
*addrl = tmp;
|
|
||||||
ilbmScanlineInc(addrl, yinc);
|
|
||||||
e += e3;
|
|
||||||
if (!bit) {
|
|
||||||
bit = rightbit;
|
|
||||||
addrl --;
|
|
||||||
}
|
|
||||||
tmp = *addrl;
|
|
||||||
} else if (!bit) {
|
|
||||||
*addrl = tmp;
|
|
||||||
bit = rightbit;
|
|
||||||
addrl --;
|
|
||||||
tmp = *addrl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*addrl = tmp;
|
|
||||||
}
|
|
||||||
} /* if X_AXIS */ else {
|
|
||||||
if (signdx > 0) {
|
|
||||||
while (len--) {
|
|
||||||
*addrl &= ~bit;
|
|
||||||
e += e1;
|
|
||||||
if (e >= 0) {
|
|
||||||
bit = SCRRIGHT(bit,1);
|
|
||||||
if (!bit) { bit = leftbit;addrl ++; }
|
|
||||||
e += e3;
|
|
||||||
}
|
|
||||||
ilbmScanlineInc(addrl, yinc);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
while (len--) {
|
|
||||||
*addrl &= ~bit;
|
|
||||||
e += e1;
|
|
||||||
if (e >= 0) {
|
|
||||||
bit = SCRLEFT(bit,1);
|
|
||||||
if (!bit) { bit = rightbit;addrl --; }
|
|
||||||
e += e3;
|
|
||||||
}
|
|
||||||
ilbmScanlineInc(addrl, yinc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} /* else Y_AXIS */
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RROP_WHITE:
|
|
||||||
if (axis == X_AXIS) {
|
|
||||||
if (signdx > 0) {
|
|
||||||
tmp = *addrl;
|
|
||||||
for (;;) {
|
|
||||||
tmp |= bit;
|
|
||||||
if (!--len)
|
|
||||||
break;
|
|
||||||
e += e1;
|
|
||||||
bit = SCRRIGHT(bit,1);
|
|
||||||
if (e >= 0) {
|
|
||||||
*addrl = tmp;
|
|
||||||
ilbmScanlineInc(addrl, yinc);
|
|
||||||
e += e3;
|
|
||||||
if (!bit) {
|
|
||||||
bit = leftbit;
|
|
||||||
addrl ++;
|
|
||||||
}
|
|
||||||
tmp = *addrl;
|
|
||||||
} else if (!bit) {
|
|
||||||
*addrl = tmp;
|
|
||||||
bit = leftbit;
|
|
||||||
addrl ++;
|
|
||||||
tmp = *addrl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*addrl = tmp;
|
|
||||||
} else {
|
|
||||||
tmp = *addrl;
|
|
||||||
for (;;) {
|
|
||||||
tmp |= bit;
|
|
||||||
if (!--len)
|
|
||||||
break;
|
|
||||||
e += e1;
|
|
||||||
bit = SCRLEFT(bit,1);
|
|
||||||
if (e >= 0) {
|
|
||||||
*addrl = tmp;
|
|
||||||
ilbmScanlineInc(addrl, yinc);
|
|
||||||
e += e3;
|
|
||||||
if (!bit) {
|
|
||||||
bit = rightbit;
|
|
||||||
addrl --;
|
|
||||||
}
|
|
||||||
tmp = *addrl;
|
|
||||||
} else if (!bit) {
|
|
||||||
*addrl = tmp;
|
|
||||||
bit = rightbit;
|
|
||||||
addrl --;
|
|
||||||
tmp = *addrl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*addrl = tmp;
|
|
||||||
}
|
|
||||||
} /* if X_AXIS */ else {
|
|
||||||
if (signdx > 0) {
|
|
||||||
while (len--) {
|
|
||||||
*addrl |= bit;
|
|
||||||
e += e1;
|
|
||||||
if (e >= 0) {
|
|
||||||
bit = SCRRIGHT(bit,1);
|
|
||||||
if (!bit) { bit = leftbit;addrl ++; }
|
|
||||||
e += e3;
|
|
||||||
}
|
|
||||||
ilbmScanlineInc(addrl, yinc);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
while (len--) {
|
|
||||||
*addrl |= bit;
|
|
||||||
e += e1;
|
|
||||||
if (e >= 0) {
|
|
||||||
bit = SCRLEFT(bit,1);
|
|
||||||
if (!bit) { bit = rightbit;addrl --; }
|
|
||||||
e += e3;
|
|
||||||
}
|
|
||||||
ilbmScanlineInc(addrl, yinc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} /* else Y_AXIS */
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RROP_INVERT:
|
|
||||||
if (axis == X_AXIS) {
|
|
||||||
if (signdx > 0) {
|
|
||||||
while (len--) {
|
|
||||||
*addrl ^= bit;
|
|
||||||
e += e1;
|
|
||||||
if (e >= 0) {
|
|
||||||
ilbmScanlineInc(addrl, yinc);
|
|
||||||
e += e3;
|
|
||||||
}
|
|
||||||
bit = SCRRIGHT(bit,1);
|
|
||||||
if (!bit) { bit = leftbit;addrl ++; }
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
while (len--) {
|
|
||||||
*addrl ^= bit;
|
|
||||||
e += e1;
|
|
||||||
if (e >= 0) {
|
|
||||||
ilbmScanlineInc(addrl, yinc);
|
|
||||||
e += e3;
|
|
||||||
}
|
|
||||||
bit = SCRLEFT(bit,1);
|
|
||||||
if (!bit) { bit = rightbit;addrl --; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} /* if X_AXIS */ else {
|
|
||||||
if (signdx > 0) {
|
|
||||||
while (len--) {
|
|
||||||
*addrl ^= bit;
|
|
||||||
e += e1;
|
|
||||||
if (e >= 0) {
|
|
||||||
bit = SCRRIGHT(bit,1);
|
|
||||||
if (!bit) { bit = leftbit;addrl ++; }
|
|
||||||
e += e3;
|
|
||||||
}
|
|
||||||
ilbmScanlineInc(addrl, yinc);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
while (len--) {
|
|
||||||
*addrl ^= bit;
|
|
||||||
e += e1;
|
|
||||||
if (e >= 0) {
|
|
||||||
bit = SCRLEFT(bit,1);
|
|
||||||
if (!bit) { bit = rightbit; addrl --; }
|
|
||||||
e += e3;
|
|
||||||
}
|
|
||||||
ilbmScanlineInc(addrl, yinc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} /* else Y_AXIS */
|
|
||||||
} /* switch */
|
|
||||||
} /* for (d = ... ) */
|
|
||||||
}
|
|
||||||
219
ilbm/ilbmbresd.c
219
ilbm/ilbmbresd.c
@@ -1,219 +0,0 @@
|
|||||||
/* $XFree86$ */
|
|
||||||
/***********************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
******************************************************************/
|
|
||||||
/* $XConsortium: ilbmbresd.c,v 1.10 94/04/17 20:28:18 dpw Exp $ */
|
|
||||||
|
|
||||||
/* Modified jun 95 by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
|
|
||||||
to use interleaved bitplanes instead of normal bitplanes */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include "misc.h"
|
|
||||||
#include "ilbm.h"
|
|
||||||
#include "maskbits.h"
|
|
||||||
#include "miline.h"
|
|
||||||
|
|
||||||
/* Dashed bresenham line */
|
|
||||||
|
|
||||||
#define StepDash\
|
|
||||||
if (!--dashRemaining) { \
|
|
||||||
if (++ dashIndex == numInDashList) \
|
|
||||||
dashIndex = 0; \
|
|
||||||
dashRemaining = pDash[dashIndex]; \
|
|
||||||
rop = fgrop; \
|
|
||||||
if (dashIndex & 1) \
|
|
||||||
rop = bgrop; \
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ilbmBresD(pdashIndex, pDash, numInDashList, pdashOffset, isDoubleDash,
|
|
||||||
addrlbase, nlwidth, auxDst, depthDst,
|
|
||||||
signdx, signdy, axis, x1, y1, e, e1, e2, len, rrops, bgrrops)
|
|
||||||
int *pdashIndex; /* current dash */
|
|
||||||
unsigned char *pDash; /* dash list */
|
|
||||||
int numInDashList; /* total length of dash list */
|
|
||||||
int *pdashOffset; /* offset into current dash */
|
|
||||||
int isDoubleDash;
|
|
||||||
PixelType *addrlbase; /* pointer to base of bitmap */
|
|
||||||
int nlwidth; /* width in longwords of bitmap */
|
|
||||||
int auxDst;
|
|
||||||
int depthDst;
|
|
||||||
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 */
|
|
||||||
unsigned char *rrops;
|
|
||||||
unsigned char *bgrrops;
|
|
||||||
{
|
|
||||||
register int yinc; /* increment to next scanline, in bytes */
|
|
||||||
register PixelType *addrl;
|
|
||||||
register int e3 = e2-e1;
|
|
||||||
register unsigned long bit;
|
|
||||||
PixelType leftbit = mask[0]; /* leftmost bit to process in new word */
|
|
||||||
PixelType rightbit = mask[PPW-1]; /* rightmost bit to process in new word */
|
|
||||||
int dashIndex;
|
|
||||||
int dashOffset;
|
|
||||||
int dashRemaining;
|
|
||||||
int rop;
|
|
||||||
int fgrop;
|
|
||||||
int bgrop;
|
|
||||||
int saveE;
|
|
||||||
int saveLen;
|
|
||||||
int d;
|
|
||||||
|
|
||||||
dashOffset = *pdashOffset;
|
|
||||||
dashIndex = *pdashIndex;
|
|
||||||
dashRemaining = pDash[dashIndex] - dashOffset;
|
|
||||||
/* point to longword containing first point */
|
|
||||||
|
|
||||||
yinc = signdy * auxDst;
|
|
||||||
e = e-e1; /* to make looping easier */
|
|
||||||
|
|
||||||
saveE = e;
|
|
||||||
saveLen = len;
|
|
||||||
|
|
||||||
for (d = 0; d < depthDst; d++) {
|
|
||||||
addrl = ilbmScanline(addrlbase, x1, y1, auxDst);
|
|
||||||
addrlbase += nlwidth; /* @@@ NEXT PLANE @@@ */
|
|
||||||
|
|
||||||
fgrop = rrops[d];
|
|
||||||
bgrop = bgrrops[d];
|
|
||||||
|
|
||||||
e = saveE;
|
|
||||||
len = saveLen;
|
|
||||||
bit = mask[x1 & PIM];
|
|
||||||
|
|
||||||
rop = fgrop;
|
|
||||||
if (!isDoubleDash)
|
|
||||||
bgrop = -1;
|
|
||||||
if (dashIndex & 1)
|
|
||||||
rop = bgrop;
|
|
||||||
|
|
||||||
if (axis == X_AXIS) {
|
|
||||||
if (signdx > 0) {
|
|
||||||
while (len--) {
|
|
||||||
if (rop == RROP_BLACK)
|
|
||||||
*addrl &= ~bit;
|
|
||||||
else if (rop == RROP_WHITE)
|
|
||||||
*addrl |= bit;
|
|
||||||
else if (rop == RROP_INVERT)
|
|
||||||
*addrl ^= bit;
|
|
||||||
e += e1;
|
|
||||||
if (e >= 0) {
|
|
||||||
ilbmScanlineInc(addrl, yinc);
|
|
||||||
e += e3;
|
|
||||||
}
|
|
||||||
bit = SCRRIGHT(bit,1);
|
|
||||||
if (!bit) { bit = leftbit;addrl ++; }
|
|
||||||
StepDash
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
while (len--) {
|
|
||||||
if (rop == RROP_BLACK)
|
|
||||||
*addrl &= ~bit;
|
|
||||||
else if (rop == RROP_WHITE)
|
|
||||||
*addrl |= bit;
|
|
||||||
else if (rop == RROP_INVERT)
|
|
||||||
*addrl ^= bit;
|
|
||||||
e += e1;
|
|
||||||
if (e >= 0) {
|
|
||||||
ilbmScanlineInc(addrl, yinc);
|
|
||||||
e += e3;
|
|
||||||
}
|
|
||||||
bit = SCRLEFT(bit,1);
|
|
||||||
if (!bit) { bit = rightbit;addrl --; }
|
|
||||||
StepDash
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} /* if X_AXIS */ else {
|
|
||||||
if (signdx > 0) {
|
|
||||||
while (len--) {
|
|
||||||
if (rop == RROP_BLACK)
|
|
||||||
*addrl &= ~bit;
|
|
||||||
else if (rop == RROP_WHITE)
|
|
||||||
*addrl |= bit;
|
|
||||||
else if (rop == RROP_INVERT)
|
|
||||||
*addrl ^= bit;
|
|
||||||
e += e1;
|
|
||||||
if (e >= 0) {
|
|
||||||
bit = SCRRIGHT(bit,1);
|
|
||||||
if (!bit) { bit = leftbit;addrl ++; }
|
|
||||||
e += e3;
|
|
||||||
}
|
|
||||||
ilbmScanlineInc(addrl, yinc);
|
|
||||||
StepDash
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
while (len--) {
|
|
||||||
if (rop == RROP_BLACK)
|
|
||||||
*addrl &= ~bit;
|
|
||||||
else if (rop == RROP_WHITE)
|
|
||||||
*addrl |= bit;
|
|
||||||
else if (rop == RROP_INVERT)
|
|
||||||
*addrl ^= bit;
|
|
||||||
e += e1;
|
|
||||||
if (e >= 0) {
|
|
||||||
bit = SCRLEFT(bit,1);
|
|
||||||
if (!bit) { bit = rightbit;addrl --; }
|
|
||||||
e += e3;
|
|
||||||
}
|
|
||||||
ilbmScanlineInc(addrl, yinc);
|
|
||||||
StepDash
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} /* else Y_AXIS */
|
|
||||||
} /* for (d = ...) */
|
|
||||||
*pdashIndex = dashIndex;
|
|
||||||
*pdashOffset = pDash[dashIndex] - dashRemaining;
|
|
||||||
}
|
|
||||||
@@ -1,159 +0,0 @@
|
|||||||
/* $XFree86$ */
|
|
||||||
/* $XConsortium: ilbmbstore.c,v 5.7 94/04/17 20:28:18 dpw Exp $ */
|
|
||||||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
|
||||||
/*
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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 X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Modified jun 95 by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
|
|
||||||
to use interleaved bitplanes instead of normal bitplanes */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "ilbm.h"
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include "mibstore.h"
|
|
||||||
#include "regionstr.h"
|
|
||||||
#include "scrnintstr.h"
|
|
||||||
#include "pixmapstr.h"
|
|
||||||
#include "windowstr.h"
|
|
||||||
|
|
||||||
/*-
|
|
||||||
*-----------------------------------------------------------------------
|
|
||||||
* ilbmSaveAreas --
|
|
||||||
* Function called by miSaveAreas to actually fetch the areas to be
|
|
||||||
* saved into the backing pixmap. This is very simple to do, since
|
|
||||||
* ilbmDoBitblt is designed for this very thing. The region to save is
|
|
||||||
* already destination-relative and we're given the offset to the
|
|
||||||
* window origin, so we have only to create an array of points of the
|
|
||||||
* u.l. corners of the boxes in the region translated to the screen
|
|
||||||
* coordinate system and fetch the screen pixmap out of its devPrivate
|
|
||||||
* field....
|
|
||||||
*
|
|
||||||
* Results:
|
|
||||||
* None.
|
|
||||||
*
|
|
||||||
* Side Effects:
|
|
||||||
* Data are copied from the screen into the pixmap.
|
|
||||||
*
|
|
||||||
*-----------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
ilbmSaveAreas(pPixmap, prgnSave, xorg, yorg, pWin)
|
|
||||||
PixmapPtr pPixmap; /* Backing pixmap */
|
|
||||||
RegionPtr prgnSave; /* Region to save (pixmap-relative) */
|
|
||||||
int xorg; /* X origin of region */
|
|
||||||
int yorg; /* Y origin of region */
|
|
||||||
WindowPtr pWin;
|
|
||||||
{
|
|
||||||
register DDXPointPtr pPt;
|
|
||||||
DDXPointPtr pPtsInit;
|
|
||||||
register BoxPtr pBox;
|
|
||||||
register int numRects;
|
|
||||||
|
|
||||||
numRects = REGION_NUM_RECTS(prgnSave);
|
|
||||||
pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(numRects * sizeof(DDXPointRec));
|
|
||||||
if (!pPtsInit)
|
|
||||||
return;
|
|
||||||
|
|
||||||
pBox = REGION_RECTS(prgnSave);
|
|
||||||
pPt = pPtsInit;
|
|
||||||
while (numRects--) {
|
|
||||||
pPt->x = pBox->x1 + xorg;
|
|
||||||
pPt->y = pBox->y1 + yorg;
|
|
||||||
pPt++;
|
|
||||||
pBox++;
|
|
||||||
}
|
|
||||||
|
|
||||||
ilbmDoBitblt((DrawablePtr)pPixmap->drawable.pScreen->devPrivates[ilbmScreenPrivateIndex].ptr,
|
|
||||||
(DrawablePtr)pPixmap,
|
|
||||||
GXcopy,
|
|
||||||
prgnSave,
|
|
||||||
pPtsInit, wBackingBitPlanes (pWin));
|
|
||||||
|
|
||||||
DEALLOCATE_LOCAL(pPtsInit);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*-
|
|
||||||
*-----------------------------------------------------------------------
|
|
||||||
* ilbmRestoreAreas --
|
|
||||||
* Function called by miRestoreAreas to actually fetch the areas to be
|
|
||||||
* restored from the backing pixmap. This is very simple to do, since
|
|
||||||
* ilbmDoBitblt is designed for this very thing. The region to restore is
|
|
||||||
* already destination-relative and we're given the offset to the
|
|
||||||
* window origin, so we have only to create an array of points of the
|
|
||||||
* u.l. corners of the boxes in the region translated to the pixmap
|
|
||||||
* coordinate system and fetch the screen pixmap out of its devPrivate
|
|
||||||
* field....
|
|
||||||
*
|
|
||||||
* Results:
|
|
||||||
* None.
|
|
||||||
*
|
|
||||||
* Side Effects:
|
|
||||||
* Data are copied from the pixmap into the screen.
|
|
||||||
*
|
|
||||||
*-----------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
ilbmRestoreAreas(pPixmap, prgnRestore, xorg, yorg, pWin)
|
|
||||||
PixmapPtr pPixmap; /* Backing pixmap */
|
|
||||||
RegionPtr prgnRestore; /* Region to restore (screen-relative)*/
|
|
||||||
int xorg; /* X origin of window */
|
|
||||||
int yorg; /* Y origin of window */
|
|
||||||
WindowPtr pWin;
|
|
||||||
{
|
|
||||||
register DDXPointPtr pPt;
|
|
||||||
DDXPointPtr pPtsInit;
|
|
||||||
register BoxPtr pBox;
|
|
||||||
register int numRects;
|
|
||||||
|
|
||||||
numRects = REGION_NUM_RECTS(prgnRestore);
|
|
||||||
pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(numRects*sizeof(DDXPointRec));
|
|
||||||
if (!pPtsInit)
|
|
||||||
return;
|
|
||||||
|
|
||||||
pBox = REGION_RECTS(prgnRestore);
|
|
||||||
pPt = pPtsInit;
|
|
||||||
while (numRects--) {
|
|
||||||
pPt->x = pBox->x1 - xorg;
|
|
||||||
pPt->y = pBox->y1 - yorg;
|
|
||||||
pPt++;
|
|
||||||
pBox++;
|
|
||||||
}
|
|
||||||
|
|
||||||
ilbmDoBitblt((DrawablePtr)pPixmap,
|
|
||||||
(DrawablePtr)pPixmap->drawable.pScreen->devPrivates[ilbmScreenPrivateIndex].ptr,
|
|
||||||
GXcopy,
|
|
||||||
prgnRestore,
|
|
||||||
pPtsInit, wBackingBitPlanes (pWin));
|
|
||||||
|
|
||||||
DEALLOCATE_LOCAL(pPtsInit);
|
|
||||||
}
|
|
||||||
246
ilbm/ilbmclip.c
246
ilbm/ilbmclip.c
@@ -1,246 +0,0 @@
|
|||||||
/* $XFree86$ */
|
|
||||||
/***********************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
******************************************************************/
|
|
||||||
/* $XConsortium: ilbmclip.c,v 5.6 94/04/17 20:28:19 dpw Exp $ */
|
|
||||||
|
|
||||||
/* Modified jun 95 by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
|
|
||||||
to use interleaved bitplanes instead of normal bitplanes */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include "miscstruct.h"
|
|
||||||
#include "pixmapstr.h"
|
|
||||||
#include "scrnintstr.h"
|
|
||||||
#include "regionstr.h"
|
|
||||||
#include "gc.h"
|
|
||||||
#include "maskbits.h"
|
|
||||||
#include "mi.h"
|
|
||||||
|
|
||||||
#define ADDRECT(reg,r,fr,rx1,ry1,rx2,ry2) \
|
|
||||||
if (((rx1) < (rx2)) && ((ry1) < (ry2)) && \
|
|
||||||
(!((reg)->data->numRects && \
|
|
||||||
((r-1)->y1 == (ry1)) && \
|
|
||||||
((r-1)->y2 == (ry2)) && \
|
|
||||||
((r-1)->x1 <= (rx1)) && \
|
|
||||||
((r-1)->x2 >= (rx2))))) { \
|
|
||||||
if ((reg)->data->numRects == (reg)->data->size) { \
|
|
||||||
miRectAlloc(reg, 1); \
|
|
||||||
fr = REGION_BOXPTR(reg); \
|
|
||||||
r = fr + (reg)->data->numRects; \
|
|
||||||
} \
|
|
||||||
r->x1 = (rx1); \
|
|
||||||
r->y1 = (ry1); \
|
|
||||||
r->x2 = (rx2); \
|
|
||||||
r->y2 = (ry2); \
|
|
||||||
(reg)->data->numRects++; \
|
|
||||||
if (r->x1 < (reg)->extents.x1) \
|
|
||||||
(reg)->extents.x1 = r->x1; \
|
|
||||||
if (r->x2 > (reg)->extents.x2) \
|
|
||||||
(reg)->extents.x2 = r->x2; \
|
|
||||||
r++; \
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Convert bitmap clip mask into clipping region.
|
|
||||||
* First, goes through each line and makes boxes by noting the transitions
|
|
||||||
* from 0 to 1 and 1 to 0.
|
|
||||||
* Then it coalesces the current line with the previous if they have boxes
|
|
||||||
* at the same X coordinates.
|
|
||||||
*/
|
|
||||||
RegionPtr
|
|
||||||
ilbmPixmapToRegion(pPix)
|
|
||||||
PixmapPtr pPix;
|
|
||||||
{
|
|
||||||
register RegionPtr pReg;
|
|
||||||
register PixelType *pw, w;
|
|
||||||
register int ib;
|
|
||||||
int width, h, base, rx1, crects;
|
|
||||||
PixelType *pwLineEnd;
|
|
||||||
int irectPrevStart, irectLineStart;
|
|
||||||
register BoxPtr prectO, prectN;
|
|
||||||
BoxPtr FirstRect, rects, prectLineStart;
|
|
||||||
Bool fInBox, fSame;
|
|
||||||
register PixelType mask0 = mask[0];
|
|
||||||
PixelType *pwLine;
|
|
||||||
int nWidth;
|
|
||||||
|
|
||||||
pReg = REGION_CREATE(pPix->drawable.pScreen, NULL, 1);
|
|
||||||
if (!pReg)
|
|
||||||
return(NullRegion);
|
|
||||||
FirstRect = REGION_BOXPTR(pReg);
|
|
||||||
rects = FirstRect;
|
|
||||||
|
|
||||||
pwLine = (PixelType *)pPix->devPrivate.ptr;
|
|
||||||
nWidth = pPix->devKind/PGSZB;
|
|
||||||
|
|
||||||
width = pPix->drawable.width;
|
|
||||||
pReg->extents.x1 = width - 1;
|
|
||||||
pReg->extents.x2 = 0;
|
|
||||||
irectPrevStart = -1;
|
|
||||||
for (h = 0; h < pPix->drawable.height; h++) {
|
|
||||||
pw = pwLine;
|
|
||||||
pwLine += nWidth;
|
|
||||||
irectLineStart = rects - FirstRect;
|
|
||||||
/* If the Screen left most bit of the word is set, we're starting in
|
|
||||||
* a box */
|
|
||||||
if (*pw & mask0) {
|
|
||||||
fInBox = TRUE;
|
|
||||||
rx1 = 0;
|
|
||||||
} else
|
|
||||||
fInBox = FALSE;
|
|
||||||
/* Process all words which are fully in the pixmap */
|
|
||||||
pwLineEnd = pw + (width >> PWSH);
|
|
||||||
for (base = 0; pw < pwLineEnd; base += PPW) {
|
|
||||||
w = *pw++;
|
|
||||||
if (fInBox) {
|
|
||||||
if (!~w)
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
if (!w)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
for (ib = 0; ib < PPW; ib++) {
|
|
||||||
/* If the Screen left most bit of the word is set, we're
|
|
||||||
* starting a box */
|
|
||||||
if (w & mask0) {
|
|
||||||
if (!fInBox) {
|
|
||||||
rx1 = base + ib;
|
|
||||||
/* start new box */
|
|
||||||
fInBox = TRUE;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (fInBox) {
|
|
||||||
/* end box */
|
|
||||||
ADDRECT(pReg, rects, FirstRect, rx1, h, base + ib, h + 1);
|
|
||||||
fInBox = FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* Shift the word VISUALLY left one. */
|
|
||||||
w = SCRLEFT(w, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (width & PIM) {
|
|
||||||
/* Process final partial word on line */
|
|
||||||
w = *pw++;
|
|
||||||
for (ib = 0; ib < (width & PIM); ib++) {
|
|
||||||
/* If the Screen left most bit of the word is set, we're
|
|
||||||
* starting a box */
|
|
||||||
if (w & mask0) {
|
|
||||||
if (!fInBox) {
|
|
||||||
rx1 = base + ib;
|
|
||||||
/* start new box */
|
|
||||||
fInBox = TRUE;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (fInBox) {
|
|
||||||
/* end box */
|
|
||||||
ADDRECT(pReg, rects, FirstRect,
|
|
||||||
rx1, h, base + ib, h + 1);
|
|
||||||
fInBox = FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* Shift the word VISUALLY left one. */
|
|
||||||
w = SCRLEFT(w, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* If scanline ended with last bit set, end the box */
|
|
||||||
if (fInBox) {
|
|
||||||
ADDRECT(pReg, rects, FirstRect,
|
|
||||||
rx1, h, base + (width & PIM), h + 1);
|
|
||||||
}
|
|
||||||
/* if all rectangles on this line have the same x-coords as
|
|
||||||
* those on the previous line, then add 1 to all the previous y2s and
|
|
||||||
* throw away all the rectangles from this line
|
|
||||||
*/
|
|
||||||
fSame = FALSE;
|
|
||||||
if (irectPrevStart != -1) {
|
|
||||||
crects = irectLineStart - irectPrevStart;
|
|
||||||
if (crects == ((rects - FirstRect) - irectLineStart)) {
|
|
||||||
prectO = FirstRect + irectPrevStart;
|
|
||||||
prectN = prectLineStart = FirstRect + irectLineStart;
|
|
||||||
fSame = TRUE;
|
|
||||||
while (prectO < prectLineStart) {
|
|
||||||
if ((prectO->x1 != prectN->x1) || (prectO->x2 != prectN->x2)) {
|
|
||||||
fSame = FALSE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
prectO++;
|
|
||||||
prectN++;
|
|
||||||
}
|
|
||||||
if (fSame) {
|
|
||||||
prectO = FirstRect + irectPrevStart;
|
|
||||||
while (prectO < prectLineStart) {
|
|
||||||
prectO->y2 += 1;
|
|
||||||
prectO++;
|
|
||||||
}
|
|
||||||
rects -= crects;
|
|
||||||
pReg->data->numRects -= crects;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!fSame)
|
|
||||||
irectPrevStart = irectLineStart;
|
|
||||||
}
|
|
||||||
if (!pReg->data->numRects)
|
|
||||||
pReg->extents.x1 = pReg->extents.x2 = 0;
|
|
||||||
else {
|
|
||||||
pReg->extents.y1 = REGION_BOXPTR(pReg)->y1;
|
|
||||||
pReg->extents.y2 = REGION_END(pReg)->y2;
|
|
||||||
if (pReg->data->numRects == 1) {
|
|
||||||
xfree(pReg->data);
|
|
||||||
pReg->data = (RegDataPtr)NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#ifdef DEBUG
|
|
||||||
if (!miValidRegion(pReg))
|
|
||||||
FatalError("Assertion failed file %s, line %d: expr\n", __FILE__, __LINE__);
|
|
||||||
#endif
|
|
||||||
return(pReg);
|
|
||||||
}
|
|
||||||
128
ilbm/ilbmcmap.c
128
ilbm/ilbmcmap.c
@@ -1,128 +0,0 @@
|
|||||||
/* $XFree86: xc/programs/Xserver/ilbm/ilbmcmap.c,v 3.0 1996/08/18 01:53:46 dawes Exp $ */
|
|
||||||
/* $XConsortium: ilbmcmap.c,v 4.19 94/04/17 20:28:46 dpw Exp $ */
|
|
||||||
/************************************************************
|
|
||||||
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 X Consortium
|
|
||||||
not be used in advertising or publicity pertaining to
|
|
||||||
distribution of the software without specific prior
|
|
||||||
written permission. Sun and X Consortium 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.
|
|
||||||
|
|
||||||
********************************************************/
|
|
||||||
|
|
||||||
/* Modified jun 95 by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
|
|
||||||
to use interleaved bitplanes instead of normal bitplanes */
|
|
||||||
|
|
||||||
#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"
|
|
||||||
|
|
||||||
int
|
|
||||||
ilbmListInstalledColormaps(pScreen, pmaps)
|
|
||||||
ScreenPtr pScreen;
|
|
||||||
Colormap *pmaps;
|
|
||||||
{
|
|
||||||
return miListInstalledColormaps(pScreen, pmaps);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
ilbmInstallColormap(pmap)
|
|
||||||
ColormapPtr pmap;
|
|
||||||
{
|
|
||||||
miInstallColormap(pmap);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ilbmUninstallColormap(pmap)
|
|
||||||
ColormapPtr pmap;
|
|
||||||
{
|
|
||||||
miUninstallColormap(pmap);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ilbmResolveColor(pred, pgreen, pblue, pVisual)
|
|
||||||
unsigned short *pred, *pgreen, *pblue;
|
|
||||||
register VisualPtr pVisual;
|
|
||||||
{
|
|
||||||
miResolveColor(pred, pgreen, pblue, pVisual);
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool
|
|
||||||
ilbmInitializeColormap(pmap)
|
|
||||||
register ColormapPtr pmap;
|
|
||||||
{
|
|
||||||
return miInitializeColormap(pmap);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
ilbmExpandDirectColors(pmap, ndef, indefs, outdefs)
|
|
||||||
ColormapPtr pmap;
|
|
||||||
int ndef;
|
|
||||||
xColorItem *indefs, *outdefs;
|
|
||||||
{
|
|
||||||
return miExpandDirectColors(pmap, ndef, indefs, outdefs);
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool
|
|
||||||
ilbmCreateDefColormap(pScreen)
|
|
||||||
ScreenPtr pScreen;
|
|
||||||
{
|
|
||||||
return miCreateDefColormap(pScreen);
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool
|
|
||||||
ilbmSetVisualTypes(depth, visuals, bitsPerRGB)
|
|
||||||
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 correspond to
|
|
||||||
* the set which can be used with this version of ilbm.
|
|
||||||
*/
|
|
||||||
|
|
||||||
Bool
|
|
||||||
ilbmInitVisuals(visualp, depthp, nvisualp, ndepthp, rootDepthp, defaultVisp,
|
|
||||||
sizes, bitsPerRGB)
|
|
||||||
VisualPtr *visualp;
|
|
||||||
DepthPtr *depthp;
|
|
||||||
int *nvisualp, *ndepthp;
|
|
||||||
int *rootDepthp;
|
|
||||||
VisualID *defaultVisp;
|
|
||||||
unsigned long sizes;
|
|
||||||
int bitsPerRGB;
|
|
||||||
{
|
|
||||||
return miInitVisuals(visualp, depthp, nvisualp, ndepthp, rootDepthp,
|
|
||||||
defaultVisp, sizes, bitsPerRGB, -1);
|
|
||||||
}
|
|
||||||
@@ -1,377 +0,0 @@
|
|||||||
/* $XFree86: xc/programs/Xserver/ilbm/ilbmfillarc.c,v 3.0 1996/08/18 01:53:48 dawes Exp $ */
|
|
||||||
/************************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1989 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
********************************************************/
|
|
||||||
|
|
||||||
/* $XConsortium: ilbmfillarc.c,v 5.14 94/04/17 20:28:20 dpw Exp $ */
|
|
||||||
|
|
||||||
/* Modified jun 95 by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
|
|
||||||
to use interleaved bitplanes instead of normal bitplanes */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include <X11/Xprotostr.h>
|
|
||||||
#include "miscstruct.h"
|
|
||||||
#include "gcstruct.h"
|
|
||||||
#include "pixmapstr.h"
|
|
||||||
#include "scrnintstr.h"
|
|
||||||
#include "ilbm.h"
|
|
||||||
#include "maskbits.h"
|
|
||||||
#include "mifillarc.h"
|
|
||||||
#include "mi.h"
|
|
||||||
|
|
||||||
static void
|
|
||||||
ilbmFillEllipseSolid(pDraw, arc, rrops)
|
|
||||||
DrawablePtr pDraw;
|
|
||||||
xArc *arc;
|
|
||||||
register unsigned char *rrops;
|
|
||||||
{
|
|
||||||
int x, y, e;
|
|
||||||
int yk, xk, ym, xm, dx, dy, xorg, yorg;
|
|
||||||
register int slw;
|
|
||||||
miFillArcRec info;
|
|
||||||
PixelType *addrlt, *addrlb;
|
|
||||||
register PixelType *pdst;
|
|
||||||
PixelType *addrl;
|
|
||||||
register int n;
|
|
||||||
register int d;
|
|
||||||
int nlwidth;
|
|
||||||
register int xpos;
|
|
||||||
PixelType startmask, endmask;
|
|
||||||
int nlmiddle;
|
|
||||||
int depthDst;
|
|
||||||
int auxDst;
|
|
||||||
|
|
||||||
ilbmGetPixelWidthAuxDepthAndPointer(pDraw, nlwidth, auxDst, depthDst,
|
|
||||||
addrlt);
|
|
||||||
miFillArcSetup(arc, &info);
|
|
||||||
MIFILLARCSETUP();
|
|
||||||
xorg += pDraw->x;
|
|
||||||
yorg += pDraw->y;
|
|
||||||
addrlb = addrlt;
|
|
||||||
addrlt += auxDst * (yorg - y);
|
|
||||||
addrlb += auxDst * (yorg + y + dy);
|
|
||||||
while (y) {
|
|
||||||
addrlt += auxDst;
|
|
||||||
addrlb -= auxDst;
|
|
||||||
MIFILLARCSTEP(slw);
|
|
||||||
if (!slw)
|
|
||||||
continue;
|
|
||||||
xpos = xorg - x;
|
|
||||||
pdst = addrl = ilbmScanlineOffset(addrlt, (xpos >> PWSH));
|
|
||||||
if (((xpos & PIM) + slw) < PPW) {
|
|
||||||
maskpartialbits(xpos, slw, startmask);
|
|
||||||
for (d = 0; d < depthDst; d++, pdst += nlwidth) { /* @@@ NEXT PLANE @@@ */
|
|
||||||
switch (rrops[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
*pdst &= ~startmask;
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
*pdst |= startmask;
|
|
||||||
break;
|
|
||||||
case RROP_INVERT:
|
|
||||||
*pdst ^= startmask;
|
|
||||||
break;
|
|
||||||
case RROP_NOP:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (miFillArcLower(slw)) {
|
|
||||||
pdst = ilbmScanlineOffset(addrlb, (xpos >> PWSH));
|
|
||||||
|
|
||||||
for (d = 0; d < depthDst; d++, pdst += nlwidth) { /* @@@ NEXT PLANE @@@ */
|
|
||||||
switch (rrops[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
*pdst &= ~startmask;
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
*pdst |= startmask;
|
|
||||||
break;
|
|
||||||
case RROP_INVERT:
|
|
||||||
*pdst ^= startmask;
|
|
||||||
break;
|
|
||||||
case RROP_NOP:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
maskbits(xpos, slw, startmask, endmask, nlmiddle);
|
|
||||||
for (d = 0; d < depthDst; d++, addrl += nlwidth) { /* @@@ NEXT PLANE @@@ */
|
|
||||||
n = nlmiddle;
|
|
||||||
pdst = addrl;
|
|
||||||
|
|
||||||
switch (rrops[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
if (startmask)
|
|
||||||
*pdst++ &= ~startmask;
|
|
||||||
while (n--)
|
|
||||||
*pdst++ = 0;
|
|
||||||
if (endmask)
|
|
||||||
*pdst &= ~endmask;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RROP_WHITE:
|
|
||||||
if (startmask)
|
|
||||||
*pdst++ |= startmask;
|
|
||||||
while (n--)
|
|
||||||
*pdst++ = ~0;
|
|
||||||
if (endmask)
|
|
||||||
*pdst |= endmask;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RROP_INVERT:
|
|
||||||
if (startmask)
|
|
||||||
*pdst++ ^= startmask;
|
|
||||||
while (n--)
|
|
||||||
*pdst++ ^= ~0;
|
|
||||||
if (endmask)
|
|
||||||
*pdst ^= endmask;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RROP_NOP:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!miFillArcLower(slw))
|
|
||||||
continue;
|
|
||||||
addrl = ilbmScanlineOffset(addrlb, (xpos >> PWSH));
|
|
||||||
for (d = 0; d < depthDst; d++, addrl += nlwidth) { /* @@@ NEXT PLANE @@@ */
|
|
||||||
n = nlmiddle;
|
|
||||||
pdst = addrl;
|
|
||||||
|
|
||||||
switch (rrops[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
if (startmask)
|
|
||||||
*pdst++ &= ~startmask;
|
|
||||||
while (n--)
|
|
||||||
*pdst++ = 0;
|
|
||||||
if (endmask)
|
|
||||||
*pdst &= ~endmask;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RROP_WHITE:
|
|
||||||
if (startmask)
|
|
||||||
*pdst++ |= startmask;
|
|
||||||
while (n--)
|
|
||||||
*pdst++ = ~0;
|
|
||||||
if (endmask)
|
|
||||||
*pdst |= endmask;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RROP_INVERT:
|
|
||||||
if (startmask)
|
|
||||||
*pdst++ ^= startmask;
|
|
||||||
while (n--)
|
|
||||||
*pdst++ ^= ~0;
|
|
||||||
if (endmask)
|
|
||||||
*pdst ^= endmask;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RROP_NOP:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#define FILLSPAN(xl,xr,addr) \
|
|
||||||
if (xr >= xl) { \
|
|
||||||
width = xr - xl + 1; \
|
|
||||||
addrl = ilbmScanlineOffset(addr, (xl >> PWSH)); \
|
|
||||||
if (((xl & PIM) + width) < PPW) { \
|
|
||||||
maskpartialbits(xl, width, startmask); \
|
|
||||||
for (pdst = addrl, d = 0; d < depthDst; d++, pdst += nlwidth) { /* @@@ NEXT PLANE @@@ */ \
|
|
||||||
switch (rrops[d]) { \
|
|
||||||
case RROP_BLACK: \
|
|
||||||
*pdst &= ~startmask; \
|
|
||||||
break; \
|
|
||||||
case RROP_WHITE: \
|
|
||||||
*pdst |= startmask; \
|
|
||||||
break; \
|
|
||||||
case RROP_INVERT: \
|
|
||||||
*pdst ^= startmask; \
|
|
||||||
break; \
|
|
||||||
case RROP_NOP: \
|
|
||||||
break; \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
} else { \
|
|
||||||
maskbits(xl, width, startmask, endmask, nlmiddle); \
|
|
||||||
for (d = 0; d < depthDst; d++, addrl += nlwidth) { /* @@@ NEXT PLANE @@@ */ \
|
|
||||||
n = nlmiddle; \
|
|
||||||
pdst = addrl; \
|
|
||||||
switch (rrops[d]) { \
|
|
||||||
case RROP_BLACK: \
|
|
||||||
if (startmask) \
|
|
||||||
*pdst++ &= ~startmask; \
|
|
||||||
while (n--) \
|
|
||||||
*pdst++ = 0; \
|
|
||||||
if (endmask) \
|
|
||||||
*pdst &= ~endmask; \
|
|
||||||
break; \
|
|
||||||
case RROP_WHITE: \
|
|
||||||
if (startmask) \
|
|
||||||
*pdst++ |= startmask; \
|
|
||||||
while (n--) \
|
|
||||||
*pdst++ = ~0; \
|
|
||||||
if (endmask) \
|
|
||||||
*pdst |= endmask; \
|
|
||||||
break; \
|
|
||||||
case RROP_INVERT: \
|
|
||||||
if (startmask) \
|
|
||||||
*pdst++ ^= startmask; \
|
|
||||||
while (n--) \
|
|
||||||
*pdst++ ^= ~0; \
|
|
||||||
if (endmask) \
|
|
||||||
*pdst ^= endmask; \
|
|
||||||
break; \
|
|
||||||
case RROP_NOP: \
|
|
||||||
break; \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
#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
|
|
||||||
ilbmFillArcSliceSolidCopy(pDraw, pGC, arc, rrops)
|
|
||||||
DrawablePtr pDraw;
|
|
||||||
GCPtr pGC;
|
|
||||||
xArc *arc;
|
|
||||||
register unsigned char *rrops;
|
|
||||||
{
|
|
||||||
PixelType *addrl;
|
|
||||||
register PixelType *pdst;
|
|
||||||
register int n;
|
|
||||||
register int d;
|
|
||||||
int yk, xk, ym, xm, dx, dy, xorg, yorg, slw;
|
|
||||||
register int x, y, e;
|
|
||||||
miFillArcRec info;
|
|
||||||
miArcSliceRec slice;
|
|
||||||
int xl, xr, xc;
|
|
||||||
PixelType *addrlt, *addrlb;
|
|
||||||
int nlwidth;
|
|
||||||
int width;
|
|
||||||
PixelType startmask, endmask;
|
|
||||||
int nlmiddle;
|
|
||||||
int auxDst;
|
|
||||||
int depthDst;
|
|
||||||
|
|
||||||
ilbmGetPixelWidthAuxDepthAndPointer(pDraw, nlwidth, auxDst, depthDst,
|
|
||||||
addrlt);
|
|
||||||
miFillArcSetup(arc, &info);
|
|
||||||
miFillArcSliceSetup(arc, &slice, pGC);
|
|
||||||
MIFILLARCSETUP();
|
|
||||||
xorg += pDraw->x;
|
|
||||||
yorg += pDraw->y;
|
|
||||||
addrlb = addrlt;
|
|
||||||
addrlt = ilbmScanlineDeltaNoBankSwitch(addrlt, yorg - y, auxDst);
|
|
||||||
addrlb = ilbmScanlineDeltaNoBankSwitch(addrlb, yorg + y + dy, auxDst);
|
|
||||||
slice.edge1.x += pDraw->x;
|
|
||||||
slice.edge2.x += pDraw->x;
|
|
||||||
while (y > 0) {
|
|
||||||
ilbmScanlineIncNoBankSwitch(addrlt, auxDst);
|
|
||||||
ilbmScanlineIncNoBankSwitch(addrlb, -auxDst);
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ilbmPolyFillArcSolid(pDraw, pGC, narcs, parcs)
|
|
||||||
register DrawablePtr pDraw;
|
|
||||||
GCPtr pGC;
|
|
||||||
int narcs;
|
|
||||||
xArc *parcs;
|
|
||||||
{
|
|
||||||
ilbmPrivGC *priv;
|
|
||||||
register xArc *arc;
|
|
||||||
register int i;
|
|
||||||
int x2, y2;
|
|
||||||
BoxRec box;
|
|
||||||
RegionPtr cclip;
|
|
||||||
unsigned char *rrops;
|
|
||||||
|
|
||||||
priv = (ilbmPrivGC *) pGC->devPrivates[ilbmGCPrivateIndex].ptr;
|
|
||||||
rrops = priv->rrops;
|
|
||||||
cclip = pGC->pCompositeClip;
|
|
||||||
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 <= MAXSHORT) && (y2 <= MAXSHORT) &&
|
|
||||||
(RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN) ) {
|
|
||||||
if ((arc->angle2 >= FULLCIRCLE) ||
|
|
||||||
(arc->angle2 <= -FULLCIRCLE))
|
|
||||||
ilbmFillEllipseSolid(pDraw, arc, rrops);
|
|
||||||
else
|
|
||||||
ilbmFillArcSliceSolidCopy(pDraw, pGC, arc, rrops);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
miPolyFillArc(pDraw, pGC, 1, arc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,299 +0,0 @@
|
|||||||
/* $XFree86: xc/programs/Xserver/ilbm/ilbmfillrct.c,v 3.0 1996/08/18 01:53:49 dawes Exp $ */
|
|
||||||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
|
||||||
/***********************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
******************************************************************/
|
|
||||||
/* $XConsortium: ilbmfillrct.c,v 5.10 94/04/17 20:28:21 dpw Exp $ */
|
|
||||||
|
|
||||||
/* Modified jun 95 by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
|
|
||||||
to use interleaved bitplanes instead of normal bitplanes */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include <X11/Xprotostr.h>
|
|
||||||
#include "pixmapstr.h"
|
|
||||||
#include "gcstruct.h"
|
|
||||||
#include "windowstr.h"
|
|
||||||
#include "miscstruct.h"
|
|
||||||
#include "regionstr.h"
|
|
||||||
#include "scrnintstr.h"
|
|
||||||
|
|
||||||
#include "ilbm.h"
|
|
||||||
#include "maskbits.h"
|
|
||||||
|
|
||||||
#define MODEQ(a, b) ((a) %= (b))
|
|
||||||
void ilbmPaintOddSize();
|
|
||||||
|
|
||||||
/*
|
|
||||||
filled rectangles.
|
|
||||||
translate the rectangles, clip them, and call the
|
|
||||||
helper function in the GC.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define NUM_STACK_RECTS 1024
|
|
||||||
|
|
||||||
void
|
|
||||||
ilbmPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
|
|
||||||
DrawablePtr pDrawable;
|
|
||||||
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];
|
|
||||||
int numRects;
|
|
||||||
int n;
|
|
||||||
int xorg, yorg;
|
|
||||||
ilbmPrivGC *priv;
|
|
||||||
PixmapPtr ppix;
|
|
||||||
unsigned char *rrops;
|
|
||||||
unsigned char *rropsOS;
|
|
||||||
|
|
||||||
priv = (ilbmPrivGC *)pGC->devPrivates[ilbmGCPrivateIndex].ptr;
|
|
||||||
ppix = pGC->pRotatedPixmap;
|
|
||||||
prgnClip = pGC->pCompositeClip;
|
|
||||||
rrops = priv->rrops;
|
|
||||||
rropsOS = priv->rropOS;
|
|
||||||
|
|
||||||
prect = prectInit;
|
|
||||||
xorg = pDrawable->x;
|
|
||||||
yorg = pDrawable->y;
|
|
||||||
if (xorg || yorg) {
|
|
||||||
prect = prectInit;
|
|
||||||
n = nrectFill;
|
|
||||||
Duff(n, prect->x += xorg; prect->y += yorg; prect++);
|
|
||||||
}
|
|
||||||
|
|
||||||
prect = prectInit;
|
|
||||||
|
|
||||||
numRects = REGION_NUM_RECTS(prgnClip) * nrectFill;
|
|
||||||
if (numRects > NUM_STACK_RECTS) {
|
|
||||||
pboxClippedBase = (BoxPtr)ALLOCATE_LOCAL(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) {
|
|
||||||
switch (pGC->fillStyle) {
|
|
||||||
case FillSolid:
|
|
||||||
ilbmSolidFillArea(pDrawable, pboxClipped-pboxClippedBase,
|
|
||||||
pboxClippedBase, rrops);
|
|
||||||
break;
|
|
||||||
case FillTiled:
|
|
||||||
switch (pGC->alu) {
|
|
||||||
case GXcopy:
|
|
||||||
if (pGC->pRotatedPixmap)
|
|
||||||
ilbmTileAreaPPWCopy(pDrawable, pboxClipped-pboxClippedBase,
|
|
||||||
pboxClippedBase, GXcopy,
|
|
||||||
pGC->pRotatedPixmap, pGC->planemask);
|
|
||||||
else
|
|
||||||
ilbmTileAreaCopy(pDrawable, pboxClipped-pboxClippedBase,
|
|
||||||
pboxClippedBase, GXcopy, pGC->tile.pixmap,
|
|
||||||
pGC->patOrg.x, pGC->patOrg.y,
|
|
||||||
pGC->planemask);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
if (pGC->pRotatedPixmap)
|
|
||||||
ilbmTileAreaPPWGeneral(pDrawable, pboxClipped-pboxClippedBase,
|
|
||||||
pboxClippedBase, pGC->alu,
|
|
||||||
pGC->pRotatedPixmap,
|
|
||||||
pGC->planemask);
|
|
||||||
else
|
|
||||||
ilbmTileAreaGeneral(pDrawable, pboxClipped-pboxClippedBase,
|
|
||||||
pboxClippedBase, pGC->alu,
|
|
||||||
pGC->tile.pixmap, pGC->patOrg.x,
|
|
||||||
pGC->patOrg.y, pGC->planemask);
|
|
||||||
break;
|
|
||||||
} /* switch (alu) */
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FillStippled:
|
|
||||||
if (pGC->pRotatedPixmap)
|
|
||||||
ilbmStippleAreaPPW(pDrawable, pboxClipped-pboxClippedBase,
|
|
||||||
pboxClippedBase, pGC->pRotatedPixmap, rrops);
|
|
||||||
else
|
|
||||||
ilbmStippleArea(pDrawable, pboxClipped-pboxClippedBase,
|
|
||||||
pboxClippedBase, pGC->stipple, pGC->patOrg.x,
|
|
||||||
pGC->patOrg.y, rrops);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FillOpaqueStippled:
|
|
||||||
switch (pGC->alu) {
|
|
||||||
case GXcopy:
|
|
||||||
if (pGC->pRotatedPixmap)
|
|
||||||
ilbmOpaqueStippleAreaPPWCopy(pDrawable,
|
|
||||||
pboxClipped-pboxClippedBase,
|
|
||||||
pboxClippedBase, GXcopy,
|
|
||||||
pGC->pRotatedPixmap, rropsOS,
|
|
||||||
pGC->planemask);
|
|
||||||
else
|
|
||||||
ilbmOpaqueStippleAreaCopy(pDrawable,
|
|
||||||
pboxClipped-pboxClippedBase,
|
|
||||||
pboxClippedBase, GXcopy,
|
|
||||||
pGC->stipple, pGC->patOrg.x,
|
|
||||||
pGC->patOrg.y, rropsOS,
|
|
||||||
pGC->planemask);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
if (pGC->pRotatedPixmap)
|
|
||||||
ilbmOpaqueStippleAreaPPWGeneral(pDrawable,
|
|
||||||
pboxClipped-pboxClippedBase,
|
|
||||||
pboxClippedBase, pGC->alu,
|
|
||||||
pGC->pRotatedPixmap,
|
|
||||||
rropsOS, pGC->planemask);
|
|
||||||
else
|
|
||||||
ilbmOpaqueStippleAreaGeneral(pDrawable,
|
|
||||||
pboxClipped-pboxClippedBase,
|
|
||||||
pboxClippedBase, pGC->alu,
|
|
||||||
pGC->stipple, pGC->patOrg.x,
|
|
||||||
pGC->patOrg.y, rropsOS,
|
|
||||||
pGC->planemask);
|
|
||||||
break;
|
|
||||||
} /* switch (alu) */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (pboxClippedBase != stackRects)
|
|
||||||
DEALLOCATE_LOCAL(pboxClippedBase);
|
|
||||||
}
|
|
||||||
1149
ilbm/ilbmfillsp.c
1149
ilbm/ilbmfillsp.c
File diff suppressed because it is too large
Load Diff
@@ -1,82 +0,0 @@
|
|||||||
/* $XFree86$ */
|
|
||||||
/*
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
*/
|
|
||||||
/* $XConsortium: ilbmfont.c,v 1.18 94/04/17 20:28:22 keith Exp $ */
|
|
||||||
|
|
||||||
/* Modified jun 95 by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
|
|
||||||
to use interleaved bitplanes instead of normal bitplanes */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include <X11/Xmd.h>
|
|
||||||
#include <X11/Xproto.h>
|
|
||||||
#include "ilbm.h"
|
|
||||||
#include <X11/fonts/fontstruct.h>
|
|
||||||
#include "dixfontstr.h"
|
|
||||||
#include "scrnintstr.h"
|
|
||||||
|
|
||||||
/*ARGSUSED*/
|
|
||||||
Bool
|
|
||||||
ilbmRealizeFont( pscr, pFont)
|
|
||||||
ScreenPtr pscr;
|
|
||||||
FontPtr pFont;
|
|
||||||
{
|
|
||||||
return (TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*ARGSUSED*/
|
|
||||||
Bool
|
|
||||||
ilbmUnrealizeFont( pscr, pFont)
|
|
||||||
ScreenPtr pscr;
|
|
||||||
FontPtr pFont;
|
|
||||||
{
|
|
||||||
return (TRUE);
|
|
||||||
}
|
|
||||||
715
ilbm/ilbmgc.c
715
ilbm/ilbmgc.c
@@ -1,715 +0,0 @@
|
|||||||
/* $XFree86: xc/programs/Xserver/ilbm/ilbmgc.c,v 3.0 1996/08/18 01:53:52 dawes Exp $ */
|
|
||||||
/***********************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
******************************************************************/
|
|
||||||
/* $XConsortium: ilbmgc.c,v 5.35 94/04/17 20:28:23 dpw Exp $ */
|
|
||||||
|
|
||||||
/* Modified jun 95 by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
|
|
||||||
to use interleaved bitplanes instead of normal bitplanes */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include <X11/Xmd.h>
|
|
||||||
#include <X11/Xproto.h>
|
|
||||||
#include "ilbm.h"
|
|
||||||
#include "dixfontstr.h"
|
|
||||||
#include <X11/fonts/fontstruct.h>
|
|
||||||
#include "gcstruct.h"
|
|
||||||
#include "windowstr.h"
|
|
||||||
#include "pixmapstr.h"
|
|
||||||
#include "scrnintstr.h"
|
|
||||||
#include "region.h"
|
|
||||||
|
|
||||||
#include "mistruct.h"
|
|
||||||
#include "migc.h"
|
|
||||||
|
|
||||||
#include "maskbits.h"
|
|
||||||
|
|
||||||
static GCFuncs ilbmFuncs = {
|
|
||||||
ilbmValidateGC,
|
|
||||||
miChangeGC,
|
|
||||||
miCopyGC,
|
|
||||||
ilbmDestroyGC,
|
|
||||||
miChangeClip,
|
|
||||||
miDestroyClip,
|
|
||||||
miCopyClip
|
|
||||||
};
|
|
||||||
|
|
||||||
static GCOps ilbmGCOps = {
|
|
||||||
ilbmSolidFS,
|
|
||||||
ilbmSetSpans,
|
|
||||||
ilbmPutImage,
|
|
||||||
ilbmCopyArea,
|
|
||||||
miCopyPlane,
|
|
||||||
ilbmPolyPoint,
|
|
||||||
ilbmLineSS,
|
|
||||||
ilbmSegmentSS,
|
|
||||||
miPolyRectangle,
|
|
||||||
ilbmZeroPolyArcSS,
|
|
||||||
ilbmFillPolygonSolid,
|
|
||||||
ilbmPolyFillRect,
|
|
||||||
ilbmPolyFillArcSolid,
|
|
||||||
miPolyText8,
|
|
||||||
miPolyText16,
|
|
||||||
miImageText8,
|
|
||||||
miImageText16,
|
|
||||||
ilbmTEGlyphBlt,
|
|
||||||
ilbmPolyGlyphBlt,
|
|
||||||
ilbmPushPixels
|
|
||||||
#ifdef NEED_LINEHELPER
|
|
||||||
,NULL
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
Bool
|
|
||||||
ilbmCreateGC(pGC)
|
|
||||||
register GCPtr pGC;
|
|
||||||
{
|
|
||||||
ilbmPrivGC *pPriv;
|
|
||||||
|
|
||||||
pGC->clientClip = NULL;
|
|
||||||
pGC->clientClipType = CT_NONE;
|
|
||||||
|
|
||||||
/* 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 monochrome frame buffer, they don't change
|
|
||||||
*/
|
|
||||||
|
|
||||||
pGC->ops = &ilbmGCOps;
|
|
||||||
pGC->funcs = &ilbmFuncs;
|
|
||||||
|
|
||||||
/* ilbm wants to translate before scan convesion */
|
|
||||||
pGC->miTranslate = 1;
|
|
||||||
|
|
||||||
pPriv = (ilbmPrivGC *)(pGC->devPrivates[ilbmGCPrivateIndex].ptr);
|
|
||||||
ilbmReduceRop(pGC->alu, pGC->fgPixel, pGC->planemask, pGC->depth,
|
|
||||||
pPriv->rrops);
|
|
||||||
ilbmReduceOpaqueStipple(pGC->fgPixel, pGC->bgPixel, pGC->planemask,
|
|
||||||
pGC->depth, pPriv->rropOS);
|
|
||||||
|
|
||||||
pGC->fExpose = TRUE;
|
|
||||||
pGC->pRotatedPixmap = NullPixmap;
|
|
||||||
pGC->freeCompClip = FALSE;
|
|
||||||
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
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*ARGSUSED*/
|
|
||||||
void
|
|
||||||
ilbmValidateGC(pGC, changes, pDrawable)
|
|
||||||
register GCPtr pGC;
|
|
||||||
unsigned long changes;
|
|
||||||
DrawablePtr pDrawable;
|
|
||||||
{
|
|
||||||
register ilbmPrivGCPtr devPriv;
|
|
||||||
int mask; /* stateChanges */
|
|
||||||
int index; /* used for stepping through bitfields */
|
|
||||||
int xrot, yrot; /* rotations for tile and stipple pattern */
|
|
||||||
int rrop; /* reduced rasterop */
|
|
||||||
/* flags for changing the proc vector
|
|
||||||
and updating things in devPriv
|
|
||||||
*/
|
|
||||||
int new_rotate, new_rrop, new_line, new_text, new_fill;
|
|
||||||
DDXPointRec oldOrg; /* origin of thing GC was last used with */
|
|
||||||
|
|
||||||
oldOrg = pGC->lastWinOrg;
|
|
||||||
|
|
||||||
pGC->lastWinOrg.x = pDrawable->x;
|
|
||||||
pGC->lastWinOrg.y = pDrawable->y;
|
|
||||||
|
|
||||||
/* we need to re-rotate the tile if the previous window/pixmap
|
|
||||||
origin (oldOrg) differs from the new window/pixmap origin
|
|
||||||
(pGC->lastWinOrg)
|
|
||||||
*/
|
|
||||||
new_rotate = (oldOrg.x != pGC->lastWinOrg.x) ||
|
|
||||||
(oldOrg.y != pGC->lastWinOrg.y);
|
|
||||||
|
|
||||||
|
|
||||||
devPriv = ((ilbmPrivGCPtr)(pGC->devPrivates[ilbmGCPrivateIndex].ptr));
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
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)))
|
|
||||||
ilbmComputeCompositeClip(pGC, pDrawable);
|
|
||||||
|
|
||||||
new_rrop = FALSE;
|
|
||||||
new_line = FALSE;
|
|
||||||
new_text = FALSE;
|
|
||||||
new_fill = FALSE;
|
|
||||||
|
|
||||||
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 GCPlaneMask:
|
|
||||||
case GCFunction:
|
|
||||||
case GCForeground:
|
|
||||||
new_rrop = TRUE;
|
|
||||||
break;
|
|
||||||
case GCBackground:
|
|
||||||
new_rrop = TRUE; /* for opaque stipples */
|
|
||||||
break;
|
|
||||||
case GCLineStyle:
|
|
||||||
case GCLineWidth:
|
|
||||||
case GCJoinStyle:
|
|
||||||
new_line = TRUE;
|
|
||||||
break;
|
|
||||||
case GCCapStyle:
|
|
||||||
break;
|
|
||||||
case GCFillStyle:
|
|
||||||
new_fill = TRUE;
|
|
||||||
break;
|
|
||||||
case GCFillRule:
|
|
||||||
break;
|
|
||||||
case GCTile:
|
|
||||||
if (pGC->tileIsPixel)
|
|
||||||
break;
|
|
||||||
new_rotate = TRUE;
|
|
||||||
new_fill = TRUE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GCStipple:
|
|
||||||
if (pGC->stipple == (PixmapPtr)NULL)
|
|
||||||
break;
|
|
||||||
new_rotate = TRUE;
|
|
||||||
new_fill = 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* deal with the changes we've collected .
|
|
||||||
new_rrop must be done first because subsequent things
|
|
||||||
depend on it.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (new_rotate || new_fill) {
|
|
||||||
Bool new_pix = FALSE;
|
|
||||||
|
|
||||||
/* figure out how much to rotate */
|
|
||||||
xrot = pGC->patOrg.x;
|
|
||||||
yrot = pGC->patOrg.y;
|
|
||||||
xrot += pDrawable->x;
|
|
||||||
yrot += pDrawable->y;
|
|
||||||
|
|
||||||
switch (pGC->fillStyle) {
|
|
||||||
case FillTiled:
|
|
||||||
/* copy current tile and stipple */
|
|
||||||
if (!pGC->tileIsPixel &&
|
|
||||||
(pGC->tile.pixmap->drawable.width <= PPW) &&
|
|
||||||
!(pGC->tile.pixmap->drawable.width &
|
|
||||||
(pGC->tile.pixmap->drawable.width - 1))) {
|
|
||||||
ilbmCopyRotatePixmap(pGC->tile.pixmap, &pGC->pRotatedPixmap,
|
|
||||||
xrot, yrot);
|
|
||||||
new_pix = TRUE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case FillStippled:
|
|
||||||
case FillOpaqueStippled:
|
|
||||||
if (pGC->stipple && (pGC->stipple->drawable.width <= PPW) &&
|
|
||||||
!(pGC->stipple->drawable.width &
|
|
||||||
(pGC->stipple->drawable.width - 1))) {
|
|
||||||
ilbmCopyRotatePixmap(pGC->stipple, &pGC->pRotatedPixmap,
|
|
||||||
xrot, yrot);
|
|
||||||
new_pix = TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* destroy any previously rotated tile or stipple */
|
|
||||||
if (!new_pix && pGC->pRotatedPixmap) {
|
|
||||||
(*pDrawable->pScreen->DestroyPixmap)(pGC->pRotatedPixmap);
|
|
||||||
pGC->pRotatedPixmap = (PixmapPtr)NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* duck out here when the GC is unchanged
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!changes)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (new_rrop || new_fill) {
|
|
||||||
ilbmReduceRop(pGC->alu, pGC->fgPixel, pGC->planemask, pDrawable->depth,
|
|
||||||
devPriv->rrops);
|
|
||||||
ilbmReduceOpaqueStipple(pGC->fgPixel, pGC->bgPixel, pGC->planemask,
|
|
||||||
pGC->depth, devPriv->rropOS);
|
|
||||||
new_fill = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (new_line || new_fill || new_text) {
|
|
||||||
if (!pGC->ops->devPrivate.val) {
|
|
||||||
pGC->ops = miCreateGCOps(pGC->ops);
|
|
||||||
pGC->ops->devPrivate.val = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (new_line || new_fill) {
|
|
||||||
if (pGC->lineWidth == 0) {
|
|
||||||
if (pGC->lineStyle == LineSolid && pGC->fillStyle == FillSolid)
|
|
||||||
pGC->ops->PolyArc = ilbmZeroPolyArcSS;
|
|
||||||
else
|
|
||||||
pGC->ops->PolyArc = miZeroPolyArc;
|
|
||||||
} else
|
|
||||||
pGC->ops->PolyArc = miPolyArc;
|
|
||||||
if (pGC->lineStyle == LineSolid) {
|
|
||||||
if (pGC->lineWidth == 0) {
|
|
||||||
if (pGC->fillStyle == FillSolid) {
|
|
||||||
pGC->ops->PolySegment = ilbmSegmentSS;
|
|
||||||
pGC->ops->Polylines = ilbmLineSS;
|
|
||||||
} else {
|
|
||||||
pGC->ops->PolySegment = miPolySegment;
|
|
||||||
pGC->ops->Polylines = miZeroLine;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
pGC->ops->PolySegment = miPolySegment;
|
|
||||||
pGC->ops->Polylines = miWideLine;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (pGC->lineWidth == 0 && pGC->fillStyle == FillSolid) {
|
|
||||||
pGC->ops->PolySegment = ilbmSegmentSD;
|
|
||||||
pGC->ops->Polylines = ilbmLineSD;
|
|
||||||
} else {
|
|
||||||
pGC->ops->PolySegment = miPolySegment;
|
|
||||||
pGC->ops->Polylines = miWideDash;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (new_text || new_fill) {
|
|
||||||
if ((pGC->font) &&
|
|
||||||
(FONTMAXBOUNDS(pGC->font,rightSideBearing) -
|
|
||||||
FONTMINBOUNDS(pGC->font,leftSideBearing) > 32 ||
|
|
||||||
FONTMINBOUNDS(pGC->font,characterWidth) < 0)) {
|
|
||||||
pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
|
|
||||||
pGC->ops->ImageGlyphBlt = miImageGlyphBlt;
|
|
||||||
} else {
|
|
||||||
/* special case ImageGlyphBlt for terminal emulator fonts */
|
|
||||||
if ((pGC->font) &&
|
|
||||||
TERMINALFONT(pGC->font)) {
|
|
||||||
pGC->ops->ImageGlyphBlt = ilbmTEGlyphBlt;
|
|
||||||
} else {
|
|
||||||
pGC->ops->ImageGlyphBlt = ilbmImageGlyphBlt;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* now do PolyGlyphBlt */
|
|
||||||
if (pGC->fillStyle == FillSolid) {
|
|
||||||
pGC->ops->PolyGlyphBlt = ilbmPolyGlyphBlt;
|
|
||||||
} else {
|
|
||||||
pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (new_fill) {
|
|
||||||
/* install a suitable fillspans and pushpixels */
|
|
||||||
pGC->ops->PushPixels = ilbmPushPixels;
|
|
||||||
pGC->ops->FillPolygon = miFillPolygon;
|
|
||||||
pGC->ops->PolyFillArc = miPolyFillArc;
|
|
||||||
|
|
||||||
switch (pGC->fillStyle) {
|
|
||||||
case FillSolid:
|
|
||||||
pGC->ops->FillSpans = ilbmSolidFS;
|
|
||||||
pGC->ops->FillPolygon = ilbmFillPolygonSolid;
|
|
||||||
pGC->ops->PolyFillArc = ilbmPolyFillArcSolid;
|
|
||||||
break;
|
|
||||||
case FillTiled:
|
|
||||||
if (pGC->pRotatedPixmap)
|
|
||||||
pGC->ops->FillSpans = ilbmTileFS;
|
|
||||||
else
|
|
||||||
pGC->ops->FillSpans = ilbmUnnaturalTileFS;
|
|
||||||
break;
|
|
||||||
case FillOpaqueStippled:
|
|
||||||
if (pGC->pRotatedPixmap)
|
|
||||||
pGC->ops->FillSpans = ilbmOpaqueStippleFS;
|
|
||||||
else
|
|
||||||
pGC->ops->FillSpans = ilbmUnnaturalOpaqueStippleFS;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FillStippled:
|
|
||||||
if (pGC->pRotatedPixmap)
|
|
||||||
pGC->ops->FillSpans = ilbmStippleFS;
|
|
||||||
else
|
|
||||||
pGC->ops->FillSpans = ilbmUnnaturalStippleFS;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} /* end of new_fill */
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ilbmDestroyGC(pGC)
|
|
||||||
GCPtr pGC;
|
|
||||||
{
|
|
||||||
if (pGC->pRotatedPixmap)
|
|
||||||
(*pGC->pScreen->DestroyPixmap)(pGC->pRotatedPixmap);
|
|
||||||
if (pGC->freeCompClip)
|
|
||||||
REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip);
|
|
||||||
miDestroyGCOps(pGC->ops);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* table to map alu(src, dst) to alu(~src, dst) */
|
|
||||||
int ilbmInverseAlu[16] = {
|
|
||||||
GXclear,
|
|
||||||
GXandInverted,
|
|
||||||
GXnor,
|
|
||||||
GXcopyInverted,
|
|
||||||
GXand,
|
|
||||||
GXnoop,
|
|
||||||
GXequiv,
|
|
||||||
GXorInverted,
|
|
||||||
GXandReverse,
|
|
||||||
GXxor,
|
|
||||||
GXinvert,
|
|
||||||
GXnand,
|
|
||||||
GXcopy,
|
|
||||||
GXor,
|
|
||||||
GXorReverse,
|
|
||||||
GXset
|
|
||||||
};
|
|
||||||
|
|
||||||
void
|
|
||||||
ilbmReduceOpaqueStipple(fg, bg, planemask, depth, rop)
|
|
||||||
register PixelType fg;
|
|
||||||
register PixelType bg;
|
|
||||||
register unsigned long planemask;
|
|
||||||
int depth;
|
|
||||||
register unsigned char *rop;
|
|
||||||
{
|
|
||||||
register int d;
|
|
||||||
register Pixel mask = 1;
|
|
||||||
|
|
||||||
bg ^= fg;
|
|
||||||
|
|
||||||
for (d = 0; d < depth; d++, mask <<= 1) {
|
|
||||||
if (!(planemask & mask))
|
|
||||||
rop[d] = RROP_NOP;
|
|
||||||
else if (!(bg & mask)) {
|
|
||||||
/* Both fg and bg have a 0 or 1 in this plane */
|
|
||||||
if (fg & mask)
|
|
||||||
rop[d] = RROP_WHITE;
|
|
||||||
else
|
|
||||||
rop[d] = RROP_BLACK;
|
|
||||||
} else {
|
|
||||||
/* Both fg and bg have different bits on this plane */
|
|
||||||
if (fg & mask)
|
|
||||||
rop[d] = RROP_COPY;
|
|
||||||
else
|
|
||||||
rop[d] = RROP_INVERT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ilbmReduceRop(alu, src, planemask, depth, rop)
|
|
||||||
register int alu;
|
|
||||||
register Pixel src;
|
|
||||||
register unsigned long planemask;
|
|
||||||
int depth;
|
|
||||||
register unsigned char *rop;
|
|
||||||
{
|
|
||||||
register int d;
|
|
||||||
register Pixel mask = 1;
|
|
||||||
|
|
||||||
for (d = 0; d < depth; d++, mask <<= 1) {
|
|
||||||
if (!(planemask & mask))
|
|
||||||
rop[d] = RROP_NOP;
|
|
||||||
else if ((src & mask) == 0) /* src is black */
|
|
||||||
switch (alu) {
|
|
||||||
case GXclear:
|
|
||||||
rop[d] = RROP_BLACK;
|
|
||||||
break;
|
|
||||||
case GXand:
|
|
||||||
rop[d] = RROP_BLACK;
|
|
||||||
break;
|
|
||||||
case GXandReverse:
|
|
||||||
rop[d] = RROP_BLACK;
|
|
||||||
break;
|
|
||||||
case GXcopy:
|
|
||||||
rop[d] = RROP_BLACK;
|
|
||||||
break;
|
|
||||||
case GXandInverted:
|
|
||||||
rop[d] = RROP_NOP;
|
|
||||||
break;
|
|
||||||
case GXnoop:
|
|
||||||
rop[d] = RROP_NOP;
|
|
||||||
break;
|
|
||||||
case GXxor:
|
|
||||||
rop[d] = RROP_NOP;
|
|
||||||
break;
|
|
||||||
case GXor:
|
|
||||||
rop[d] = RROP_NOP;
|
|
||||||
break;
|
|
||||||
case GXnor:
|
|
||||||
rop[d] = RROP_INVERT;
|
|
||||||
break;
|
|
||||||
case GXequiv:
|
|
||||||
rop[d] = RROP_INVERT;
|
|
||||||
break;
|
|
||||||
case GXinvert:
|
|
||||||
rop[d] = RROP_INVERT;
|
|
||||||
break;
|
|
||||||
case GXorReverse:
|
|
||||||
rop[d] = RROP_INVERT;
|
|
||||||
break;
|
|
||||||
case GXcopyInverted:
|
|
||||||
rop[d] = RROP_WHITE;
|
|
||||||
break;
|
|
||||||
case GXorInverted:
|
|
||||||
rop[d] = RROP_WHITE;
|
|
||||||
break;
|
|
||||||
case GXnand:
|
|
||||||
rop[d] = RROP_WHITE;
|
|
||||||
break;
|
|
||||||
case GXset:
|
|
||||||
rop[d] = RROP_WHITE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else /* src is white */
|
|
||||||
switch (alu) {
|
|
||||||
case GXclear:
|
|
||||||
rop[d] = RROP_BLACK;
|
|
||||||
break;
|
|
||||||
case GXand:
|
|
||||||
rop[d] = RROP_NOP;
|
|
||||||
break;
|
|
||||||
case GXandReverse:
|
|
||||||
rop[d] = RROP_INVERT;
|
|
||||||
break;
|
|
||||||
case GXcopy:
|
|
||||||
rop[d] = RROP_WHITE;
|
|
||||||
break;
|
|
||||||
case GXandInverted:
|
|
||||||
rop[d] = RROP_BLACK;
|
|
||||||
break;
|
|
||||||
case GXnoop:
|
|
||||||
rop[d] = RROP_NOP;
|
|
||||||
break;
|
|
||||||
case GXxor:
|
|
||||||
rop[d] = RROP_INVERT;
|
|
||||||
break;
|
|
||||||
case GXor:
|
|
||||||
rop[d] = RROP_WHITE;
|
|
||||||
break;
|
|
||||||
case GXnor:
|
|
||||||
rop[d] = RROP_BLACK;
|
|
||||||
break;
|
|
||||||
case GXequiv:
|
|
||||||
rop[d] = RROP_NOP;
|
|
||||||
break;
|
|
||||||
case GXinvert:
|
|
||||||
rop[d] = RROP_INVERT;
|
|
||||||
break;
|
|
||||||
case GXorReverse:
|
|
||||||
rop[d] = RROP_WHITE;
|
|
||||||
break;
|
|
||||||
case GXcopyInverted:
|
|
||||||
rop[d] = RROP_BLACK;
|
|
||||||
break;
|
|
||||||
case GXorInverted:
|
|
||||||
rop[d] = RROP_NOP;
|
|
||||||
break;
|
|
||||||
case GXnand:
|
|
||||||
rop[d] = RROP_INVERT;
|
|
||||||
break;
|
|
||||||
case GXset:
|
|
||||||
rop[d] = RROP_WHITE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ilbmComputeCompositeClip(pGC, pDrawable)
|
|
||||||
GCPtr pGC;
|
|
||||||
DrawablePtr pDrawable;
|
|
||||||
{
|
|
||||||
ScreenPtr pScreen = pGC->pScreen;
|
|
||||||
|
|
||||||
if (pDrawable->type == DRAWABLE_WINDOW) {
|
|
||||||
WindowPtr pWin = (WindowPtr) pDrawable;
|
|
||||||
RegionPtr pregWin;
|
|
||||||
Bool freeTmpClip, freeCompClip;
|
|
||||||
|
|
||||||
if (pGC->subWindowMode == IncludeInferiors) {
|
|
||||||
pregWin = NotClippedByChildren(pWin);
|
|
||||||
freeTmpClip = TRUE;
|
|
||||||
} else {
|
|
||||||
pregWin = &pWin->clipList;
|
|
||||||
freeTmpClip = FALSE;
|
|
||||||
}
|
|
||||||
freeCompClip = pGC->freeCompClip;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* if there is no client clip, we can get by with just keeping the
|
|
||||||
* pointer we got, and remembering whether or not should destroy (or
|
|
||||||
* maybe re-use) it later. this way, we avoid unnecessary copying of
|
|
||||||
* regions. (this wins especially if many clients clip by children
|
|
||||||
* and have no client clip.)
|
|
||||||
*/
|
|
||||||
if (pGC->clientClipType == CT_NONE) {
|
|
||||||
if (freeCompClip)
|
|
||||||
REGION_DESTROY(pScreen, pGC->pCompositeClip);
|
|
||||||
pGC->pCompositeClip = pregWin;
|
|
||||||
pGC->freeCompClip = freeTmpClip;
|
|
||||||
} else {
|
|
||||||
/*
|
|
||||||
* we need one 'real' region to put into the composite clip. if
|
|
||||||
* pregWin the current composite clip are real, we can get rid of
|
|
||||||
* one. if pregWin is real and the current composite clip isn't,
|
|
||||||
* use pregWin for the composite clip. if the current composite
|
|
||||||
* clip is real and pregWin isn't, use the current composite
|
|
||||||
* clip. if neither is real, create a new region.
|
|
||||||
*/
|
|
||||||
|
|
||||||
REGION_TRANSLATE(pScreen, pGC->clientClip,
|
|
||||||
pDrawable->x + pGC->clipOrg.x,
|
|
||||||
pDrawable->y + pGC->clipOrg.y);
|
|
||||||
|
|
||||||
if (freeCompClip) {
|
|
||||||
REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip, pregWin,
|
|
||||||
pGC->clientClip);
|
|
||||||
if (freeTmpClip)
|
|
||||||
REGION_DESTROY(pScreen, pregWin);
|
|
||||||
} else if (freeTmpClip) {
|
|
||||||
REGION_INTERSECT(pScreen, pregWin, pregWin, pGC->clientClip);
|
|
||||||
pGC->pCompositeClip = pregWin;
|
|
||||||
} else {
|
|
||||||
pGC->pCompositeClip = REGION_CREATE(pScreen, NullBox, 0);
|
|
||||||
REGION_INTERSECT(pScreen, pGC->pCompositeClip,
|
|
||||||
pregWin, pGC->clientClip);
|
|
||||||
}
|
|
||||||
pGC->freeCompClip = TRUE;
|
|
||||||
REGION_TRANSLATE(pScreen, pGC->clientClip,
|
|
||||||
-(pDrawable->x + pGC->clipOrg.x),
|
|
||||||
-(pDrawable->y + pGC->clipOrg.y));
|
|
||||||
}
|
|
||||||
} /* end of composite clip for a window */
|
|
||||||
else {
|
|
||||||
BoxRec pixbounds;
|
|
||||||
|
|
||||||
/* XXX should we translate by drawable.x/y here ? */
|
|
||||||
pixbounds.x1 = 0;
|
|
||||||
pixbounds.y1 = 0;
|
|
||||||
pixbounds.x2 = pDrawable->width;
|
|
||||||
pixbounds.y2 = pDrawable->height;
|
|
||||||
|
|
||||||
if (pGC->freeCompClip) {
|
|
||||||
REGION_RESET(pScreen, pGC->pCompositeClip, &pixbounds);
|
|
||||||
} else {
|
|
||||||
pGC->freeCompClip = TRUE;
|
|
||||||
pGC->pCompositeClip = REGION_CREATE(pScreen, &pixbounds, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pGC->clientClipType == CT_REGION) {
|
|
||||||
REGION_TRANSLATE(pScreen, pGC->pCompositeClip, -pGC->clipOrg.x,
|
|
||||||
-pGC->clipOrg.y);
|
|
||||||
REGION_INTERSECT(pScreen, pGC->pCompositeClip,
|
|
||||||
pGC->pCompositeClip, pGC->clientClip);
|
|
||||||
REGION_TRANSLATE(pScreen, pGC->pCompositeClip, pGC->clipOrg.x,
|
|
||||||
pGC->clipOrg.y);
|
|
||||||
}
|
|
||||||
} /* end of composite clip for pixmap */
|
|
||||||
} /* end ilbmComputeCompositeClip */
|
|
||||||
170
ilbm/ilbmgetsp.c
170
ilbm/ilbmgetsp.c
@@ -1,170 +0,0 @@
|
|||||||
/* $XFree86$ */
|
|
||||||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
|
||||||
/***********************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
******************************************************************/
|
|
||||||
/* $XConsortium: ilbmgetsp.c,v 5.10 94/04/17 20:28:24 dpw Exp $ */
|
|
||||||
|
|
||||||
/* Modified jun 95 by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
|
|
||||||
to use interleaved bitplanes instead of normal bitplanes */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include <X11/Xmd.h>
|
|
||||||
|
|
||||||
#include "misc.h"
|
|
||||||
#include "region.h"
|
|
||||||
#include "gc.h"
|
|
||||||
#include "windowstr.h"
|
|
||||||
#include "pixmapstr.h"
|
|
||||||
#include "scrnintstr.h"
|
|
||||||
|
|
||||||
#include "ilbm.h"
|
|
||||||
#include "maskbits.h"
|
|
||||||
|
|
||||||
#include "servermd.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.
|
|
||||||
*/
|
|
||||||
/*ARGSUSED*/
|
|
||||||
void
|
|
||||||
ilbmGetSpans(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 */
|
|
||||||
{
|
|
||||||
PixelType *pdstStart = (PixelType *)pchardstStart;
|
|
||||||
register PixelType *pdst; /* where to put the bits */
|
|
||||||
register PixelType *psrc; /* where to get the bits */
|
|
||||||
register PixelType tmpSrc; /* scratch buffer for bits */
|
|
||||||
PixelType *psrcBase; /* start of src bitmap */
|
|
||||||
int widthSrc; /* width of pixmap in bytes */
|
|
||||||
int auxSrc;
|
|
||||||
int depthSrc;
|
|
||||||
register DDXPointPtr pptLast; /* one past last point to get */
|
|
||||||
int xEnd; /* last pixel to copy from */
|
|
||||||
register int nstart;
|
|
||||||
register int d;
|
|
||||||
int nend;
|
|
||||||
int srcStartOver;
|
|
||||||
PixelType startmask, endmask;
|
|
||||||
unsigned int srcBit;
|
|
||||||
int nlMiddle, nl;
|
|
||||||
int w;
|
|
||||||
|
|
||||||
pptLast = ppt + nspans;
|
|
||||||
|
|
||||||
ilbmGetPixelWidthAuxDepthAndPointer(pDrawable, widthSrc, auxSrc, depthSrc,
|
|
||||||
psrcBase);
|
|
||||||
pdst = pdstStart;
|
|
||||||
|
|
||||||
while (ppt < pptLast) {
|
|
||||||
/* XXX should this really be << PWSH, or * 8, or * PGSZB? */
|
|
||||||
xEnd = min(ppt->x + *pwidth, widthSrc << PWSH);
|
|
||||||
pwidth++;
|
|
||||||
for (d = 0; d < depthSrc; d++) {
|
|
||||||
psrc = ilbmScanline(psrcBase, ppt->x, ppt->y, auxSrc);
|
|
||||||
psrcBase += widthSrc; /* @@@ NEXT PLANE @@@ */
|
|
||||||
w = xEnd - ppt->x;
|
|
||||||
srcBit = ppt->x & PIM;
|
|
||||||
|
|
||||||
if (srcBit + w <= PPW)
|
|
||||||
{
|
|
||||||
getandputbits0(psrc, srcBit, w, pdst);
|
|
||||||
pdst++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
maskbits(ppt->x, w, startmask, endmask, nlMiddle);
|
|
||||||
if (startmask)
|
|
||||||
nstart = PPW - srcBit;
|
|
||||||
else
|
|
||||||
nstart = 0;
|
|
||||||
if (endmask)
|
|
||||||
nend = xEnd & PIM;
|
|
||||||
srcStartOver = srcBit + nstart > PLST;
|
|
||||||
if (startmask)
|
|
||||||
{
|
|
||||||
getandputbits0(psrc, srcBit, nstart, pdst);
|
|
||||||
if (srcStartOver)
|
|
||||||
psrc++;
|
|
||||||
}
|
|
||||||
nl = nlMiddle;
|
|
||||||
#ifdef FASTPUTBITS
|
|
||||||
Duff(nl, putbits(*psrc, nstart, PPW, pdst); psrc++; pdst++;);
|
|
||||||
#else
|
|
||||||
while (nl--)
|
|
||||||
{
|
|
||||||
tmpSrc = *psrc;
|
|
||||||
putbits(tmpSrc, nstart, PPW, pdst);
|
|
||||||
psrc++;
|
|
||||||
pdst++;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (endmask)
|
|
||||||
{
|
|
||||||
putbits(*psrc, nstart, nend, pdst);
|
|
||||||
if (nstart + nend > PPW)
|
|
||||||
pdst++;
|
|
||||||
}
|
|
||||||
if (startmask || endmask)
|
|
||||||
pdst++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ppt++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,213 +0,0 @@
|
|||||||
/* $XFree86$ */
|
|
||||||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
|
||||||
/***********************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
******************************************************************/
|
|
||||||
/* $XConsortium: ilbmhrzvert.c,v 1.15 94/04/17 20:28:24 dpw Exp $ */
|
|
||||||
|
|
||||||
/* Modified jun 95 by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
|
|
||||||
to use interleaved bitplanes instead of normal bitplanes */
|
|
||||||
|
|
||||||
#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 "ilbm.h"
|
|
||||||
#include "maskbits.h"
|
|
||||||
|
|
||||||
/* horizontal solid line
|
|
||||||
abs(len) > 1
|
|
||||||
*/
|
|
||||||
ilbmHorzS(pbase, nlwidth, auxDst, depthDst, x1, y1, len, rrops)
|
|
||||||
PixelType *pbase; /* pointer to base of bitmap */
|
|
||||||
register int nlwidth; /* width in longwords of bitmap */
|
|
||||||
int auxDst;
|
|
||||||
int depthDst;
|
|
||||||
int x1; /* initial point */
|
|
||||||
int y1;
|
|
||||||
int len; /* length of line */
|
|
||||||
register unsigned char *rrops;
|
|
||||||
{
|
|
||||||
register PixelType *addrl;
|
|
||||||
register PixelType startmask;
|
|
||||||
register PixelType endmask;
|
|
||||||
register int nlmiddle;
|
|
||||||
register int d;
|
|
||||||
int saveNLmiddle;
|
|
||||||
|
|
||||||
/* force the line to go left to right
|
|
||||||
but don't draw the last point
|
|
||||||
*/
|
|
||||||
if (len < 0) {
|
|
||||||
x1 += len;
|
|
||||||
x1 += 1;
|
|
||||||
len = -len;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* all bits inside same longword */
|
|
||||||
if ( ((x1 & PIM) + len) < PPW) {
|
|
||||||
maskpartialbits(x1, len, startmask);
|
|
||||||
|
|
||||||
for (d = 0; d < depthDst; d++) {
|
|
||||||
addrl = ilbmScanline(pbase, x1, y1, auxDst);
|
|
||||||
pbase += nlwidth; /* @@@ NEXT PLANE @@@ */
|
|
||||||
|
|
||||||
switch (rrops[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
*addrl &= ~startmask;
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
*addrl |= startmask;
|
|
||||||
break;
|
|
||||||
case RROP_INVERT:
|
|
||||||
*addrl ^= startmask;
|
|
||||||
break;
|
|
||||||
case RROP_NOP:
|
|
||||||
break;
|
|
||||||
} /* switch */
|
|
||||||
} /* for (d = ...) */
|
|
||||||
} else {
|
|
||||||
maskbits(x1, len, startmask, endmask, nlmiddle);
|
|
||||||
saveNLmiddle = nlmiddle;
|
|
||||||
|
|
||||||
for (d = 0; d < depthDst; d++) {
|
|
||||||
addrl = ilbmScanline(pbase, x1, y1, auxDst);
|
|
||||||
pbase += nlwidth; /* @@@ NEXT PLANE @@@ */
|
|
||||||
nlmiddle = saveNLmiddle;
|
|
||||||
|
|
||||||
switch (rrops[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
if (startmask)
|
|
||||||
*addrl++ &= ~startmask;
|
|
||||||
Duff (nlmiddle, *addrl++ = 0x0);
|
|
||||||
if (endmask)
|
|
||||||
*addrl &= ~endmask;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RROP_WHITE:
|
|
||||||
if (startmask)
|
|
||||||
*addrl++ |= startmask;
|
|
||||||
Duff (nlmiddle, *addrl++ = ~0);
|
|
||||||
if (endmask)
|
|
||||||
*addrl |= endmask;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RROP_INVERT:
|
|
||||||
if (startmask)
|
|
||||||
*addrl++ ^= startmask;
|
|
||||||
Duff (nlmiddle, *addrl++ ^= ~0);
|
|
||||||
if (endmask)
|
|
||||||
*addrl ^= endmask;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RROP_NOP:
|
|
||||||
break;
|
|
||||||
} /* switch */
|
|
||||||
} /* for (d = ... ) */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* vertical solid line
|
|
||||||
this uses do loops because pcc (Ultrix 1.2, bsd 4.2) generates
|
|
||||||
better code. sigh. we know that len will never be 0 or 1, so
|
|
||||||
it's OK to use it.
|
|
||||||
*/
|
|
||||||
|
|
||||||
ilbmVertS(pbase, nlwidth, auxDst, depthDst, x1, y1, len, rrops)
|
|
||||||
PixelType *pbase; /* pointer to base of bitmap */
|
|
||||||
register int nlwidth; /* width in longwords of bitmap */
|
|
||||||
int auxDst;
|
|
||||||
int depthDst;
|
|
||||||
int x1, y1; /* initial point */
|
|
||||||
register int len; /* length of line */
|
|
||||||
unsigned char *rrops;
|
|
||||||
{
|
|
||||||
register PixelType *addrl;
|
|
||||||
register PixelType bitmask;
|
|
||||||
int saveLen;
|
|
||||||
int d;
|
|
||||||
|
|
||||||
if (len < 0) {
|
|
||||||
auxDst = -auxDst;
|
|
||||||
len = -len;
|
|
||||||
}
|
|
||||||
|
|
||||||
saveLen = len;
|
|
||||||
|
|
||||||
for (d = 0; d < depthDst; d++) {
|
|
||||||
addrl = ilbmScanline(pbase, x1, y1, auxDst);
|
|
||||||
pbase += nlwidth; /* @@@ NEXT PLANE @@@ */
|
|
||||||
len = saveLen;
|
|
||||||
|
|
||||||
switch (rrops[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
bitmask = rmask[x1 & PIM];
|
|
||||||
Duff(len, *addrl &= bitmask; ilbmScanlineInc(addrl, auxDst) );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RROP_WHITE:
|
|
||||||
bitmask = mask[x1 & PIM];
|
|
||||||
Duff(len, *addrl |= bitmask; ilbmScanlineInc(addrl, auxDst) );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RROP_INVERT:
|
|
||||||
bitmask = mask[x1 & PIM];
|
|
||||||
Duff(len, *addrl ^= bitmask; ilbmScanlineInc(addrl, auxDst) );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RROP_NOP:
|
|
||||||
break;
|
|
||||||
} /* switch */
|
|
||||||
} /* for (d = ...) */
|
|
||||||
}
|
|
||||||
441
ilbm/ilbmimage.c
441
ilbm/ilbmimage.c
@@ -1,441 +0,0 @@
|
|||||||
/* $XFree86: xc/programs/Xserver/ilbm/ilbmimage.c,v 3.0 1996/08/18 01:53:56 dawes Exp $ */
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
/* Modified jun 95 by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
|
|
||||||
to use interleaved bitplanes instead of normal bitplanes */
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include "windowstr.h"
|
|
||||||
#include "pixmapstr.h"
|
|
||||||
#include "scrnintstr.h"
|
|
||||||
#include "gcstruct.h"
|
|
||||||
#include "ilbm.h"
|
|
||||||
#include "maskbits.h"
|
|
||||||
#include "servermd.h"
|
|
||||||
|
|
||||||
void
|
|
||||||
ilbmPutImage(pDraw, pGC, depth, x, y, width, height, leftPad, format, pImage)
|
|
||||||
DrawablePtr pDraw;
|
|
||||||
GCPtr pGC;
|
|
||||||
int depth, x, y, width, height;
|
|
||||||
int leftPad;
|
|
||||||
int format;
|
|
||||||
char *pImage;
|
|
||||||
{
|
|
||||||
PixmapPtr pPixmap;
|
|
||||||
|
|
||||||
#if 1
|
|
||||||
fprintf(stderr, "ilbmPutImage()\n");
|
|
||||||
fprintf(stderr, "\tdepth = %d, x = %d, y = %d, width = %d, height = %d, "
|
|
||||||
"leftPad = %d\n", depth, x, y, width, height, leftPad);
|
|
||||||
switch (format) {
|
|
||||||
case XYBitmap:
|
|
||||||
fprintf(stderr, "\tformat = XYBitmap\n");
|
|
||||||
break;
|
|
||||||
case XYPixmap:
|
|
||||||
fprintf(stderr, "\tformat = XYPixmap\n");
|
|
||||||
break;
|
|
||||||
case ZPixmap:
|
|
||||||
fprintf(stderr, "\tformat = ZPixmap\n");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
fprintf(stderr, "\tformat = %d\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if ((width == 0) || (height == 0))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (format != ZPixmap || depth == 1 || pDraw->depth == 1) {
|
|
||||||
if (format == XYBitmap) {
|
|
||||||
char *ptmp;
|
|
||||||
int realwidth;
|
|
||||||
int size;
|
|
||||||
int aux;
|
|
||||||
int d, yy, xx;
|
|
||||||
char *ss, *dd;
|
|
||||||
|
|
||||||
realwidth = BitmapBytePad(width+leftPad);
|
|
||||||
aux = depth*realwidth;
|
|
||||||
size = height*aux;
|
|
||||||
|
|
||||||
#if 1
|
|
||||||
fprintf(stderr, "\trealwidth = %d, aux = %d, size = %d\n", realwidth,
|
|
||||||
aux, size);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!(ptmp = (char *)ALLOCATE_LOCAL(size)))
|
|
||||||
return;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Convert from bitplanes to interleaved bitplanes
|
|
||||||
*/
|
|
||||||
|
|
||||||
ss = (char *)pImage;
|
|
||||||
for (d = 0; d < depth; d++) {
|
|
||||||
dd = ptmp+d*realwidth;
|
|
||||||
for (yy = 0; yy < height; yy++) {
|
|
||||||
for (xx = 0; xx < realwidth; xx++)
|
|
||||||
#if 1
|
|
||||||
{
|
|
||||||
fprintf(stderr, "*(%d) = *(%d)\n", (&dd[xx])-ptmp,
|
|
||||||
ss-(char *)pImage);
|
|
||||||
#endif
|
|
||||||
dd[xx] = *(ss++);
|
|
||||||
#if 1
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
dd += aux;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pPixmap = GetScratchPixmapHeader(pDraw->pScreen, width+leftPad, height,
|
|
||||||
depth, depth,
|
|
||||||
BitmapBytePad(width+leftPad),
|
|
||||||
(pointer)ptmp);
|
|
||||||
if (!pPixmap) {
|
|
||||||
DEALLOCATE_LOCAL(ptmp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
pGC->fExpose = FALSE;
|
|
||||||
(void)(*pGC->ops->CopyPlane)((DrawablePtr)pPixmap, pDraw, pGC, leftPad,
|
|
||||||
0, width, height, x, y, 1);
|
|
||||||
DEALLOCATE_LOCAL(ptmp);
|
|
||||||
} else {
|
|
||||||
#if 0
|
|
||||||
/* XXX: bit plane order wronge ! */
|
|
||||||
pPixmap->drawable.depth = 1;
|
|
||||||
pPixmap->drawable.bitsPerPixel = 1;
|
|
||||||
|
|
||||||
switch (pGC->alu) {
|
|
||||||
case GXcopy:
|
|
||||||
doBitBlt = ilbmDoBitbltCopy;
|
|
||||||
break;
|
|
||||||
case GXxor:
|
|
||||||
doBitBlt = ilbmDoBitbltXor;
|
|
||||||
break;
|
|
||||||
case GXcopyInverted:
|
|
||||||
doBitBlt = ilbmDoBitbltCopyInverted;
|
|
||||||
break;
|
|
||||||
case GXor:
|
|
||||||
doBitBlt = ilbmDoBitbltOr;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
doBitBlt = ilbmDoBitbltGeneral;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (plane = (1L << (pPixmap->drawable.depth - 1)); plane;
|
|
||||||
plane >>= 1) {
|
|
||||||
(void)ilbmBitBlt((DrawablePtr)pPixmap, pDraw, pGC, leftPad, 0,
|
|
||||||
width, height, x, y, doBitBlt, plane);
|
|
||||||
/* pDraw->devKind += sizeDst; */
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
char *ptmp;
|
|
||||||
int realwidth;
|
|
||||||
int size;
|
|
||||||
int aux;
|
|
||||||
int d, yy, xx;
|
|
||||||
char *ss, *dd;
|
|
||||||
|
|
||||||
realwidth = BitmapBytePad(width+leftPad);
|
|
||||||
aux = depth*realwidth;
|
|
||||||
size = height*aux;
|
|
||||||
|
|
||||||
#if 1
|
|
||||||
fprintf(stderr, "\trealwidth = %d, aux = %d, size = %d\n", realwidth,
|
|
||||||
aux, size);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!(ptmp = (char *)ALLOCATE_LOCAL(size)))
|
|
||||||
return;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Convert from bitplanes to interleaved bitplanes
|
|
||||||
*/
|
|
||||||
|
|
||||||
ss = (char *)pImage;
|
|
||||||
for (d = 0; d < depth; d++) {
|
|
||||||
dd = ptmp+d*realwidth;
|
|
||||||
for (yy = 0; yy < height; yy++) {
|
|
||||||
for (xx = 0; xx < realwidth; xx++)
|
|
||||||
#if 1
|
|
||||||
{
|
|
||||||
fprintf(stderr, "*(%d) = *(%d)\n", (&dd[xx])-ptmp,
|
|
||||||
ss-(char *)pImage);
|
|
||||||
#endif
|
|
||||||
dd[xx] = *(ss++);
|
|
||||||
#if 1
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
dd += aux;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pPixmap = GetScratchPixmapHeader(pDraw->pScreen, width+leftPad, height,
|
|
||||||
depth, depth,
|
|
||||||
BitmapBytePad(width+leftPad),
|
|
||||||
(pointer)ptmp);
|
|
||||||
if (!pPixmap) {
|
|
||||||
DEALLOCATE_LOCAL(ptmp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
pGC->fExpose = FALSE;
|
|
||||||
(void)(*pGC->ops->CopyArea)((DrawablePtr)pPixmap, pDraw, pGC, leftPad,
|
|
||||||
0, width, height, x, y);
|
|
||||||
DEALLOCATE_LOCAL(ptmp);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
pGC->fExpose = TRUE;
|
|
||||||
FreeScratchPixmapHeader(pPixmap);
|
|
||||||
} else {
|
|
||||||
/* Chunky to planar conversion required */
|
|
||||||
|
|
||||||
PixmapPtr pPixmap;
|
|
||||||
ScreenPtr pScreen = pDraw->pScreen;
|
|
||||||
int widthSrc;
|
|
||||||
int start_srcshift;
|
|
||||||
register int b;
|
|
||||||
register int dstshift;
|
|
||||||
register int shift_step;
|
|
||||||
register PixelType dst;
|
|
||||||
register PixelType srcbits;
|
|
||||||
register PixelType *pdst;
|
|
||||||
register PixelType *psrc;
|
|
||||||
int start_bit;
|
|
||||||
register int nl;
|
|
||||||
register int h;
|
|
||||||
register int d;
|
|
||||||
int auxDst;
|
|
||||||
PixelType *pdstBase;
|
|
||||||
int widthDst;
|
|
||||||
int depthDst;
|
|
||||||
|
|
||||||
/* Create a tmp pixmap */
|
|
||||||
pPixmap = (pScreen->CreatePixmap)(pScreen, width, height, depth);
|
|
||||||
if (!pPixmap)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ilbmGetPixelWidthAuxDepthAndPointer((DrawablePtr)pPixmap, widthDst,
|
|
||||||
auxDst, depthDst, pdstBase);
|
|
||||||
|
|
||||||
widthSrc = PixmapWidthInPadUnits(width, depth);
|
|
||||||
/* XXX: if depth == 8, use fast chunky to planar assembly function.*/
|
|
||||||
if (depth > 4) {
|
|
||||||
start_srcshift = 24;
|
|
||||||
shift_step = 8;
|
|
||||||
} else {
|
|
||||||
start_srcshift = 28;
|
|
||||||
shift_step = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (d = 0; d < depth; d++, pdstBase += widthDst) { /* @@@ NEXT PLANE @@@ */
|
|
||||||
register PixelType *pdstLine = pdstBase;
|
|
||||||
start_bit = start_srcshift + d;
|
|
||||||
psrc = (PixelType *)pImage;
|
|
||||||
h = height;
|
|
||||||
|
|
||||||
while (h--) {
|
|
||||||
pdst = pdstLine;
|
|
||||||
pdstLine += auxDst;
|
|
||||||
dstshift = PPW - 1;
|
|
||||||
dst = 0;
|
|
||||||
nl = widthSrc;
|
|
||||||
while (nl--) {
|
|
||||||
srcbits = *psrc++;
|
|
||||||
for (b = start_bit; b >= 0; b -= shift_step) {
|
|
||||||
dst |= ((srcbits >> b) & 1) << dstshift;
|
|
||||||
if (--dstshift < 0) {
|
|
||||||
dstshift = PPW - 1;
|
|
||||||
*pdst++ = dst;
|
|
||||||
dst = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (dstshift != PPW - 1)
|
|
||||||
*pdst++ = dst;
|
|
||||||
}
|
|
||||||
} /* for (d = ...) */
|
|
||||||
|
|
||||||
pGC->fExpose = FALSE;
|
|
||||||
(void)(*pGC->ops->CopyArea)((DrawablePtr)pPixmap, pDraw, pGC, leftPad, 0,
|
|
||||||
width, height, x, y);
|
|
||||||
pGC->fExpose = TRUE;
|
|
||||||
(*pScreen->DestroyPixmap)(pPixmap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ilbmGetImage(pDrawable, sx, sy, width, height, format, planemask, pdstLine)
|
|
||||||
DrawablePtr pDrawable;
|
|
||||||
int sx, sy, width, height;
|
|
||||||
unsigned int format;
|
|
||||||
unsigned long planemask;
|
|
||||||
char *pdstLine;
|
|
||||||
{
|
|
||||||
BoxRec box;
|
|
||||||
DDXPointRec ptSrc;
|
|
||||||
RegionRec rgnDst;
|
|
||||||
ScreenPtr pScreen;
|
|
||||||
PixmapPtr pPixmap;
|
|
||||||
|
|
||||||
#if 1
|
|
||||||
fprintf(stderr, "ilbmGetImage()\n");
|
|
||||||
fprintf(stderr, "\tsx = %d, sy = %d, width = %d, height = %d, "
|
|
||||||
"planemask = 0x%08x\n", sx, sy, width, height, planemask);
|
|
||||||
switch (format) {
|
|
||||||
case XYBitmap:
|
|
||||||
fprintf(stderr, "\tformat = XYBitmap\n");
|
|
||||||
break;
|
|
||||||
case XYPixmap:
|
|
||||||
fprintf(stderr, "\tformat = XYPixmap\n");
|
|
||||||
break;
|
|
||||||
case ZPixmap:
|
|
||||||
fprintf(stderr, "\tformat = ZPixmap\n");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
fprintf(stderr, "\tformat = %d\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if ((width == 0) || (height == 0))
|
|
||||||
return;
|
|
||||||
|
|
||||||
pScreen = pDrawable->pScreen;
|
|
||||||
sx += pDrawable->x;
|
|
||||||
sy += pDrawable->y;
|
|
||||||
|
|
||||||
if (format == XYPixmap || pDrawable->depth == 1) {
|
|
||||||
pPixmap = GetScratchPixmapHeader(pScreen, width, height, 1, 1,
|
|
||||||
BitmapBytePad(width), (pointer)pdstLine);
|
|
||||||
if (!pPixmap)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ptSrc.x = sx;
|
|
||||||
ptSrc.y = sy;
|
|
||||||
box.x1 = 0;
|
|
||||||
box.y1 = 0;
|
|
||||||
box.x2 = width;
|
|
||||||
box.y2 = height;
|
|
||||||
REGION_INIT(pScreen, &rgnDst, &box, 1);
|
|
||||||
|
|
||||||
pPixmap->drawable.depth = 1;
|
|
||||||
pPixmap->drawable.bitsPerPixel = 1;
|
|
||||||
/* dix layer only ever calls GetImage with 1 bit set in planemask
|
|
||||||
* when format is XYPixmap.
|
|
||||||
*/
|
|
||||||
ilbmDoBitblt(pDrawable, (DrawablePtr)pPixmap, GXcopy, &rgnDst, &ptSrc,
|
|
||||||
planemask);
|
|
||||||
|
|
||||||
FreeScratchPixmapHeader(pPixmap);
|
|
||||||
REGION_UNINIT(pScreen, &rgnDst);
|
|
||||||
} else {
|
|
||||||
/* Planar to chunky conversion required */
|
|
||||||
|
|
||||||
PixelType *psrcBits;
|
|
||||||
PixelType *psrcLine;
|
|
||||||
PixelType startmask, endmask;
|
|
||||||
int depthSrc;
|
|
||||||
int widthSrc;
|
|
||||||
int auxSrc;
|
|
||||||
int sizeDst;
|
|
||||||
int widthDst;
|
|
||||||
register PixelType *psrc;
|
|
||||||
register PixelType *pdst;
|
|
||||||
register PixelType dst;
|
|
||||||
register PixelType srcbits;
|
|
||||||
register int d;
|
|
||||||
register int b;
|
|
||||||
register int dstshift;
|
|
||||||
register int shift_step;
|
|
||||||
register int start_endbit;
|
|
||||||
int start_startbit;
|
|
||||||
register int end_endbit;
|
|
||||||
register int start_dstshift;
|
|
||||||
register int nl;
|
|
||||||
register int h;
|
|
||||||
int nlmiddle;
|
|
||||||
|
|
||||||
widthDst = PixmapWidthInPadUnits(width, pDrawable->depth);
|
|
||||||
sizeDst = widthDst * height;
|
|
||||||
|
|
||||||
/* Clear the dest image */
|
|
||||||
bzero(pdstLine, sizeDst << 2);
|
|
||||||
|
|
||||||
ilbmGetPixelWidthAuxDepthAndPointer(pDrawable, widthSrc, auxSrc,
|
|
||||||
depthSrc, psrcBits);
|
|
||||||
|
|
||||||
psrcBits = ilbmScanline(psrcBits, sx, sy, auxSrc);
|
|
||||||
|
|
||||||
start_startbit = PPW - 1 - (sx & PIM);
|
|
||||||
if ((sx & PIM) + width < PPW) {
|
|
||||||
maskpartialbits(sx, width, startmask);
|
|
||||||
nlmiddle = 0;
|
|
||||||
endmask = 0;
|
|
||||||
start_endbit = PPW - ((sx + width) & PIM);
|
|
||||||
} else {
|
|
||||||
maskbits(sx, width, startmask, endmask, nlmiddle);
|
|
||||||
start_endbit = 0;
|
|
||||||
end_endbit = PPW - ((sx + width) & PIM);
|
|
||||||
}
|
|
||||||
/* ZPixmap images have either 4 or 8 bits per pixel dependent on
|
|
||||||
* depth.
|
|
||||||
*/
|
|
||||||
if (depthSrc > 4) {
|
|
||||||
start_dstshift = 24;
|
|
||||||
shift_step = 8;
|
|
||||||
} else {
|
|
||||||
start_dstshift = 28;
|
|
||||||
shift_step = 4;
|
|
||||||
}
|
|
||||||
#define SHIFT_BITS(start_bit,end_bit) \
|
|
||||||
for (b = (start_bit); b >= (end_bit); b--) { \
|
|
||||||
dst |= ((srcbits >> b) & 1) << dstshift; \
|
|
||||||
if ((dstshift -= shift_step) < 0) { \
|
|
||||||
dstshift = start_dstshift + d; \
|
|
||||||
*pdst++ = dst; \
|
|
||||||
dst = *pdst; \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
|
|
||||||
for (d = 0; d < depthSrc; d++, psrcBits += widthSrc) { /* @@@ NEXT PLANE @@@ */
|
|
||||||
psrcLine = psrcBits;
|
|
||||||
pdst = (PixelType *)pdstLine;
|
|
||||||
h = height;
|
|
||||||
|
|
||||||
while (h--) {
|
|
||||||
psrc = psrcLine;
|
|
||||||
psrcLine += auxSrc;
|
|
||||||
dst = *pdst;
|
|
||||||
dstshift = start_dstshift + d;
|
|
||||||
|
|
||||||
if (startmask) {
|
|
||||||
srcbits = *psrc++ & startmask;
|
|
||||||
SHIFT_BITS(start_startbit, start_endbit);
|
|
||||||
}
|
|
||||||
|
|
||||||
nl = nlmiddle;
|
|
||||||
while (nl--) {
|
|
||||||
srcbits = *psrc++;
|
|
||||||
SHIFT_BITS(PPW - 1, 0);
|
|
||||||
}
|
|
||||||
if (endmask) {
|
|
||||||
srcbits = *psrc & endmask;
|
|
||||||
SHIFT_BITS(PPW - 1, end_endbit);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dstshift != start_dstshift + d)
|
|
||||||
*pdst++ = dst;
|
|
||||||
} /* while (h--) */
|
|
||||||
} /* for (d = ...) */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,474 +0,0 @@
|
|||||||
/* $XFree86: xc/programs/Xserver/ilbm/ilbmimggblt.c,v 3.0 1996/08/18 01:53:57 dawes Exp $ */
|
|
||||||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
|
||||||
/***********************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
******************************************************************/
|
|
||||||
/* $XConsortium: ilbmimggblt.c,v 5.17 94/04/17 20:28:25 dpw Exp $ */
|
|
||||||
|
|
||||||
/* Modified jun 95 by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
|
|
||||||
to use interleaved bitplanes instead of normal bitplanes */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include <X11/Xmd.h>
|
|
||||||
#include <X11/Xproto.h>
|
|
||||||
#include "ilbm.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 "maskbits.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
we should eventually special-case fixed-width fonts for ImageText.
|
|
||||||
|
|
||||||
this works for fonts with glyphs <= 32 bits wide.
|
|
||||||
|
|
||||||
the clipping calculations are done for worst-case fonts.
|
|
||||||
we make no assumptions about the heights, widths, or bearings
|
|
||||||
of the glyphs. if we knew that the glyphs are all the same height,
|
|
||||||
we could clip the tops and bottoms per clipping box, rather
|
|
||||||
than per character per clipping box. if we knew that the glyphs'
|
|
||||||
left and right bearings were wlle-behaved, we could clip a single
|
|
||||||
character at the start, output until the last unclipped
|
|
||||||
character, and then clip the last one. this is all straightforward
|
|
||||||
to determine based on max-bounds and min-bounds from the font.
|
|
||||||
there is some inefficiency introduced in the per-character
|
|
||||||
clipping to make what's going on clearer.
|
|
||||||
|
|
||||||
(it is possible, for example, for a font to be defined in which the
|
|
||||||
next-to-last character in a font would be clipped out, but the last
|
|
||||||
one wouldn't. the code below deals with this.)
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
the register allocations for startmask and endmask may not
|
|
||||||
be the right thing. are there two other deserving candidates?
|
|
||||||
xoff, pdst, pglyph, and tmpSrc seem like the right things, though.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
ilbmImageGlyphBlt(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 */
|
|
||||||
{
|
|
||||||
ExtentInfoRec info; /* used by QueryGlyphExtents() */
|
|
||||||
BoxRec bbox; /* string's bounding box */
|
|
||||||
xRectangle backrect;/* backing rectangle to paint.
|
|
||||||
in the general case, NOT necessarily
|
|
||||||
the same as the string's bounding box
|
|
||||||
*/
|
|
||||||
|
|
||||||
CharInfoPtr pci;
|
|
||||||
int xorg, yorg; /* origin of drawable in bitmap */
|
|
||||||
int widthDst; /* width of dst in longwords */
|
|
||||||
|
|
||||||
/* these keep track of the character origin */
|
|
||||||
PixelType *pdstBase;
|
|
||||||
/* points to longword with character origin */
|
|
||||||
int xchar; /* xorigin of char (mod 32) */
|
|
||||||
|
|
||||||
/* these are used for placing the glyph */
|
|
||||||
register int xoff; /* x offset of left edge of glyph (mod 32) */
|
|
||||||
register PixelType *pdst;
|
|
||||||
/* pointer to current longword in dst */
|
|
||||||
|
|
||||||
register int d;
|
|
||||||
int depthDst;
|
|
||||||
int auxDst;
|
|
||||||
int hSave;
|
|
||||||
int w; /* width of glyph in bits */
|
|
||||||
int h; /* height of glyph */
|
|
||||||
int widthGlyph; /* width of glyph, in bytes */
|
|
||||||
unsigned char rrops[AFB_MAX_DEPTH];
|
|
||||||
register unsigned char *pglyph;
|
|
||||||
/* pointer to current row of glyph */
|
|
||||||
unsigned char *pglyphSave;
|
|
||||||
|
|
||||||
/* used for putting down glyph */
|
|
||||||
register PixelType tmpSrc;
|
|
||||||
/* for getting bits from glyph */
|
|
||||||
register PixelType startmask;
|
|
||||||
register PixelType endmask;
|
|
||||||
|
|
||||||
register int nFirst;/* bits of glyph in current longword */
|
|
||||||
PixelType *pdstSave;
|
|
||||||
int oldFill;
|
|
||||||
ilbmPrivGC *pPriv = (ilbmPrivGC *)(pGC->devPrivates[ilbmGCPrivateIndex].ptr);
|
|
||||||
|
|
||||||
xorg = pDrawable->x;
|
|
||||||
yorg = pDrawable->y;
|
|
||||||
ilbmGetPixelWidthAuxDepthAndPointer(pDrawable, widthDst, auxDst, depthDst,
|
|
||||||
pdstBase);
|
|
||||||
|
|
||||||
QueryGlyphExtents(pGC->font, ppci, (unsigned long)nglyph, &info);
|
|
||||||
|
|
||||||
backrect.x = x;
|
|
||||||
backrect.y = y - FONTASCENT(pGC->font);
|
|
||||||
backrect.width = info.overallWidth;
|
|
||||||
backrect.height = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);
|
|
||||||
|
|
||||||
x += xorg;
|
|
||||||
y += yorg;
|
|
||||||
|
|
||||||
bbox.x1 = x + info.overallLeft;
|
|
||||||
bbox.x2 = x + info.overallRight;
|
|
||||||
bbox.y1 = y - info.overallAscent;
|
|
||||||
bbox.y2 = y + info.overallDescent;
|
|
||||||
|
|
||||||
oldFill = pGC->fillStyle;
|
|
||||||
pGC->fillStyle = FillSolid;
|
|
||||||
ilbmReduceRop (pGC->alu, pGC->bgPixel, pGC->planemask, pGC->depth,
|
|
||||||
pPriv->rrops);
|
|
||||||
ilbmPolyFillRect(pDrawable, pGC, 1, &backrect);
|
|
||||||
pGC->fillStyle = oldFill;
|
|
||||||
ilbmReduceRop (pGC->alu, pGC->fgPixel, pGC->planemask, pGC->depth,
|
|
||||||
pPriv->rrops);
|
|
||||||
ilbmReduceRop (GXcopy, pGC->fgPixel, pGC->planemask, pGC->depth, rrops);
|
|
||||||
|
|
||||||
/* the faint-hearted can open their eyes now */
|
|
||||||
|
|
||||||
switch (RECT_IN_REGION(pGC->pScreen, pGC->pCompositeClip, &bbox)) {
|
|
||||||
case rgnOUT:
|
|
||||||
break;
|
|
||||||
case rgnIN:
|
|
||||||
pdstBase = ilbmScanlineNoBankSwitch(pdstBase, x, y, auxDst);
|
|
||||||
xchar = x & PIM;
|
|
||||||
|
|
||||||
while (nglyph--) {
|
|
||||||
pci = *ppci;
|
|
||||||
pglyphSave = FONTGLYPHBITS(pglyphBase, pci);
|
|
||||||
w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing;
|
|
||||||
hSave = pci->metrics.ascent + pci->metrics.descent;
|
|
||||||
widthGlyph = GLYPHWIDTHBYTESPADDED(pci);
|
|
||||||
/* start at top scanline of glyph */
|
|
||||||
pdstSave = ilbmScanlineDelta(pdstBase, -pci->metrics.ascent,
|
|
||||||
auxDst);
|
|
||||||
|
|
||||||
/* find correct word in scanline and x offset within it
|
|
||||||
for left edge of glyph
|
|
||||||
*/
|
|
||||||
xoff = xchar + pci->metrics.leftSideBearing;
|
|
||||||
if (xoff > PLST) {
|
|
||||||
pdstSave++;
|
|
||||||
xoff &= PIM;
|
|
||||||
} else if (xoff < 0) {
|
|
||||||
xoff += PPW;
|
|
||||||
pdstSave--;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (d = 0; d < depthDst; d++) {
|
|
||||||
h = hSave;
|
|
||||||
pdst = pdstSave;
|
|
||||||
pdstSave += widthDst; /* @@@ NEXT PLANE @@@ */
|
|
||||||
pglyph = pglyphSave;
|
|
||||||
|
|
||||||
if ((xoff + w) <= PPW) {
|
|
||||||
/* glyph all in one longword */
|
|
||||||
maskpartialbits(xoff, w, startmask);
|
|
||||||
|
|
||||||
switch (rrops[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
while (h--) {
|
|
||||||
getleftbits(pglyph, w, tmpSrc);
|
|
||||||
*pdst &= ~(SCRRIGHT(tmpSrc, xoff) & startmask);
|
|
||||||
pglyph += widthGlyph;
|
|
||||||
ilbmScanlineInc(pdst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
while (h--) {
|
|
||||||
getleftbits(pglyph, w, tmpSrc);
|
|
||||||
*pdst |= SCRRIGHT(tmpSrc, xoff) & startmask;
|
|
||||||
pglyph += widthGlyph;
|
|
||||||
ilbmScanlineInc(pdst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_NOP:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* glyph crosses longword boundary */
|
|
||||||
maskPPWbits(xoff, w, startmask, endmask);
|
|
||||||
nFirst = PPW - xoff;
|
|
||||||
|
|
||||||
switch (rrops[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
while (h--) {
|
|
||||||
getleftbits(pglyph, w, tmpSrc);
|
|
||||||
*pdst &= ~(SCRRIGHT(tmpSrc, xoff) & startmask);
|
|
||||||
*(pdst+1) &= ~(SCRLEFT(tmpSrc, nFirst) & endmask);
|
|
||||||
pglyph += widthGlyph;
|
|
||||||
ilbmScanlineInc(pdst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
while (h--) {
|
|
||||||
getleftbits(pglyph, w, tmpSrc);
|
|
||||||
*pdst |= SCRRIGHT(tmpSrc, xoff) & startmask;
|
|
||||||
*(pdst+1) |= SCRLEFT(tmpSrc, nFirst) & endmask;
|
|
||||||
pglyph += widthGlyph;
|
|
||||||
ilbmScanlineInc(pdst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_NOP:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} /* glyph crosses longwords boundary */
|
|
||||||
} /* depth loop */
|
|
||||||
/* update character origin */
|
|
||||||
x += pci->metrics.characterWidth;
|
|
||||||
xchar += pci->metrics.characterWidth;
|
|
||||||
if (xchar > PLST) {
|
|
||||||
xchar -= PPW;
|
|
||||||
pdstBase++;
|
|
||||||
} else if (xchar < 0) {
|
|
||||||
xchar += PPW;
|
|
||||||
pdstBase--;
|
|
||||||
}
|
|
||||||
ppci++;
|
|
||||||
} /* while nglyph-- */
|
|
||||||
break;
|
|
||||||
case rgnPART:
|
|
||||||
{
|
|
||||||
ilbmTEXTPOS *ppos;
|
|
||||||
int nbox;
|
|
||||||
BoxPtr pbox;
|
|
||||||
RegionPtr cclip;
|
|
||||||
int xpos; /* x position of char origin */
|
|
||||||
int i;
|
|
||||||
BoxRec clip;
|
|
||||||
int leftEdge, rightEdge;
|
|
||||||
int topEdge, bottomEdge;
|
|
||||||
int glyphRow; /* first row of glyph not wholly
|
|
||||||
clipped out */
|
|
||||||
int glyphCol; /* leftmost visible column of glyph */
|
|
||||||
int getWidth; /* bits to get from glyph */
|
|
||||||
|
|
||||||
if (!(ppos = (ilbmTEXTPOS *)ALLOCATE_LOCAL(nglyph *
|
|
||||||
sizeof(ilbmTEXTPOS))))
|
|
||||||
return;
|
|
||||||
|
|
||||||
pdstBase = ilbmScanlineNoBankSwitch(pdstBase, x, y, auxDst);
|
|
||||||
xpos = x;
|
|
||||||
xchar = xpos & PIM;
|
|
||||||
|
|
||||||
for (i = 0; i < nglyph; i++) {
|
|
||||||
pci = ppci[i];
|
|
||||||
|
|
||||||
ppos[i].xpos = xpos;
|
|
||||||
ppos[i].xchar = xchar;
|
|
||||||
ppos[i].leftEdge = xpos + pci->metrics.leftSideBearing;
|
|
||||||
ppos[i].rightEdge = xpos + pci->metrics.rightSideBearing;
|
|
||||||
ppos[i].topEdge = y - pci->metrics.ascent;
|
|
||||||
ppos[i].bottomEdge = y + pci->metrics.descent;
|
|
||||||
ppos[i].pdstBase = pdstBase;
|
|
||||||
ppos[i].widthGlyph = GLYPHWIDTHBYTESPADDED(pci);
|
|
||||||
|
|
||||||
xpos += pci->metrics.characterWidth;
|
|
||||||
xchar += pci->metrics.characterWidth;
|
|
||||||
if (xchar > PLST) {
|
|
||||||
xchar &= PIM;
|
|
||||||
pdstBase++;
|
|
||||||
} else if (xchar < 0) {
|
|
||||||
xchar += PPW;
|
|
||||||
pdstBase--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cclip = pGC->pCompositeClip;
|
|
||||||
pbox = REGION_RECTS(cclip);
|
|
||||||
nbox = REGION_NUM_RECTS(cclip);
|
|
||||||
|
|
||||||
/* HACK ALERT
|
|
||||||
since we continue out of the loop below so often, it
|
|
||||||
is easier to increment pbox at the top than at the end.
|
|
||||||
don't try this at home.
|
|
||||||
*/
|
|
||||||
pbox--;
|
|
||||||
while (nbox--) {
|
|
||||||
pbox++;
|
|
||||||
clip.x1 = max(bbox.x1, pbox->x1);
|
|
||||||
clip.y1 = max(bbox.y1, pbox->y1);
|
|
||||||
clip.x2 = min(bbox.x2, pbox->x2);
|
|
||||||
clip.y2 = min(bbox.y2, pbox->y2);
|
|
||||||
if ((clip.x2<=clip.x1) || (clip.y2<=clip.y1))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
for (i = 0; i < nglyph; i++) {
|
|
||||||
pci = ppci[i];
|
|
||||||
xchar = ppos[i].xchar;
|
|
||||||
|
|
||||||
/* clip the left and right edges */
|
|
||||||
if (ppos[i].leftEdge < clip.x1)
|
|
||||||
leftEdge = clip.x1;
|
|
||||||
else
|
|
||||||
leftEdge = ppos[i].leftEdge;
|
|
||||||
|
|
||||||
if (ppos[i].rightEdge > clip.x2)
|
|
||||||
rightEdge = clip.x2;
|
|
||||||
else
|
|
||||||
rightEdge = ppos[i].rightEdge;
|
|
||||||
|
|
||||||
w = rightEdge - leftEdge;
|
|
||||||
if (w <= 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* clip the top and bottom edges */
|
|
||||||
if (ppos[i].topEdge < clip.y1)
|
|
||||||
topEdge = clip.y1;
|
|
||||||
else
|
|
||||||
topEdge = ppos[i].topEdge;
|
|
||||||
|
|
||||||
if (ppos[i].bottomEdge > clip.y2)
|
|
||||||
bottomEdge = clip.y2;
|
|
||||||
else
|
|
||||||
bottomEdge = ppos[i].bottomEdge;
|
|
||||||
|
|
||||||
hSave = bottomEdge - topEdge;
|
|
||||||
if (hSave <= 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
glyphRow = (topEdge - y) + pci->metrics.ascent;
|
|
||||||
widthGlyph = ppos[i].widthGlyph;
|
|
||||||
pglyphSave = FONTGLYPHBITS(pglyphBase, pci);
|
|
||||||
pglyphSave += (glyphRow * widthGlyph);
|
|
||||||
|
|
||||||
glyphCol = (leftEdge - ppos[i].xpos) -
|
|
||||||
(pci->metrics.leftSideBearing);
|
|
||||||
getWidth = w + glyphCol;
|
|
||||||
|
|
||||||
pdstSave = ilbmScanlineDelta(ppos[i].pdstBase, -(y-topEdge),
|
|
||||||
auxDst);
|
|
||||||
xoff = xchar + (leftEdge - ppos[i].xpos);
|
|
||||||
if (xoff > PLST) {
|
|
||||||
xoff &= PIM;
|
|
||||||
pdstSave++;
|
|
||||||
} else if (xoff < 0) {
|
|
||||||
xoff += PPW;
|
|
||||||
pdstSave--;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (d = 0; d < depthDst; d++) {
|
|
||||||
h = hSave;
|
|
||||||
pdst = pdstSave;
|
|
||||||
pdstSave += widthDst; /* @@@ NEXT PLANE @@@ */
|
|
||||||
pglyph = pglyphSave;
|
|
||||||
|
|
||||||
if ((xoff + w) <= PPW) {
|
|
||||||
maskpartialbits(xoff, w, startmask);
|
|
||||||
|
|
||||||
switch (rrops[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
while (h--) {
|
|
||||||
getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
|
|
||||||
*pdst &= ~(SCRRIGHT(tmpSrc, xoff) & startmask);
|
|
||||||
pglyph += widthGlyph;
|
|
||||||
ilbmScanlineInc(pdst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
while (h--) {
|
|
||||||
getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
|
|
||||||
*pdst |= SCRRIGHT(tmpSrc, xoff) & startmask;
|
|
||||||
pglyph += widthGlyph;
|
|
||||||
ilbmScanlineInc(pdst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_NOP:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
maskPPWbits(xoff, w, startmask, endmask);
|
|
||||||
nFirst = PPW - xoff;
|
|
||||||
|
|
||||||
switch (rrops[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
while (h--) {
|
|
||||||
getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
|
|
||||||
*pdst &= ~(SCRRIGHT(tmpSrc, xoff) & startmask);
|
|
||||||
*(pdst+1) &= ~(SCRLEFT(tmpSrc, nFirst) & endmask);
|
|
||||||
pglyph += widthGlyph;
|
|
||||||
ilbmScanlineInc(pdst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
while (h--) {
|
|
||||||
getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
|
|
||||||
*pdst |= SCRRIGHT(tmpSrc, xoff) & startmask;
|
|
||||||
*(pdst+1) |= SCRLEFT(tmpSrc, nFirst) & endmask;
|
|
||||||
pglyph += widthGlyph;
|
|
||||||
ilbmScanlineInc(pdst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_NOP:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} /* depth */
|
|
||||||
} /* for each glyph */
|
|
||||||
} /* while nbox-- */
|
|
||||||
DEALLOCATE_LOCAL(ppos);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
705
ilbm/ilbmline.c
705
ilbm/ilbmline.c
@@ -1,705 +0,0 @@
|
|||||||
/* $XFree86: xc/programs/Xserver/ilbm/ilbmline.c,v 3.0 1996/08/18 01:53:58 dawes Exp $ */
|
|
||||||
/***********************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
******************************************************************/
|
|
||||||
/* $XConsortium: ilbmline.c,v 5.18 94/04/17 20:28:26 dpw Exp $ */
|
|
||||||
|
|
||||||
/* Modified jun 95 by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
|
|
||||||
to use interleaved bitplanes instead of normal bitplanes */
|
|
||||||
|
|
||||||
#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 "mistruct.h"
|
|
||||||
|
|
||||||
#include "ilbm.h"
|
|
||||||
#include "maskbits.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
|
|
||||||
ilbmSegmentSS(pDrawable, pGC, nseg, pSeg)
|
|
||||||
DrawablePtr pDrawable;
|
|
||||||
GCPtr pGC;
|
|
||||||
int nseg;
|
|
||||||
register xSegment *pSeg;
|
|
||||||
#else
|
|
||||||
ilbmLineSS(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 */
|
|
||||||
|
|
||||||
PixelType *addrlBase; /* pointer to start of drawable */
|
|
||||||
PixelType *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 depthDst;
|
|
||||||
int d;
|
|
||||||
int auxDst;
|
|
||||||
unsigned char *rrops;
|
|
||||||
|
|
||||||
/* a bunch of temporaries */
|
|
||||||
register int y1, y2;
|
|
||||||
register int x1, x2;
|
|
||||||
RegionPtr cclip;
|
|
||||||
|
|
||||||
cclip = pGC->pCompositeClip;
|
|
||||||
rrops = ((ilbmPrivGC *)(pGC->devPrivates[ilbmGCPrivateIndex].ptr))->rrops;
|
|
||||||
pboxInit = REGION_RECTS(cclip);
|
|
||||||
nboxInit = REGION_NUM_RECTS(cclip);
|
|
||||||
|
|
||||||
ilbmGetPixelWidthAuxDepthAndPointer(pDrawable, nlwidth, auxDst, depthDst,
|
|
||||||
addrlBase);
|
|
||||||
|
|
||||||
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)
|
|
||||||
ilbmVertS(addrlBase, nlwidth, auxDst, depthDst, x1, y1t,
|
|
||||||
y2t-y1t, rrops); /* @@@ NEXT PLANE PASSED @@@ */
|
|
||||||
}
|
|
||||||
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)) {
|
|
||||||
int tmp;
|
|
||||||
|
|
||||||
/* 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)
|
|
||||||
ilbmHorzS(addrlBase, nlwidth, auxDst, depthDst, x1t, y1,
|
|
||||||
x2t-x1t, rrops); /* @@@ NEXT PLANE PASSED @@@ */
|
|
||||||
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
|
|
||||||
ilbmBresS(addrlBase, nlwidth, auxDst, depthDst, signdx, signdy,
|
|
||||||
axis, x1, y1, e, e1, e2, len, rrops); /* @@@ NEXT PLANE PASSED @@@ */
|
|
||||||
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;
|
|
||||||
ilbmBresS(addrlBase, nlwidth, auxDst, depthDst, signdx,
|
|
||||||
signdy, axis, new_x1, new_y1, err, e1, e2, len,
|
|
||||||
rrops); /* @@@ NEXT PLANE PASSED @@@ */
|
|
||||||
}
|
|
||||||
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)) {
|
|
||||||
for (d = 0; d < depthDst; d++) {
|
|
||||||
addrl = ilbmScanline(addrlBase, x2, y2, auxDst);
|
|
||||||
addrlBase += nlwidth; /* @@@ NEXT PLANE @@@ */
|
|
||||||
|
|
||||||
switch (rrops[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
*addrl &= rmask[x2 & PIM];
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
*addrl |= mask[x2 & PIM];
|
|
||||||
break;
|
|
||||||
case RROP_INVERT:
|
|
||||||
*addrl ^= mask[x2 & PIM];
|
|
||||||
break;
|
|
||||||
case RROP_NOP:
|
|
||||||
break;
|
|
||||||
} /* switch */
|
|
||||||
} /* for (d = ...) */
|
|
||||||
break;
|
|
||||||
} else
|
|
||||||
pbox++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Draw dashed 1-pixel lines.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
#ifdef POLYSEGMENT
|
|
||||||
ilbmSegmentSD(pDrawable, pGC, nseg, pSeg)
|
|
||||||
DrawablePtr pDrawable;
|
|
||||||
register GCPtr pGC;
|
|
||||||
int nseg;
|
|
||||||
register xSegment *pSeg;
|
|
||||||
#else
|
|
||||||
ilbmLineSD(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 */
|
|
||||||
|
|
||||||
PixelType *addrlBase; /* address of destination pixmap */
|
|
||||||
PixelType *addrl;
|
|
||||||
int nlwidth; /* width in longwords of destination pixmap */
|
|
||||||
int auxDst;
|
|
||||||
int depthDst;
|
|
||||||
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;
|
|
||||||
unsigned char *rrops;
|
|
||||||
unsigned char bgrrops[AFB_MAX_DEPTH];
|
|
||||||
unsigned char *pDash;
|
|
||||||
int dashOffset;
|
|
||||||
int numInDashList;
|
|
||||||
int dashIndex;
|
|
||||||
int isDoubleDash;
|
|
||||||
int dashIndexTmp, dashOffsetTmp;
|
|
||||||
int unclippedlen;
|
|
||||||
int d;
|
|
||||||
|
|
||||||
cclip = pGC->pCompositeClip;
|
|
||||||
rrops = ((ilbmPrivGC *)(pGC->devPrivates[ilbmGCPrivateIndex].ptr))->rrops;
|
|
||||||
pboxInit = REGION_RECTS(cclip);
|
|
||||||
nboxInit = REGION_NUM_RECTS(cclip);
|
|
||||||
|
|
||||||
ilbmGetPixelWidthAuxDepthAndPointer(pDrawable, nlwidth, auxDst, depthDst,
|
|
||||||
addrlBase);
|
|
||||||
|
|
||||||
/* 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);
|
|
||||||
|
|
||||||
if (isDoubleDash)
|
|
||||||
ilbmReduceRop (pGC->alu, pGC->bgPixel, pGC->planemask, pGC->depth,
|
|
||||||
bgrrops);
|
|
||||||
|
|
||||||
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;
|
|
||||||
ilbmBresD(&dashIndexTmp, pDash, numInDashList, &dashOffsetTmp,
|
|
||||||
isDoubleDash, addrlBase, nlwidth, auxDst, depthDst,
|
|
||||||
signdx, signdy, axis, x1, y1, e, e1, e2, unclippedlen,
|
|
||||||
rrops, bgrrops); /* @@@ NEXT PLANE PASSED @@@ */
|
|
||||||
break;
|
|
||||||
#else
|
|
||||||
ilbmBresD(&dashIndex, pDash, numInDashList, &dashOffset,
|
|
||||||
isDoubleDash, addrlBase, nlwidth, auxDst, depthDst,
|
|
||||||
signdx, signdy, axis, x1, y1, e, e1, e2, unclippedlen,
|
|
||||||
rrops, bgrrops); /* @@@ NEXT PLANE PASSED @@@ */
|
|
||||||
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;
|
|
||||||
ilbmBresD(&dashIndexTmp, pDash, numInDashList, &dashOffsetTmp,
|
|
||||||
isDoubleDash, addrlBase, nlwidth, auxDst, depthDst,
|
|
||||||
signdx, signdy, axis, new_x1, new_y1, err, e1, e2,
|
|
||||||
len, rrops, bgrrops); /* @@@ NEXT PLANE PASSED @@@ */
|
|
||||||
}
|
|
||||||
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)) {
|
|
||||||
int rop;
|
|
||||||
|
|
||||||
for (d = 0; d < depthDst; d++) {
|
|
||||||
addrl = ilbmScanline(addrlBase, x2, y2, auxDst);
|
|
||||||
addrlBase += nlwidth; /* @@@ NEXT PLANE @@@ */
|
|
||||||
|
|
||||||
rop = rrops[d];
|
|
||||||
if (dashIndex & 1)
|
|
||||||
rop = bgrrops[d];
|
|
||||||
|
|
||||||
switch (rop) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
*addrl &= rmask[x2 & PIM];
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
*addrl |= mask[x2 & PIM];
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RROP_INVERT:
|
|
||||||
*addrl ^= mask[x2 & PIM];
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RROP_NOP:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} /* for (d = ...) */
|
|
||||||
break;
|
|
||||||
} else
|
|
||||||
pbox++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
@@ -1,99 +0,0 @@
|
|||||||
/* $XFree86$ */
|
|
||||||
/***********************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
******************************************************************/
|
|
||||||
/* $XConsortium: ilbmmisc.c,v 5.4 94/04/17 20:28:27 dpw Exp $ */
|
|
||||||
|
|
||||||
/* Modified jun 95 by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
|
|
||||||
to use interleaved bitplanes instead of normal bitplanes */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include "misc.h"
|
|
||||||
#include "cursor.h"
|
|
||||||
#include "scrnintstr.h"
|
|
||||||
|
|
||||||
#include "ilbm.h"
|
|
||||||
|
|
||||||
/*ARGSUSED*/
|
|
||||||
void
|
|
||||||
ilbmQueryBestSize(class, pwidth, pheight, pScreen)
|
|
||||||
int class;
|
|
||||||
unsigned short *pwidth;
|
|
||||||
unsigned short *pheight;
|
|
||||||
ScreenPtr pScreen;
|
|
||||||
{
|
|
||||||
unsigned width, test;
|
|
||||||
|
|
||||||
switch (class) {
|
|
||||||
case CursorShape:
|
|
||||||
if (*pwidth > pScreen->width)
|
|
||||||
*pwidth = pScreen->width;
|
|
||||||
if (*pheight > pScreen->height)
|
|
||||||
*pheight = pScreen->height;
|
|
||||||
break;
|
|
||||||
case TileShape:
|
|
||||||
case StippleShape:
|
|
||||||
width = *pwidth;
|
|
||||||
if (!width) break;
|
|
||||||
/* Return the closes power of two not less than what they gave me */
|
|
||||||
test = 0x80000000;
|
|
||||||
/* Find the highest 1 bit in the width given */
|
|
||||||
while (!(test & width))
|
|
||||||
test >>= 1;
|
|
||||||
/* If their number is greater than that, bump up to the next
|
|
||||||
* power of two */
|
|
||||||
if ((test - 1) & width)
|
|
||||||
test <<= 1;
|
|
||||||
*pwidth = test;
|
|
||||||
/* We don't care what height they use */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,295 +0,0 @@
|
|||||||
/* $XFree86$ */
|
|
||||||
/***********************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
******************************************************************/
|
|
||||||
/* $XConsortium: ilbmpixmap.c,v 5.13 94/04/17 20:28:28 dpw Exp $ */
|
|
||||||
|
|
||||||
/* pixmap management
|
|
||||||
written by drewry, september 1986
|
|
||||||
|
|
||||||
on a monchrome device, a pixmap is a bitmap.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Modified jun 95 by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
|
|
||||||
to use interleaved bitplanes instead of normal bitplanes */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/Xmd.h>
|
|
||||||
#include "scrnintstr.h"
|
|
||||||
#include "pixmapstr.h"
|
|
||||||
#include "maskbits.h"
|
|
||||||
|
|
||||||
#include "ilbm.h"
|
|
||||||
#include "mi.h"
|
|
||||||
|
|
||||||
#include "servermd.h"
|
|
||||||
|
|
||||||
PixmapPtr
|
|
||||||
ilbmCreatePixmap(pScreen, width, height, depth)
|
|
||||||
ScreenPtr pScreen;
|
|
||||||
int width;
|
|
||||||
int height;
|
|
||||||
int depth;
|
|
||||||
{
|
|
||||||
PixmapPtr pPixmap;
|
|
||||||
size_t datasize;
|
|
||||||
size_t paddedWidth;
|
|
||||||
|
|
||||||
paddedWidth = BitmapBytePad(width);
|
|
||||||
if (paddedWidth > 32767 || height > 32767 || depth > 4)
|
|
||||||
return NullPixmap;
|
|
||||||
datasize = height * paddedWidth * depth;
|
|
||||||
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 = 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;
|
|
||||||
#ifdef PIXPRIV
|
|
||||||
pPixmap->devPrivate.ptr = datasize ?
|
|
||||||
(pointer)((char *)pPixmap + pScreen->totalPixmapSize) : NULL;
|
|
||||||
#else
|
|
||||||
pPixmap->devPrivate.ptr = (pointer)(pPixmap + 1);
|
|
||||||
#endif
|
|
||||||
return(pPixmap);
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool
|
|
||||||
ilbmDestroyPixmap(pPixmap)
|
|
||||||
PixmapPtr pPixmap;
|
|
||||||
{
|
|
||||||
if (--pPixmap->refcnt)
|
|
||||||
return(TRUE);
|
|
||||||
xfree(pPixmap);
|
|
||||||
return(TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
PixmapPtr
|
|
||||||
ilbmCopyPixmap(pSrc)
|
|
||||||
register PixmapPtr pSrc;
|
|
||||||
{
|
|
||||||
register PixmapPtr pDst;
|
|
||||||
int size;
|
|
||||||
ScreenPtr pScreen;
|
|
||||||
|
|
||||||
size = pSrc->drawable.height * pSrc->devKind * pSrc->drawable.depth;
|
|
||||||
pScreen = pSrc->drawable.pScreen;
|
|
||||||
pDst = (*pScreen->CreatePixmap)(pScreen, pSrc->drawable.width,
|
|
||||||
pSrc->drawable.height, pSrc->drawable.depth);
|
|
||||||
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
|
|
||||||
XRotatePixmap 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
|
|
||||||
ilbmPadPixmap(pPixmap)
|
|
||||||
PixmapPtr pPixmap;
|
|
||||||
{
|
|
||||||
register int width = pPixmap->drawable.width;
|
|
||||||
register int h;
|
|
||||||
register PixelType mask;
|
|
||||||
register PixelType *p;
|
|
||||||
register PixelType bits; /* real pattern bits */
|
|
||||||
register int i;
|
|
||||||
int d;
|
|
||||||
int rep; /* repeat count for pattern */
|
|
||||||
|
|
||||||
if (width >= PPW)
|
|
||||||
return;
|
|
||||||
|
|
||||||
rep = PPW/width;
|
|
||||||
if (rep*width != PPW)
|
|
||||||
return;
|
|
||||||
|
|
||||||
mask = endtab[width];
|
|
||||||
|
|
||||||
p = (PixelType *)(pPixmap->devPrivate.ptr);
|
|
||||||
|
|
||||||
for (d = 0; d < pPixmap->drawable.depth; d++) {
|
|
||||||
for (h = 0; h < pPixmap->drawable.height; h++) {
|
|
||||||
*p &= mask;
|
|
||||||
bits = *p;
|
|
||||||
for (i = 1; i < rep; i++) {
|
|
||||||
bits = SCRRIGHT(bits, width);
|
|
||||||
*p |= bits;
|
|
||||||
}
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pPixmap->drawable.width = PPW;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Rotates pixmap pPix by w pixels to the right on the screen. Assumes that
|
|
||||||
* words are PPW bits wide, and that the least significant bit appears on the
|
|
||||||
* left.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
ilbmXRotatePixmap(pPix, rw)
|
|
||||||
PixmapPtr pPix;
|
|
||||||
register int rw;
|
|
||||||
{
|
|
||||||
register PixelType *pw, *pwFinal;
|
|
||||||
register PixelType t;
|
|
||||||
|
|
||||||
if (pPix == NullPixmap)
|
|
||||||
return;
|
|
||||||
|
|
||||||
pw = (PixelType *)pPix->devPrivate.ptr;
|
|
||||||
rw %= (int)pPix->drawable.width;
|
|
||||||
if (rw < 0)
|
|
||||||
rw += (int)pPix->drawable.width;
|
|
||||||
if (pPix->drawable.width == PPW) {
|
|
||||||
pwFinal = pw + pPix->drawable.height * pPix->drawable.depth;
|
|
||||||
while (pw < pwFinal) {
|
|
||||||
t = *pw;
|
|
||||||
*pw++ = SCRRIGHT(t, rw) | (SCRLEFT(t, (PPW-rw)) & endtab[rw]);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* We no longer do this. Validate doesn't try to rotate odd-size
|
|
||||||
* tiles or stipples. ilbmUnnatural<tile/stipple>FS works directly off
|
|
||||||
* the unrotate tile/stipple in the GC
|
|
||||||
*/
|
|
||||||
ErrorF("X internal error: trying to rotate odd-sized pixmap.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Rotates pixmap pPix by h lines. Assumes that h is always less than
|
|
||||||
pPix->height
|
|
||||||
works on any width.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
ilbmYRotatePixmap(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 height;
|
|
||||||
int aux;
|
|
||||||
|
|
||||||
if (pPix == NullPixmap)
|
|
||||||
return;
|
|
||||||
height = (int) pPix->drawable.height;
|
|
||||||
rh %= height;
|
|
||||||
if (rh < 0)
|
|
||||||
rh += height;
|
|
||||||
|
|
||||||
aux = pPix->devKind*pPix->drawable.depth;
|
|
||||||
nbyDown = rh*aux;
|
|
||||||
nbyUp = height*aux-nbyDown;
|
|
||||||
|
|
||||||
if (!(ptmp = (char *)ALLOCATE_LOCAL(nbyUp)))
|
|
||||||
return;
|
|
||||||
|
|
||||||
pbase = (char *)pPix->devPrivate.ptr;
|
|
||||||
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 rh */
|
|
||||||
DEALLOCATE_LOCAL(ptmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ilbmCopyRotatePixmap(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) &&
|
|
||||||
(pdstPix->drawable.depth == psrcPix->drawable.depth)) {
|
|
||||||
memmove((char *)pdstPix->devPrivate.ptr, (char *)psrcPix->devPrivate.ptr,
|
|
||||||
psrcPix->drawable.height * psrcPix->devKind *
|
|
||||||
psrcPix->drawable.depth);
|
|
||||||
pdstPix->drawable.width = psrcPix->drawable.width;
|
|
||||||
pdstPix->drawable.serialNumber = NEXT_SERIAL_NUMBER;
|
|
||||||
} else {
|
|
||||||
if (pdstPix)
|
|
||||||
/* FIX XBUG 6168 */
|
|
||||||
(*pdstPix->drawable.pScreen->DestroyPixmap)(pdstPix);
|
|
||||||
*ppdstPix = pdstPix = ilbmCopyPixmap(psrcPix);
|
|
||||||
if (!pdstPix)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ilbmPadPixmap(pdstPix);
|
|
||||||
if (xrot)
|
|
||||||
ilbmXRotatePixmap(pdstPix, xrot);
|
|
||||||
if (yrot)
|
|
||||||
ilbmYRotatePixmap(pdstPix, yrot);
|
|
||||||
}
|
|
||||||
@@ -1,303 +0,0 @@
|
|||||||
/* $XFree86: xc/programs/Xserver/ilbm/ilbmply1rct.c,v 3.0 1996/08/18 01:54:02 dawes Exp $ */
|
|
||||||
/*
|
|
||||||
* $XConsortium: ilbmply1rct.c,v 1.9 94/04/17 20:28:28 dpw Exp $
|
|
||||||
*
|
|
||||||
Copyright (c) 1990 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
*
|
|
||||||
* Author: Keith Packard, MIT X Consortium
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Modified jun 95 by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
|
|
||||||
to use interleaved bitplanes instead of normal bitplanes */
|
|
||||||
|
|
||||||
#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 "mistruct.h"
|
|
||||||
|
|
||||||
#include "ilbm.h"
|
|
||||||
#include "maskbits.h"
|
|
||||||
|
|
||||||
#if defined(mips) || defined(sparc)
|
|
||||||
#define GetHighWord(x) (((int)(x)) >> 16)
|
|
||||||
#else
|
|
||||||
#define GetHighWord(x) (((int)(x)) / 65536)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if IMAGE_BYTE_ORDER == MSBFirst
|
|
||||||
#define intToCoord(i,x,y) (((x) = GetHighWord(i)), ((y) = (int)((short) (i))))
|
|
||||||
#define coordToInt(x,y) (((x) << 16) | (y))
|
|
||||||
#define intToX(i) (GetHighWord(i))
|
|
||||||
#define intToY(i) ((int)((short) i))
|
|
||||||
#else
|
|
||||||
#define intToCoord(i,x,y) (((x) = (int)((short) (i))), ((y) = GetHighWord(i)))
|
|
||||||
#define coordToInt(x,y) (((y) << 16) | (x))
|
|
||||||
#define intToX(i) ((int)((short) (i)))
|
|
||||||
#define intToY(i) (GetHighWord(i))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
|
||||||
ilbmFillPolygonSolid (pDrawable, pGC, shape, mode, count, ptsIn)
|
|
||||||
DrawablePtr pDrawable;
|
|
||||||
GCPtr pGC;
|
|
||||||
int shape;
|
|
||||||
int mode;
|
|
||||||
int count;
|
|
||||||
DDXPointPtr ptsIn;
|
|
||||||
{
|
|
||||||
ilbmPrivGCPtr devPriv;
|
|
||||||
int nlwidth;
|
|
||||||
PixelType *addrl, *addr;
|
|
||||||
int maxy;
|
|
||||||
int origin;
|
|
||||||
register int vertex1, vertex2;
|
|
||||||
int c;
|
|
||||||
BoxPtr extents;
|
|
||||||
int clip;
|
|
||||||
int y;
|
|
||||||
int *vertex1p, *vertex2p;
|
|
||||||
int *endp;
|
|
||||||
int x1, x2;
|
|
||||||
int dx1, dx2;
|
|
||||||
int dy1, dy2;
|
|
||||||
int e1, e2;
|
|
||||||
int step1, step2;
|
|
||||||
int sign1, sign2;
|
|
||||||
int h;
|
|
||||||
int l, r;
|
|
||||||
PixelType mask, bits = ~((PixelType)0);
|
|
||||||
int nmiddle;
|
|
||||||
register unsigned char *rrops;
|
|
||||||
register int n;
|
|
||||||
register int d;
|
|
||||||
int auxDst;
|
|
||||||
int depthDst;
|
|
||||||
register PixelType *pdst;
|
|
||||||
|
|
||||||
devPriv = (ilbmPrivGC *)(pGC->devPrivates[ilbmGCPrivateIndex].ptr);
|
|
||||||
|
|
||||||
if (mode == CoordModePrevious || shape != Convex ||
|
|
||||||
REGION_NUM_RECTS(pGC->pCompositeClip) != 1) {
|
|
||||||
miFillPolygon (pDrawable, pGC, shape, mode, count, ptsIn);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
origin = *((int *) &pDrawable->x);
|
|
||||||
origin -= (origin & 0x8000) << 1;
|
|
||||||
extents = &pGC->pCompositeClip->extents;
|
|
||||||
vertex1 = *((int *) &extents->x1) - origin;
|
|
||||||
vertex2 = *((int *) &extents->x2) - origin - 0x00010001;
|
|
||||||
clip = 0;
|
|
||||||
y = 32767;
|
|
||||||
maxy = 0;
|
|
||||||
vertex2p = (int *) ptsIn;
|
|
||||||
endp = vertex2p + count;
|
|
||||||
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 (y == maxy)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (clip & 0x80008000) {
|
|
||||||
miFillPolygon (pDrawable, pGC, shape, mode, vertex2p - (int *) ptsIn, ptsIn);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ilbmGetPixelWidthAuxDepthAndPointer(pDrawable, nlwidth, auxDst, depthDst,
|
|
||||||
addrl);
|
|
||||||
rrops = devPriv->rrops;
|
|
||||||
addrl = ilbmScanlineDelta(addrl, y + pDrawable->y, auxDst);
|
|
||||||
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;
|
|
||||||
r = x2;
|
|
||||||
nmiddle = x2 - x1;
|
|
||||||
if (nmiddle < 0) {
|
|
||||||
nmiddle = -nmiddle;
|
|
||||||
l = x2;
|
|
||||||
r = x1;
|
|
||||||
}
|
|
||||||
c = l & PIM;
|
|
||||||
l -= c;
|
|
||||||
l = l >> PWSH;
|
|
||||||
addr = addrl + l;
|
|
||||||
if (c + nmiddle < PPW) {
|
|
||||||
mask = SCRRIGHT (bits,c) ^ SCRRIGHT (bits,c+nmiddle);
|
|
||||||
for (pdst = addr, d = 0; d < depthDst; d++, pdst += nlwidth) { /* @@@ NEXT PLANE @@@ */
|
|
||||||
switch (rrops[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
*pdst &= ~mask;
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
*pdst |= mask;
|
|
||||||
break;
|
|
||||||
case RROP_INVERT:
|
|
||||||
*pdst ^= mask;
|
|
||||||
break;
|
|
||||||
case RROP_NOP:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (c) {
|
|
||||||
mask = SCRRIGHT(bits, c);
|
|
||||||
for (pdst = addr, d = 0; d < depthDst; d++, pdst += nlwidth) { /* @@@ NEXT PLANE @@@ */
|
|
||||||
switch (rrops[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
*pdst &= ~mask;
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
*pdst |= mask;
|
|
||||||
break;
|
|
||||||
case RROP_INVERT:
|
|
||||||
*pdst ^= mask;
|
|
||||||
break;
|
|
||||||
case RROP_NOP:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
nmiddle += c - PPW;
|
|
||||||
addr++;
|
|
||||||
}
|
|
||||||
nmiddle >>= PWSH;
|
|
||||||
mask = ~SCRRIGHT(bits, r & PIM);
|
|
||||||
|
|
||||||
for (d = 0; d < depthDst; d++, addr += nlwidth) { /* @@@ NEXT PLANE @@@ */
|
|
||||||
n = nmiddle;
|
|
||||||
pdst = addr;
|
|
||||||
|
|
||||||
switch (rrops[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
Duff (n, *pdst++ = 0;)
|
|
||||||
if (mask)
|
|
||||||
*pdst &= ~mask;
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
Duff (n, *pdst++ = ~0;);
|
|
||||||
if (mask)
|
|
||||||
*pdst |= mask;
|
|
||||||
break;
|
|
||||||
case RROP_INVERT:
|
|
||||||
Duff (n, *pdst++ ^= ~0;);
|
|
||||||
if (mask)
|
|
||||||
*pdst ^= mask;
|
|
||||||
break;
|
|
||||||
case RROP_NOP:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!--h)
|
|
||||||
break;
|
|
||||||
ilbmScanlineInc(addrl, auxDst);
|
|
||||||
Step(x1,dx1,dy1,e1,sign1,step1)
|
|
||||||
Step(x2,dx2,dy2,e2,sign2,step2)
|
|
||||||
}
|
|
||||||
if (y == maxy)
|
|
||||||
break;
|
|
||||||
ilbmScanlineInc(addrl, auxDst);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,469 +0,0 @@
|
|||||||
/* $XFree86: xc/programs/Xserver/ilbm/ilbmplygblt.c,v 3.0 1996/08/18 01:54:03 dawes Exp $ */
|
|
||||||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
|
||||||
/***********************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
******************************************************************/
|
|
||||||
/* $XConsortium: ilbmimggblt.c,v 5.17 94/04/17 20:28:25 dpw Exp $ */
|
|
||||||
|
|
||||||
/* Modified jun 95 by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
|
|
||||||
to use interleaved bitplanes instead of normal bitplanes */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include <X11/Xmd.h>
|
|
||||||
#include <X11/Xproto.h>
|
|
||||||
#include "ilbm.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 "maskbits.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
this works for fonts with glyphs <= 32 bits wide.
|
|
||||||
|
|
||||||
the clipping calculations are done for worst-case fonts.
|
|
||||||
we make no assumptions about the heights, widths, or bearings
|
|
||||||
of the glyphs. if we knew that the glyphs are all the same height,
|
|
||||||
we could clip the tops and bottoms per clipping box, rather
|
|
||||||
than per character per clipping box. if we knew that the glyphs'
|
|
||||||
left and right bearings were wlle-behaved, we could clip a single
|
|
||||||
character at the start, output until the last unclipped
|
|
||||||
character, and then clip the last one. this is all straightforward
|
|
||||||
to determine based on max-bounds and min-bounds from the font.
|
|
||||||
there is some inefficiency introduced in the per-character
|
|
||||||
clipping to make what's going on clearer.
|
|
||||||
|
|
||||||
(it is possible, for example, for a font to be defined in which the
|
|
||||||
next-to-last character in a font would be clipped out, but the last
|
|
||||||
one wouldn't. the code below deals with this.)
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
ilbmPolyGlyphBlt (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 */
|
|
||||||
{
|
|
||||||
ExtentInfoRec info; /* used by QueryGlyphExtents() */
|
|
||||||
BoxRec bbox; /* string's bounding box */
|
|
||||||
xRectangle backrect; /* backing rectangle to paint.
|
|
||||||
in the general case, NOT necessarily
|
|
||||||
the same as the string's bounding box
|
|
||||||
*/
|
|
||||||
|
|
||||||
CharInfoPtr pci;
|
|
||||||
int xorg, yorg; /* origin of drawable in bitmap */
|
|
||||||
int widthDst; /* width of dst in longwords */
|
|
||||||
|
|
||||||
/* these keep track of the character origin */
|
|
||||||
PixelType *pdstBase;
|
|
||||||
/* points to longword with character origin */
|
|
||||||
int xchar; /* xorigin of char (mod 32) */
|
|
||||||
|
|
||||||
/* these are used for placing the glyph */
|
|
||||||
register int xoff; /* x offset of left edge of glyph (mod 32) */
|
|
||||||
register PixelType *pdst; /* pointer to current longword in dst */
|
|
||||||
|
|
||||||
register int d;
|
|
||||||
int depthDst;
|
|
||||||
int auxDst;
|
|
||||||
int hSave;
|
|
||||||
int w; /* width of glyph in bits */
|
|
||||||
int h; /* height of glyph */
|
|
||||||
int widthGlyph; /* width of glyph, in bytes */
|
|
||||||
unsigned char *rrops;
|
|
||||||
register unsigned char *pglyph;
|
|
||||||
/* pointer to current row of glyph */
|
|
||||||
unsigned char *pglyphSave;
|
|
||||||
|
|
||||||
/* used for putting down glyph */
|
|
||||||
register PixelType tmpSrc;
|
|
||||||
/* for getting bits from glyph */
|
|
||||||
register PixelType startmask;
|
|
||||||
register PixelType endmask;
|
|
||||||
|
|
||||||
register int nFirst; /* bits of glyph in current longword */
|
|
||||||
PixelType *pdstSave;
|
|
||||||
|
|
||||||
xorg = pDrawable->x;
|
|
||||||
yorg = pDrawable->y;
|
|
||||||
ilbmGetPixelWidthAuxDepthAndPointer(pDrawable, widthDst, auxDst, depthDst,
|
|
||||||
pdstBase);
|
|
||||||
|
|
||||||
QueryGlyphExtents(pGC->font, ppci, (unsigned long)nglyph, &info);
|
|
||||||
|
|
||||||
x += xorg;
|
|
||||||
y += yorg;
|
|
||||||
|
|
||||||
bbox.x1 = x + info.overallLeft;
|
|
||||||
bbox.x2 = x + info.overallRight;
|
|
||||||
bbox.y1 = y - info.overallAscent;
|
|
||||||
bbox.y2 = y + info.overallDescent;
|
|
||||||
|
|
||||||
rrops = ((ilbmPrivGCPtr) pGC->devPrivates[ilbmGCPrivateIndex].ptr)->rrops;
|
|
||||||
|
|
||||||
switch (RECT_IN_REGION(pGC->pScreen, pGC->pCompositeClip, &bbox)) {
|
|
||||||
case rgnOUT:
|
|
||||||
break;
|
|
||||||
case rgnIN:
|
|
||||||
pdstBase = ilbmScanlineNoBankSwitch(pdstBase, x, y, auxDst);
|
|
||||||
xchar = x & PIM;
|
|
||||||
|
|
||||||
while (nglyph--) {
|
|
||||||
pci = *ppci;
|
|
||||||
pglyphSave = FONTGLYPHBITS(pglyphBase, pci);
|
|
||||||
w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing;
|
|
||||||
hSave = pci->metrics.ascent + pci->metrics.descent;
|
|
||||||
widthGlyph = GLYPHWIDTHBYTESPADDED(pci);
|
|
||||||
/* start at top scanline of glyph */
|
|
||||||
pdstSave = ilbmScanlineDelta(pdstBase, -pci->metrics.ascent,
|
|
||||||
auxDst);
|
|
||||||
|
|
||||||
/* find correct word in scanline and x offset within it
|
|
||||||
for left edge of glyph
|
|
||||||
*/
|
|
||||||
xoff = xchar + pci->metrics.leftSideBearing;
|
|
||||||
if (xoff > PLST) {
|
|
||||||
pdstSave++;
|
|
||||||
xoff &= PIM;
|
|
||||||
} else if (xoff < 0) {
|
|
||||||
xoff += PPW;
|
|
||||||
pdstSave--;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (d = 0; d < depthDst; d++) {
|
|
||||||
h = hSave;
|
|
||||||
pdst = pdstSave;
|
|
||||||
pdstSave += widthDst; /* @@@ NEXT PLANE @@@ */
|
|
||||||
pglyph = pglyphSave;
|
|
||||||
|
|
||||||
if ((xoff + w) <= PPW) {
|
|
||||||
/* glyph all in one longword */
|
|
||||||
maskpartialbits(xoff, w, startmask);
|
|
||||||
switch (rrops[d]) {
|
|
||||||
case RROP_WHITE:
|
|
||||||
while (h--) {
|
|
||||||
getleftbits(pglyph, w, tmpSrc);
|
|
||||||
*pdst |= (SCRRIGHT(tmpSrc, xoff) & startmask);
|
|
||||||
pglyph += widthGlyph;
|
|
||||||
ilbmScanlineInc(pdst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_BLACK:
|
|
||||||
while (h--) {
|
|
||||||
getleftbits(pglyph, w, tmpSrc);
|
|
||||||
*pdst &= ~(SCRRIGHT(tmpSrc, xoff) & startmask);
|
|
||||||
pglyph += widthGlyph;
|
|
||||||
ilbmScanlineInc(pdst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_INVERT:
|
|
||||||
while (h--) {
|
|
||||||
getleftbits(pglyph, w, tmpSrc);
|
|
||||||
*pdst ^= (SCRRIGHT(tmpSrc, xoff) & startmask);
|
|
||||||
pglyph += widthGlyph;
|
|
||||||
ilbmScanlineInc(pdst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* glyph crosses longword boundary */
|
|
||||||
maskPPWbits(xoff, w, startmask, endmask);
|
|
||||||
nFirst = PPW - xoff;
|
|
||||||
switch (rrops[d]) {
|
|
||||||
case RROP_WHITE:
|
|
||||||
while (h--) {
|
|
||||||
getleftbits(pglyph, w, tmpSrc);
|
|
||||||
*pdst |= (SCRRIGHT(tmpSrc, xoff) & startmask);
|
|
||||||
*(pdst+1) |= (SCRLEFT(tmpSrc, nFirst) & endmask);
|
|
||||||
pglyph += widthGlyph;
|
|
||||||
ilbmScanlineInc(pdst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_BLACK:
|
|
||||||
while (h--) {
|
|
||||||
getleftbits(pglyph, w, tmpSrc);
|
|
||||||
*pdst &= ~(SCRRIGHT(tmpSrc, xoff) & startmask);
|
|
||||||
*(pdst+1) &= ~(SCRLEFT(tmpSrc, nFirst) & endmask);
|
|
||||||
pglyph += widthGlyph;
|
|
||||||
ilbmScanlineInc(pdst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_INVERT:
|
|
||||||
while (h--) {
|
|
||||||
getleftbits(pglyph, w, tmpSrc);
|
|
||||||
*pdst ^= (SCRRIGHT(tmpSrc, xoff) & startmask);
|
|
||||||
*(pdst+1) ^= (SCRLEFT(tmpSrc, nFirst) & endmask);
|
|
||||||
pglyph += widthGlyph;
|
|
||||||
ilbmScanlineInc(pdst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} /* glyph crosses longwords boundary */
|
|
||||||
} /* depth loop */
|
|
||||||
/* update character origin */
|
|
||||||
x += pci->metrics.characterWidth;
|
|
||||||
xchar += pci->metrics.characterWidth;
|
|
||||||
if (xchar > PLST) {
|
|
||||||
xchar -= PPW;
|
|
||||||
pdstBase++;
|
|
||||||
} else if (xchar < 0) {
|
|
||||||
xchar += PPW;
|
|
||||||
pdstBase--;
|
|
||||||
}
|
|
||||||
ppci++;
|
|
||||||
} /* while nglyph-- */
|
|
||||||
break;
|
|
||||||
case rgnPART:
|
|
||||||
{
|
|
||||||
ilbmTEXTPOS *ppos;
|
|
||||||
int nbox;
|
|
||||||
BoxPtr pbox;
|
|
||||||
RegionPtr cclip;
|
|
||||||
int xpos; /* x position of char origin */
|
|
||||||
int i;
|
|
||||||
BoxRec clip;
|
|
||||||
int leftEdge, rightEdge;
|
|
||||||
int topEdge, bottomEdge;
|
|
||||||
int glyphRow; /* first row of glyph not wholly
|
|
||||||
clipped out */
|
|
||||||
int glyphCol; /* leftmost visible column of glyph */
|
|
||||||
int getWidth; /* bits to get from glyph */
|
|
||||||
|
|
||||||
if (!(ppos = (ilbmTEXTPOS *)ALLOCATE_LOCAL(nglyph *
|
|
||||||
sizeof(ilbmTEXTPOS))))
|
|
||||||
return;
|
|
||||||
|
|
||||||
pdstBase = ilbmScanlineNoBankSwitch(pdstBase, x, y, auxDst);
|
|
||||||
xpos = x;
|
|
||||||
xchar = xpos & PIM;
|
|
||||||
|
|
||||||
for (i = 0; i < nglyph; i++) {
|
|
||||||
pci = ppci[i];
|
|
||||||
|
|
||||||
ppos[i].xpos = xpos;
|
|
||||||
ppos[i].xchar = xchar;
|
|
||||||
ppos[i].leftEdge = xpos + pci->metrics.leftSideBearing;
|
|
||||||
ppos[i].rightEdge = xpos + pci->metrics.rightSideBearing;
|
|
||||||
ppos[i].topEdge = y - pci->metrics.ascent;
|
|
||||||
ppos[i].bottomEdge = y + pci->metrics.descent;
|
|
||||||
ppos[i].pdstBase = pdstBase;
|
|
||||||
ppos[i].widthGlyph = GLYPHWIDTHBYTESPADDED(pci);
|
|
||||||
|
|
||||||
xpos += pci->metrics.characterWidth;
|
|
||||||
xchar += pci->metrics.characterWidth;
|
|
||||||
if (xchar > PLST) {
|
|
||||||
xchar &= PIM;
|
|
||||||
pdstBase++;
|
|
||||||
} else if (xchar < 0) {
|
|
||||||
xchar += PPW;
|
|
||||||
pdstBase--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cclip = pGC->pCompositeClip;
|
|
||||||
pbox = REGION_RECTS(cclip);
|
|
||||||
nbox = REGION_NUM_RECTS(cclip);
|
|
||||||
|
|
||||||
/* HACK ALERT
|
|
||||||
since we continue out of the loop below so often, it
|
|
||||||
is easier to increment pbox at the top than at the end.
|
|
||||||
don't try this at home.
|
|
||||||
*/
|
|
||||||
pbox--;
|
|
||||||
while (nbox--) {
|
|
||||||
pbox++;
|
|
||||||
clip.x1 = max(bbox.x1, pbox->x1);
|
|
||||||
clip.y1 = max(bbox.y1, pbox->y1);
|
|
||||||
clip.x2 = min(bbox.x2, pbox->x2);
|
|
||||||
clip.y2 = min(bbox.y2, pbox->y2);
|
|
||||||
if ((clip.x2<=clip.x1) || (clip.y2<=clip.y1))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
for (i = 0; i<nglyph; i++) {
|
|
||||||
pci = ppci[i];
|
|
||||||
xchar = ppos[i].xchar;
|
|
||||||
|
|
||||||
/* clip the left and right edges */
|
|
||||||
if (ppos[i].leftEdge < clip.x1)
|
|
||||||
leftEdge = clip.x1;
|
|
||||||
else
|
|
||||||
leftEdge = ppos[i].leftEdge;
|
|
||||||
|
|
||||||
if (ppos[i].rightEdge > clip.x2)
|
|
||||||
rightEdge = clip.x2;
|
|
||||||
else
|
|
||||||
rightEdge = ppos[i].rightEdge;
|
|
||||||
|
|
||||||
w = rightEdge - leftEdge;
|
|
||||||
if (w <= 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* clip the top and bottom edges */
|
|
||||||
if (ppos[i].topEdge < clip.y1)
|
|
||||||
topEdge = clip.y1;
|
|
||||||
else
|
|
||||||
topEdge = ppos[i].topEdge;
|
|
||||||
|
|
||||||
if (ppos[i].bottomEdge > clip.y2)
|
|
||||||
bottomEdge = clip.y2;
|
|
||||||
else
|
|
||||||
bottomEdge = ppos[i].bottomEdge;
|
|
||||||
|
|
||||||
hSave = bottomEdge - topEdge;
|
|
||||||
if (hSave <= 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
glyphRow = (topEdge - y) + pci->metrics.ascent;
|
|
||||||
widthGlyph = ppos[i].widthGlyph;
|
|
||||||
pglyphSave = FONTGLYPHBITS(pglyphBase, pci);
|
|
||||||
pglyphSave += (glyphRow * widthGlyph);
|
|
||||||
|
|
||||||
glyphCol = (leftEdge - ppos[i].xpos) -
|
|
||||||
(pci->metrics.leftSideBearing);
|
|
||||||
getWidth = w + glyphCol;
|
|
||||||
|
|
||||||
pdstSave = ilbmScanlineDelta(ppos[i].pdstBase, -(y-topEdge),
|
|
||||||
auxDst);
|
|
||||||
xoff = xchar + (leftEdge - ppos[i].xpos);
|
|
||||||
if (xoff > PLST) {
|
|
||||||
xoff &= PIM;
|
|
||||||
pdstSave++;
|
|
||||||
} else if (xoff < 0) {
|
|
||||||
xoff += PPW;
|
|
||||||
pdstSave--;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (d = 0; d < depthDst; d++) {
|
|
||||||
h = hSave;
|
|
||||||
pdst = pdstSave;
|
|
||||||
pdstSave += widthDst; /* @@@ NEXT PLANE @@@ */
|
|
||||||
pglyph = pglyphSave;
|
|
||||||
|
|
||||||
if ((xoff + w) <= PPW) {
|
|
||||||
maskpartialbits(xoff, w, startmask);
|
|
||||||
switch (rrops[d]) {
|
|
||||||
case RROP_WHITE:
|
|
||||||
while (h--) {
|
|
||||||
getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
|
|
||||||
*pdst |= (SCRRIGHT(tmpSrc, xoff) & startmask);
|
|
||||||
pglyph += widthGlyph;
|
|
||||||
ilbmScanlineInc(pdst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_BLACK:
|
|
||||||
while (h--) {
|
|
||||||
getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
|
|
||||||
*pdst &= ~(SCRRIGHT(tmpSrc, xoff) & startmask);
|
|
||||||
pglyph += widthGlyph;
|
|
||||||
ilbmScanlineInc(pdst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_INVERT:
|
|
||||||
while (h--) {
|
|
||||||
getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
|
|
||||||
*pdst ^= (SCRRIGHT(tmpSrc, xoff) & startmask);
|
|
||||||
pglyph += widthGlyph;
|
|
||||||
ilbmScanlineInc(pdst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
maskPPWbits(xoff, w, startmask, endmask);
|
|
||||||
nFirst = PPW - xoff;
|
|
||||||
switch (rrops[d]) {
|
|
||||||
case RROP_WHITE:
|
|
||||||
while (h--) {
|
|
||||||
getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
|
|
||||||
*pdst |= (SCRRIGHT(tmpSrc, xoff) & startmask);
|
|
||||||
*(pdst+1) |= (SCRLEFT(tmpSrc, nFirst) & endmask);
|
|
||||||
pglyph += widthGlyph;
|
|
||||||
ilbmScanlineInc(pdst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_BLACK:
|
|
||||||
while (h--) {
|
|
||||||
getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
|
|
||||||
*pdst &= ~(SCRRIGHT(tmpSrc, xoff) & startmask);
|
|
||||||
*(pdst+1) &= ~(SCRLEFT(tmpSrc, nFirst) & endmask);
|
|
||||||
pglyph += widthGlyph;
|
|
||||||
ilbmScanlineInc(pdst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_INVERT:
|
|
||||||
while (h--) {
|
|
||||||
getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
|
|
||||||
*pdst ^= (SCRRIGHT(tmpSrc, xoff) & startmask);
|
|
||||||
*(pdst+1) ^= (SCRLEFT(tmpSrc, nFirst) & endmask);
|
|
||||||
pglyph += widthGlyph;
|
|
||||||
ilbmScanlineInc(pdst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} /* depth */
|
|
||||||
} /* for each glyph */
|
|
||||||
} /* while nbox-- */
|
|
||||||
DEALLOCATE_LOCAL(ppos);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,656 +0,0 @@
|
|||||||
/* $XFree86$ */
|
|
||||||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
|
||||||
/***********************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
******************************************************************/
|
|
||||||
/* $XConsortium: ilbmpntarea.c,v 5.7 94/04/17 20:28:29 dpw Exp $ */
|
|
||||||
|
|
||||||
/* Modified jun 95 by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
|
|
||||||
to use interleaved bitplanes instead of normal bitplanes */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
|
|
||||||
#include "windowstr.h"
|
|
||||||
#include "regionstr.h"
|
|
||||||
#include "pixmapstr.h"
|
|
||||||
#include "scrnintstr.h"
|
|
||||||
|
|
||||||
#include "ilbm.h"
|
|
||||||
#include "maskbits.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
the solid fillers are called for rectangles and window backgrounds.
|
|
||||||
the boxes are already translated.
|
|
||||||
maybe this should always take a pixmap instead of a drawable?
|
|
||||||
|
|
||||||
NOTE:
|
|
||||||
iy = ++iy < tileHeight ? iy : 0
|
|
||||||
is equivalent to iy%= tileheight, and saves a division.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*ARGSUSED*/
|
|
||||||
void
|
|
||||||
ilbmSolidFillArea(pDraw, nbox, pbox, rrops)
|
|
||||||
DrawablePtr pDraw;
|
|
||||||
int nbox;
|
|
||||||
BoxPtr pbox;
|
|
||||||
register unsigned char *rrops;
|
|
||||||
{
|
|
||||||
int nlwidth; /* width in longwords of the drawable */
|
|
||||||
int w; /* width of current box */
|
|
||||||
register int h; /* height of current box */
|
|
||||||
register PixelType *p; /* pointer to bits we're writing */
|
|
||||||
register int nlw; /* loop version of nlwMiddle */
|
|
||||||
register PixelType startmask;
|
|
||||||
register PixelType endmask;
|
|
||||||
/* masks for reggedy bits at either end of line */
|
|
||||||
register int nlwExtra; /* to get from right of box to left of next span */
|
|
||||||
int nlwMiddle; /* number of longwords between sides of boxes */
|
|
||||||
PixelType *pbits; /* pointer to start of drawable */
|
|
||||||
PixelType *saveP;
|
|
||||||
int saveH;
|
|
||||||
int depthDst;
|
|
||||||
int auxDst;
|
|
||||||
register int d;
|
|
||||||
|
|
||||||
ilbmGetPixelWidthAuxDepthAndPointer(pDraw, nlwidth, auxDst, depthDst, pbits);
|
|
||||||
|
|
||||||
while (nbox--) {
|
|
||||||
w = pbox->x2 - pbox->x1;
|
|
||||||
saveH = pbox->y2 - pbox->y1;
|
|
||||||
|
|
||||||
saveP = ilbmScanline(pbits, pbox->x1, pbox->y1, auxDst);
|
|
||||||
|
|
||||||
if ( ((pbox->x1 & PIM) + w) < PPW) {
|
|
||||||
for (d = 0; d < depthDst; d++) {
|
|
||||||
h = saveH;
|
|
||||||
p = saveP;
|
|
||||||
saveP += nlwidth; /* @@@ NEXT PLANE @@@ */
|
|
||||||
maskpartialbits(pbox->x1, w, startmask);
|
|
||||||
nlwExtra = auxDst;
|
|
||||||
|
|
||||||
switch (rrops[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
Duff(h, *p &= ~startmask; ilbmScanlineInc(p, nlwExtra));
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
Duff(h, *p |= startmask; ilbmScanlineInc(p, nlwExtra));
|
|
||||||
break;
|
|
||||||
case RROP_INVERT:
|
|
||||||
Duff(h, *p ^= startmask; ilbmScanlineInc(p, nlwExtra));
|
|
||||||
break;
|
|
||||||
case RROP_NOP:
|
|
||||||
break;
|
|
||||||
} /* switch */
|
|
||||||
} /* for (d = ..) */
|
|
||||||
} else {
|
|
||||||
maskbits(pbox->x1, w, startmask, endmask, nlwMiddle);
|
|
||||||
|
|
||||||
for (d = 0; d < depthDst; d++) {
|
|
||||||
h = saveH;
|
|
||||||
p = saveP;
|
|
||||||
saveP += nlwidth; /* @@@ NEXT PLANE @@@ */
|
|
||||||
nlwExtra = auxDst - nlwMiddle;
|
|
||||||
|
|
||||||
if (startmask && endmask) {
|
|
||||||
nlwExtra -= 1;
|
|
||||||
switch (rrops[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
while (h--) {
|
|
||||||
nlw = nlwMiddle;
|
|
||||||
*p &= ~startmask;
|
|
||||||
p++;
|
|
||||||
Duff(nlw, *p++ = 0);
|
|
||||||
*p &= ~endmask;
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
while (h--) {
|
|
||||||
nlw = nlwMiddle;
|
|
||||||
*p |= startmask;
|
|
||||||
p++;
|
|
||||||
Duff(nlw, *p++ = ~0);
|
|
||||||
*p |= endmask;
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_INVERT:
|
|
||||||
while (h--) {
|
|
||||||
nlw = nlwMiddle;
|
|
||||||
*p ^= startmask;
|
|
||||||
p++;
|
|
||||||
Duff(nlw, *p++ ^= ~0);
|
|
||||||
*p ^= endmask;
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_NOP:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if (startmask && !endmask) {
|
|
||||||
nlwExtra -= 1;
|
|
||||||
switch (rrops[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
while (h--) {
|
|
||||||
nlw = nlwMiddle;
|
|
||||||
*p &= ~startmask;
|
|
||||||
p++;
|
|
||||||
Duff(nlw, *p++ = 0);
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
while (h--) {
|
|
||||||
nlw = nlwMiddle;
|
|
||||||
*p |= startmask;
|
|
||||||
p++;
|
|
||||||
Duff(nlw, *p++ = ~0);
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_INVERT:
|
|
||||||
while (h--) {
|
|
||||||
nlw = nlwMiddle;
|
|
||||||
*p ^= startmask;
|
|
||||||
p++;
|
|
||||||
Duff(nlw, *p++ ^= ~0);
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_NOP:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if (!startmask && endmask) {
|
|
||||||
switch (rrops[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
while (h--) {
|
|
||||||
nlw = nlwMiddle;
|
|
||||||
Duff(nlw, *p++ = 0);
|
|
||||||
*p &= ~endmask;
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
while (h--) {
|
|
||||||
nlw = nlwMiddle;
|
|
||||||
Duff(nlw, *p++ = ~0);
|
|
||||||
*p |= endmask;
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_INVERT:
|
|
||||||
while (h--) {
|
|
||||||
nlw = nlwMiddle;
|
|
||||||
Duff(nlw, *p++ ^= ~0);
|
|
||||||
*p ^= endmask;
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
case RROP_NOP:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else { /* no ragged bits at either end */
|
|
||||||
switch (rrops[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
while (h--) {
|
|
||||||
nlw = nlwMiddle;
|
|
||||||
Duff(nlw, *p++ = 0);
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
while (h--) {
|
|
||||||
nlw = nlwMiddle;
|
|
||||||
Duff(nlw, *p++ = ~0);
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_INVERT:
|
|
||||||
while (h--) {
|
|
||||||
nlw = nlwMiddle;
|
|
||||||
Duff(nlw, *p++ ^= ~0);
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_NOP:
|
|
||||||
break;
|
|
||||||
} /* switch */
|
|
||||||
}
|
|
||||||
} /* for (d = 0 ... ) */
|
|
||||||
}
|
|
||||||
pbox++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* stipple a list of boxes -
|
|
||||||
|
|
||||||
you can use the reduced rasterop for stipples. if rrop is
|
|
||||||
black, AND the destination with (not stipple pattern). if rrop is
|
|
||||||
white OR the destination with the stipple pattern. if rrop is invert,
|
|
||||||
XOR the destination with the stipple pattern.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*ARGSUSED*/
|
|
||||||
void
|
|
||||||
ilbmStippleAreaPPW(pDraw, nbox, pbox, pstipple, rrops)
|
|
||||||
DrawablePtr pDraw;
|
|
||||||
int nbox;
|
|
||||||
BoxPtr pbox;
|
|
||||||
PixmapPtr pstipple;
|
|
||||||
unsigned char *rrops;
|
|
||||||
{
|
|
||||||
register PixelType *psrc; /* pointer to bits in tile, if needed */
|
|
||||||
int tileHeight; /* height of the tile */
|
|
||||||
register PixelType srcpix;
|
|
||||||
|
|
||||||
int nlwidth; /* width in longwords of the drawable */
|
|
||||||
int w; /* width of current box */
|
|
||||||
register int nlw; /* loop version of nlwMiddle */
|
|
||||||
register PixelType *p; /* pointer to bits we're writing */
|
|
||||||
register int h; /* height of current box */
|
|
||||||
PixelType startmask;
|
|
||||||
PixelType 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 */
|
|
||||||
int auxDst;
|
|
||||||
int depthDst;
|
|
||||||
int d;
|
|
||||||
int saveIy;
|
|
||||||
register int iy; /* index of current scanline in tile */
|
|
||||||
PixelType *pbits; /* pointer to start of drawable */
|
|
||||||
PixelType *pBase;
|
|
||||||
|
|
||||||
ilbmGetPixelWidthAuxDepthAndPointer(pDraw, nlwidth, auxDst, depthDst, pBase);
|
|
||||||
|
|
||||||
tileHeight = pstipple->drawable.height;
|
|
||||||
psrc = (PixelType *)(pstipple->devPrivate.ptr);
|
|
||||||
|
|
||||||
while (nbox--) {
|
|
||||||
w = pbox->x2 - pbox->x1;
|
|
||||||
saveIy = pbox->y1 % tileHeight;
|
|
||||||
pbits = pBase;
|
|
||||||
|
|
||||||
if ( ((pbox->x1 & PIM) + w) < PPW) {
|
|
||||||
maskpartialbits(pbox->x1, w, startmask);
|
|
||||||
nlwExtra = auxDst;
|
|
||||||
for (d = 0; d < depthDst; d++) {
|
|
||||||
p = ilbmScanline(pbits, pbox->x1, pbox->y1, auxDst);
|
|
||||||
pbits += nlwidth; /* @@@ NEXT PLANE @@@ */
|
|
||||||
iy = saveIy;
|
|
||||||
h = pbox->y2 - pbox->y1;
|
|
||||||
|
|
||||||
switch (rrops[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
while (h--) {
|
|
||||||
srcpix = psrc[iy];
|
|
||||||
iy = ++iy < tileHeight ? iy : 0;
|
|
||||||
*p &= ~(srcpix & startmask);
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
while (h--) {
|
|
||||||
srcpix = psrc[iy];
|
|
||||||
iy = ++iy < tileHeight ? iy : 0;
|
|
||||||
*p |= (srcpix & startmask);
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_INVERT:
|
|
||||||
while (h--) {
|
|
||||||
srcpix = psrc[iy];
|
|
||||||
iy = ++iy < tileHeight ? iy : 0;
|
|
||||||
*p ^= (srcpix & startmask);
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_NOP:
|
|
||||||
break;
|
|
||||||
} /* switch */
|
|
||||||
} /* for (d = ...) */
|
|
||||||
|
|
||||||
} else {
|
|
||||||
maskbits(pbox->x1, w, startmask, endmask, nlwMiddle);
|
|
||||||
|
|
||||||
for (d = 0; d < depthDst; d++) {
|
|
||||||
nlwExtra = auxDst - nlwMiddle;
|
|
||||||
p = ilbmScanline(pbits, pbox->x1, pbox->y1, auxDst);
|
|
||||||
pbits += nlwidth; /* @@@ NEXT PLANE @@@ */
|
|
||||||
iy = saveIy;
|
|
||||||
h = pbox->y2 - pbox->y1;
|
|
||||||
|
|
||||||
if (startmask && endmask) {
|
|
||||||
nlwExtra -= 1;
|
|
||||||
switch (rrops[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
while (h--) {
|
|
||||||
srcpix = psrc[iy];
|
|
||||||
iy = ++iy < tileHeight ? iy : 0;
|
|
||||||
nlw = nlwMiddle;
|
|
||||||
*p &= ~(srcpix & startmask);
|
|
||||||
p++;
|
|
||||||
Duff (nlw, *p++ &= ~srcpix);
|
|
||||||
*p &= ~(srcpix & endmask);
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
while (h--) {
|
|
||||||
srcpix = psrc[iy];
|
|
||||||
iy = ++iy < tileHeight ? iy : 0;
|
|
||||||
nlw = nlwMiddle;
|
|
||||||
*p |= (srcpix & startmask);
|
|
||||||
p++;
|
|
||||||
Duff (nlw, *p++ |= srcpix);
|
|
||||||
*p |= (srcpix & endmask);
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_INVERT:
|
|
||||||
while (h--) {
|
|
||||||
srcpix = psrc[iy];
|
|
||||||
iy = ++iy < tileHeight ? iy : 0;
|
|
||||||
nlw = nlwMiddle;
|
|
||||||
*p ^= (srcpix & startmask);
|
|
||||||
p++;
|
|
||||||
Duff (nlw, *p++ ^= srcpix);
|
|
||||||
*p ^= (srcpix & endmask);
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_NOP:
|
|
||||||
break;
|
|
||||||
} /* switch */
|
|
||||||
} else if (startmask && !endmask) {
|
|
||||||
nlwExtra -= 1;
|
|
||||||
switch (rrops[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
while (h--) {
|
|
||||||
srcpix = psrc[iy];
|
|
||||||
iy = ++iy < tileHeight ? iy : 0;
|
|
||||||
nlw = nlwMiddle;
|
|
||||||
*p &= ~(srcpix & startmask);
|
|
||||||
p++;
|
|
||||||
Duff(nlw, *p++ &= ~srcpix);
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
while (h--) {
|
|
||||||
srcpix = psrc[iy];
|
|
||||||
iy = ++iy < tileHeight ? iy : 0;
|
|
||||||
nlw = nlwMiddle;
|
|
||||||
*p |= (srcpix & startmask);
|
|
||||||
p++;
|
|
||||||
Duff(nlw, *p++ |= srcpix);
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_INVERT:
|
|
||||||
while (h--) {
|
|
||||||
srcpix = psrc[iy];
|
|
||||||
iy = ++iy < tileHeight ? iy : 0;
|
|
||||||
nlw = nlwMiddle;
|
|
||||||
*p ^= (srcpix & startmask);
|
|
||||||
p++;
|
|
||||||
Duff(nlw, *p++ ^= srcpix);
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_NOP:
|
|
||||||
break;
|
|
||||||
} /* switch */
|
|
||||||
} else if (!startmask && endmask) {
|
|
||||||
switch (rrops[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
while (h--) {
|
|
||||||
srcpix = psrc[iy];
|
|
||||||
iy = ++iy < tileHeight ? iy : 0;
|
|
||||||
nlw = nlwMiddle;
|
|
||||||
Duff(nlw, *p++ &= ~srcpix);
|
|
||||||
*p &= ~(srcpix & endmask);
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
while (h--) {
|
|
||||||
srcpix = psrc[iy];
|
|
||||||
iy = ++iy < tileHeight ? iy : 0;
|
|
||||||
nlw = nlwMiddle;
|
|
||||||
Duff(nlw, *p++ |= srcpix);
|
|
||||||
*p |= (srcpix & endmask);
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_INVERT:
|
|
||||||
while (h--) {
|
|
||||||
srcpix = psrc[iy];
|
|
||||||
iy = ++iy < tileHeight ? iy : 0;
|
|
||||||
nlw = nlwMiddle;
|
|
||||||
Duff(nlw, *p++ ^= srcpix);
|
|
||||||
*p ^= (srcpix & endmask);
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_NOP:
|
|
||||||
break;
|
|
||||||
} /* switch */
|
|
||||||
} else { /* no ragged bits at either end */
|
|
||||||
switch (rrops[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
while (h--) {
|
|
||||||
srcpix = psrc[iy];
|
|
||||||
iy = ++iy < tileHeight ? iy : 0;
|
|
||||||
nlw = nlwMiddle;
|
|
||||||
Duff(nlw, *p++ &= ~srcpix);
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
while (h--) {
|
|
||||||
srcpix = psrc[iy];
|
|
||||||
iy = ++iy < tileHeight ? iy : 0;
|
|
||||||
nlw = nlwMiddle;
|
|
||||||
Duff(nlw, *p++ |= srcpix);
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_INVERT:
|
|
||||||
while (h--) {
|
|
||||||
srcpix = psrc[iy];
|
|
||||||
iy = ++iy < tileHeight ? iy : 0;
|
|
||||||
nlw = nlwMiddle;
|
|
||||||
Duff(nlw, *p++ ^= srcpix);
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
} /* switch */
|
|
||||||
}
|
|
||||||
} /* for (d = ...) */
|
|
||||||
}
|
|
||||||
pbox++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ilbmStippleArea(pDraw, nbox, pbox, pTile, xOff, yOff, rrops)
|
|
||||||
DrawablePtr pDraw;
|
|
||||||
int nbox;
|
|
||||||
BoxPtr pbox;
|
|
||||||
PixmapPtr pTile;
|
|
||||||
int xOff;
|
|
||||||
int yOff;
|
|
||||||
unsigned char *rrops;
|
|
||||||
{
|
|
||||||
register PixelType *psrc; /* pointer to bits in tile, if needed */
|
|
||||||
int nlwidth; /* width in longwords of the drawable */
|
|
||||||
register int h; /* height of current box */
|
|
||||||
register PixelType *pdst; /* pointer to bits we're writing */
|
|
||||||
int auxDst;
|
|
||||||
int depthDst;
|
|
||||||
int sizeTile;
|
|
||||||
int tileLine;
|
|
||||||
int iline;
|
|
||||||
int w, width, x, xSrc, ySrc, srcStartOver, nend;
|
|
||||||
int tlwidth, rem, tileWidth, tileHeight, endinc;
|
|
||||||
int saveW;
|
|
||||||
register int rop;
|
|
||||||
PixelType *psrcT;
|
|
||||||
int d;
|
|
||||||
int nstart;
|
|
||||||
PixelType startmask;
|
|
||||||
PixelType endmask; /* masks for reggedy bits at either end of line */
|
|
||||||
int nlMiddle; /* number of longwords between sides of boxes */
|
|
||||||
int iy;
|
|
||||||
PixelType *pBase; /* pointer to start of drawable */
|
|
||||||
PixelType *saveP;
|
|
||||||
PixelType *pStartDst;
|
|
||||||
PixelType *pStartTile;
|
|
||||||
int saveH;
|
|
||||||
|
|
||||||
ilbmGetPixelWidthAuxDepthAndPointer(pDraw, nlwidth, auxDst, depthDst, pBase);
|
|
||||||
|
|
||||||
tileHeight = pTile->drawable.height;
|
|
||||||
tileWidth = pTile->drawable.width;
|
|
||||||
tlwidth = pTile->devKind/sizeof(PixelType);
|
|
||||||
|
|
||||||
xSrc = pDraw->x + ((xOff % tileWidth) - tileWidth);
|
|
||||||
ySrc = pDraw->y + ((yOff % tileHeight) - tileHeight);
|
|
||||||
|
|
||||||
while (nbox--) {
|
|
||||||
saveW = pbox->x2 - pbox->x1;
|
|
||||||
iline = (pbox->y1 - ySrc) % tileHeight;
|
|
||||||
psrcT = (PixelType *)pTile->devPrivate.ptr;
|
|
||||||
tileLine = iline * tlwidth;
|
|
||||||
saveH = pbox->y2 - pbox->y1;
|
|
||||||
saveP = ilbmScanline(pBase, pbox->x1, pbox->y1, auxDst);
|
|
||||||
|
|
||||||
for (d = 0; d < depthDst; d++, saveP += nlwidth) { /* @@@ NEXT PLANE @@@ */
|
|
||||||
h = saveH;
|
|
||||||
pStartDst = saveP;
|
|
||||||
pStartTile = psrcT + tileLine;
|
|
||||||
iy = iline;
|
|
||||||
|
|
||||||
while (h--) {
|
|
||||||
x = pbox->x1;
|
|
||||||
width = saveW;
|
|
||||||
pdst = pStartDst;
|
|
||||||
rop = rrops[d];
|
|
||||||
|
|
||||||
while (width > 0) {
|
|
||||||
psrc = pStartTile;
|
|
||||||
w = min(tileWidth, width);
|
|
||||||
if ((rem = (x - xSrc) % tileWidth) != 0) {
|
|
||||||
/* if we're in the middle of the tile, get
|
|
||||||
as many bits as will finish the span, or
|
|
||||||
as many as will get to the left edge of the tile,
|
|
||||||
or a longword worth, starting at the appropriate
|
|
||||||
offset in the tile.
|
|
||||||
*/
|
|
||||||
w = min(min(tileWidth - rem, width), BITMAP_SCANLINE_PAD);
|
|
||||||
endinc = rem / BITMAP_SCANLINE_PAD;
|
|
||||||
getandputrrop((psrc + endinc), (rem & PIM), (x & PIM), w,
|
|
||||||
pdst, rop)
|
|
||||||
if ((x & PIM) + w >= PPW)
|
|
||||||
pdst++;
|
|
||||||
} else if (((x & PIM) + w) < PPW) {
|
|
||||||
/* doing < PPW bits is easy, and worth special-casing */
|
|
||||||
putbitsrrop(*psrc, x & PIM, w, pdst, rop);
|
|
||||||
} else {
|
|
||||||
/* start at the left edge of the tile,
|
|
||||||
and put down as much as we can
|
|
||||||
*/
|
|
||||||
maskbits(x, w, startmask, endmask, nlMiddle);
|
|
||||||
|
|
||||||
if (startmask)
|
|
||||||
nstart = PPW - (x & PIM);
|
|
||||||
else
|
|
||||||
nstart = 0;
|
|
||||||
if (endmask)
|
|
||||||
nend = (x + w) & PIM;
|
|
||||||
else
|
|
||||||
nend = 0;
|
|
||||||
|
|
||||||
srcStartOver = nstart > PLST;
|
|
||||||
|
|
||||||
if (startmask) {
|
|
||||||
putbitsrrop(*psrc, (x & PIM), nstart, pdst, rop);
|
|
||||||
pdst++;
|
|
||||||
if (srcStartOver)
|
|
||||||
psrc++;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (nlMiddle--) {
|
|
||||||
getandputrrop0(psrc, nstart, PPW, pdst, rop);
|
|
||||||
pdst++;
|
|
||||||
psrc++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (endmask) {
|
|
||||||
getandputrrop0(psrc, nstart, nend, pdst, rop);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
x += w;
|
|
||||||
width -= w;
|
|
||||||
} /* while (width > 0) */
|
|
||||||
|
|
||||||
pStartDst += auxDst;
|
|
||||||
if (++iy >= tileHeight) {
|
|
||||||
iy = 0;
|
|
||||||
pStartTile = psrcT;
|
|
||||||
} else
|
|
||||||
pStartTile += tlwidth;
|
|
||||||
|
|
||||||
} /* while (h) */
|
|
||||||
} /* for (d = ... ) */
|
|
||||||
pbox++;
|
|
||||||
} /* for each box */
|
|
||||||
}
|
|
||||||
@@ -1,131 +0,0 @@
|
|||||||
/* $XFree86$ */
|
|
||||||
/* $XConsortium: ilbmpntwin.c,v 5.12 94/04/17 20:28:30 dpw Exp $ */
|
|
||||||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
|
||||||
/***********************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
******************************************************************/
|
|
||||||
|
|
||||||
/* Modified jun 95 by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
|
|
||||||
to use interleaved bitplanes instead of normal bitplanes */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
|
|
||||||
#include "windowstr.h"
|
|
||||||
#include "regionstr.h"
|
|
||||||
#include "pixmapstr.h"
|
|
||||||
#include "scrnintstr.h"
|
|
||||||
|
|
||||||
#include "ilbm.h"
|
|
||||||
#include "maskbits.h"
|
|
||||||
#include "mi.h"
|
|
||||||
|
|
||||||
void
|
|
||||||
ilbmPaintWindow(pWin, pRegion, what)
|
|
||||||
WindowPtr pWin;
|
|
||||||
RegionPtr pRegion;
|
|
||||||
int what;
|
|
||||||
{
|
|
||||||
register ilbmPrivWin *pPrivWin;
|
|
||||||
unsigned char rrops[AFB_MAX_DEPTH];
|
|
||||||
|
|
||||||
pPrivWin = (ilbmPrivWin *)(pWin->devPrivates[ilbmWindowPrivateIndex].ptr);
|
|
||||||
|
|
||||||
switch (what) {
|
|
||||||
case PW_BACKGROUND:
|
|
||||||
switch (pWin->backgroundState) {
|
|
||||||
case None:
|
|
||||||
return;
|
|
||||||
case ParentRelative:
|
|
||||||
do {
|
|
||||||
pWin = pWin->parent;
|
|
||||||
} while (pWin->backgroundState == ParentRelative);
|
|
||||||
(*pWin->drawable.pScreen->PaintWindowBackground)(pWin, pRegion,
|
|
||||||
what);
|
|
||||||
return;
|
|
||||||
case BackgroundPixmap:
|
|
||||||
if (pPrivWin->fastBackground) {
|
|
||||||
ilbmTileAreaPPWCopy((DrawablePtr)pWin,
|
|
||||||
REGION_NUM_RECTS(pRegion),
|
|
||||||
REGION_RECTS(pRegion), GXcopy,
|
|
||||||
pPrivWin->pRotatedBackground, ~0);
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
ilbmTileAreaCopy((DrawablePtr)pWin, REGION_NUM_RECTS(pRegion),
|
|
||||||
REGION_RECTS(pRegion), GXcopy,
|
|
||||||
pWin->background.pixmap, 0, 0, ~0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case BackgroundPixel:
|
|
||||||
ilbmReduceRop(GXcopy, pWin->background.pixel, ~0,
|
|
||||||
pWin->drawable.depth, rrops);
|
|
||||||
ilbmSolidFillArea((DrawablePtr)pWin, REGION_NUM_RECTS(pRegion),
|
|
||||||
REGION_RECTS(pRegion), rrops);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case PW_BORDER:
|
|
||||||
if (pWin->borderIsPixel) {
|
|
||||||
ilbmReduceRop(GXcopy, pWin->border.pixel, ~0, pWin->drawable.depth,
|
|
||||||
rrops);
|
|
||||||
ilbmSolidFillArea((DrawablePtr)pWin, REGION_NUM_RECTS(pRegion),
|
|
||||||
REGION_RECTS(pRegion), rrops);
|
|
||||||
return;
|
|
||||||
} else if (pPrivWin->fastBorder) {
|
|
||||||
ilbmTileAreaPPWCopy((DrawablePtr)pWin, REGION_NUM_RECTS(pRegion),
|
|
||||||
REGION_RECTS(pRegion), GXcopy,
|
|
||||||
pPrivWin->pRotatedBorder, ~0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
miPaintWindow(pWin, pRegion, what);
|
|
||||||
}
|
|
||||||
@@ -1,152 +0,0 @@
|
|||||||
/* $XFree86: xc/programs/Xserver/ilbm/ilbmpolypnt.c,v 3.0 1996/08/18 01:54:07 dawes Exp $ */
|
|
||||||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
|
||||||
/***********************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
******************************************************************/
|
|
||||||
/* $XConsortium: ilbmpolypnt.c,v 5.6 94/04/17 20:28:30 dpw Exp $ */
|
|
||||||
|
|
||||||
/* Modified jun 95 by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
|
|
||||||
to use interleaved bitplanes instead of normal bitplanes */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include <X11/Xprotostr.h>
|
|
||||||
#include "pixmapstr.h"
|
|
||||||
#include "gcstruct.h"
|
|
||||||
#include "windowstr.h"
|
|
||||||
#include "miscstruct.h"
|
|
||||||
#include "regionstr.h"
|
|
||||||
#include "scrnintstr.h"
|
|
||||||
|
|
||||||
#include "ilbm.h"
|
|
||||||
#include "maskbits.h"
|
|
||||||
|
|
||||||
void
|
|
||||||
ilbmPolyPoint(pDrawable, pGC, mode, npt, pptInit)
|
|
||||||
register DrawablePtr pDrawable;
|
|
||||||
GCPtr pGC;
|
|
||||||
int mode; /* Origin or Previous */
|
|
||||||
int npt;
|
|
||||||
xPoint *pptInit;
|
|
||||||
{
|
|
||||||
|
|
||||||
register BoxPtr pbox;
|
|
||||||
register int nbox;
|
|
||||||
register int d;
|
|
||||||
|
|
||||||
register PixelType *addrl;
|
|
||||||
PixelType *pBase;
|
|
||||||
PixelType *pBaseSave;
|
|
||||||
int nlwidth;
|
|
||||||
int auxDst;
|
|
||||||
int depthDst;
|
|
||||||
|
|
||||||
int nptTmp;
|
|
||||||
register xPoint *ppt;
|
|
||||||
|
|
||||||
register int x;
|
|
||||||
register int y;
|
|
||||||
register unsigned char *rrops;
|
|
||||||
ilbmPrivGC *pGCPriv;
|
|
||||||
|
|
||||||
pGCPriv = (ilbmPrivGC *) pGC->devPrivates[ilbmGCPrivateIndex].ptr;
|
|
||||||
|
|
||||||
ilbmGetPixelWidthAuxDepthAndPointer(pDrawable, nlwidth, auxDst, depthDst,
|
|
||||||
pBaseSave);
|
|
||||||
|
|
||||||
rrops = pGCPriv->rrops;
|
|
||||||
if ((mode == CoordModePrevious) && (npt > 1))
|
|
||||||
for (ppt = pptInit + 1, nptTmp = npt - 1; --nptTmp >= 0; ppt++) {
|
|
||||||
ppt->x += (ppt-1)->x;
|
|
||||||
ppt->y += (ppt-1)->y;
|
|
||||||
}
|
|
||||||
|
|
||||||
nbox = REGION_NUM_RECTS(pGC->pCompositeClip);
|
|
||||||
pbox = REGION_RECTS(pGC->pCompositeClip);
|
|
||||||
for (; --nbox >= 0; pbox++)
|
|
||||||
for (d = 0, pBase = pBaseSave; d < depthDst; d++, pBase += nlwidth) { /* @@@ NEXT PLANE @@@ */
|
|
||||||
addrl = pBase;
|
|
||||||
|
|
||||||
switch (rrops[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
for (ppt = pptInit, nptTmp = npt; --nptTmp >= 0; ppt++) {
|
|
||||||
x = ppt->x + pDrawable->x;
|
|
||||||
y = ppt->y + pDrawable->y;
|
|
||||||
if ((x >= pbox->x1) && (x < pbox->x2) &&
|
|
||||||
(y >= pbox->y1) && (y < pbox->y2))
|
|
||||||
*ilbmScanline(addrl, x, y, auxDst) &= rmask[x & PIM];
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RROP_WHITE:
|
|
||||||
for (ppt = pptInit, nptTmp = npt; --nptTmp >= 0; ppt++) {
|
|
||||||
x = ppt->x + pDrawable->x;
|
|
||||||
y = ppt->y + pDrawable->y;
|
|
||||||
if ((x >= pbox->x1) && (x < pbox->x2) &&
|
|
||||||
(y >= pbox->y1) && (y < pbox->y2))
|
|
||||||
*ilbmScanline(addrl, x, y, auxDst) |= mask[x & PIM];
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RROP_INVERT:
|
|
||||||
for (ppt = pptInit, nptTmp = npt; --nptTmp >= 0; ppt++) {
|
|
||||||
x = ppt->x + pDrawable->x;
|
|
||||||
y = ppt->y + pDrawable->y;
|
|
||||||
if ((x >= pbox->x1) && (x < pbox->x2) &&
|
|
||||||
(y >= pbox->y1) && (y < pbox->y2))
|
|
||||||
*ilbmScanline(addrl, x, y, auxDst) ^= mask[x & PIM];
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RROP_NOP:
|
|
||||||
break;
|
|
||||||
} /* switch */
|
|
||||||
} /* for (d = ...) */
|
|
||||||
}
|
|
||||||
@@ -1,263 +0,0 @@
|
|||||||
/* $XFree86: xc/programs/Xserver/ilbm/ilbmpushpxl.c,v 3.0 1996/08/18 01:54:08 dawes Exp $ */
|
|
||||||
/***********************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
******************************************************************/
|
|
||||||
/* $XConsortium: ilbmpushpxl.c,v 5.6 94/04/17 20:28:31 dpw Exp $ */
|
|
||||||
|
|
||||||
/* Modified jun 95 by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
|
|
||||||
to use interleaved bitplanes instead of normal bitplanes */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include "gcstruct.h"
|
|
||||||
#include "scrnintstr.h"
|
|
||||||
#include "pixmapstr.h"
|
|
||||||
#include "miscstruct.h"
|
|
||||||
#include "maskbits.h"
|
|
||||||
#include "regionstr.h"
|
|
||||||
#include "ilbm.h"
|
|
||||||
|
|
||||||
/* ilbmSolidPP is courtesy of xhacks@csri.toronto.edu
|
|
||||||
|
|
||||||
For fillStyle==FillSolid, a monochrome PushPixels can be reduced to
|
|
||||||
a ROP in the following way: (Note that the ROP is the same as the
|
|
||||||
result of ROP(src=0x3,dst=0x5))
|
|
||||||
|
|
||||||
src=0011 0000 0011
|
|
||||||
dst=0101 0101 0101
|
|
||||||
rop fg=0 fg=1
|
|
||||||
GXclear 0x0 0000 0100 0100 0
|
|
||||||
GXand 0x1 0001 0100 0101 s&d
|
|
||||||
GXandReverse 0x2 0010 0100 0110 s&~d
|
|
||||||
GXcopy 0x3 0011 0100 0111 s
|
|
||||||
GXandInverted 0x4 0100 0101 0100 ~s&d
|
|
||||||
GXnoop 0x5 0101 0101 0101 d
|
|
||||||
GXxor 0x6 0110 0101 0110 s^d
|
|
||||||
GXor 0x7 0111 0101 0111 s|d
|
|
||||||
GXnor 0x8 1000 0110 0100 ~s&~d
|
|
||||||
GXequiv 0x9 1001 0110 0101 ~s^d
|
|
||||||
GXinvert 0xa 1010 0110 0110 ~d
|
|
||||||
GXorReverse 0xb 1011 0110 0111 s|~d
|
|
||||||
GXcopyInverted 0xc 1100 0111 0100 ~s
|
|
||||||
GXorInverted 0xd 1101 0111 0101 ~s|d
|
|
||||||
GXnand 0xe 1110 0111 0110 ~s|~d
|
|
||||||
GXset 0xf 1111 0111 0111 1
|
|
||||||
|
|
||||||
For src=0: newRop = 0x4|(rop>>2)
|
|
||||||
For src=1: newRop = 0x4|(rop&3)
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* ilbmSolidPP -- squeegees the forground color of pGC through pBitMap
|
|
||||||
* into pDrawable. pBitMap is a stencil (dx by dy of it is used, it may
|
|
||||||
* be bigger) which is placed on the drawable at xOrg, yOrg. Where a 1 bit
|
|
||||||
* is set in the bitmap, the fill style is put onto the drawable using
|
|
||||||
* the GC's logical function. The drawable is not changed where the bitmap
|
|
||||||
* has a zero bit or outside the area covered by the stencil.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
ilbmSolidPP(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg)
|
|
||||||
GCPtr pGC;
|
|
||||||
PixmapPtr pBitMap;
|
|
||||||
DrawablePtr pDrawable;
|
|
||||||
int dx, dy, xOrg, yOrg;
|
|
||||||
{
|
|
||||||
unsigned char alu;
|
|
||||||
RegionRec rgnDst;
|
|
||||||
DDXPointPtr pptSrc;
|
|
||||||
BoxRec srcBox;
|
|
||||||
register DDXPointPtr ppt;
|
|
||||||
register BoxPtr pbox;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (!pGC->planemask & 1) return;
|
|
||||||
|
|
||||||
/* compute the reduced rop function */
|
|
||||||
alu = pGC->alu;
|
|
||||||
if (!(pGC->fgPixel&1)) alu >>= 2;
|
|
||||||
alu = (alu & 0x3) | 0x4;
|
|
||||||
if (alu == GXnoop) return;
|
|
||||||
|
|
||||||
srcBox.x1 = xOrg;
|
|
||||||
srcBox.y1 = yOrg;
|
|
||||||
srcBox.x2 = xOrg + dx;
|
|
||||||
srcBox.y2 = yOrg + dy;
|
|
||||||
REGION_INIT(pGC->pScreen, &rgnDst, &srcBox, 1);
|
|
||||||
|
|
||||||
/* clip the shape of the dst to the destination composite clip */
|
|
||||||
REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, pGC->pCompositeClip);
|
|
||||||
|
|
||||||
if (!REGION_NIL(&rgnDst)) {
|
|
||||||
i = REGION_NUM_RECTS(&rgnDst);
|
|
||||||
pptSrc = (DDXPointPtr)ALLOCATE_LOCAL(i * sizeof(DDXPointRec));
|
|
||||||
if (pptSrc) {
|
|
||||||
for (pbox = REGION_RECTS(&rgnDst), ppt = pptSrc; --i >= 0;
|
|
||||||
pbox++, ppt++) {
|
|
||||||
ppt->x = pbox->x1 - xOrg;
|
|
||||||
ppt->y = pbox->y1 - yOrg;
|
|
||||||
}
|
|
||||||
ilbmDoBitblt((DrawablePtr)pBitMap, pDrawable, alu, &rgnDst, pptSrc,
|
|
||||||
pGC->planemask);
|
|
||||||
DEALLOCATE_LOCAL(pptSrc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
REGION_UNINIT(pGC->pScreen, &rgnDst);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define NPT 128
|
|
||||||
|
|
||||||
/* ilbmPushPixels -- squeegees the forground color of pGC through pBitMap
|
|
||||||
* into pDrawable. pBitMap is a stencil (dx by dy of it is used, it may
|
|
||||||
* be bigger) which is placed on the drawable at xOrg, yOrg. Where a 1 bit
|
|
||||||
* is set in the bitmap, the fill style is put onto the drawable using
|
|
||||||
* the GC's logical function. The drawable is not changed where the bitmap
|
|
||||||
* has a zero bit or outside the area covered by the stencil.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
ilbmPushPixels(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg)
|
|
||||||
GCPtr pGC;
|
|
||||||
PixmapPtr pBitMap;
|
|
||||||
DrawablePtr pDrawable;
|
|
||||||
int dx, dy, xOrg, yOrg;
|
|
||||||
{
|
|
||||||
int h, dxDivPPW, ibEnd;
|
|
||||||
PixelType *pwLineStart;
|
|
||||||
register PixelType *pw, *pwEnd;
|
|
||||||
register PixelType mask;
|
|
||||||
register int ib;
|
|
||||||
register PixelType w;
|
|
||||||
register int ipt; /* index into above arrays */
|
|
||||||
Bool fInBox;
|
|
||||||
DDXPointRec pt[NPT];
|
|
||||||
int width[NPT];
|
|
||||||
|
|
||||||
/* Now scan convert the pixmap and use the result to call fillspans in
|
|
||||||
* in the drawable with the original GC */
|
|
||||||
ipt = 0;
|
|
||||||
dxDivPPW = dx/PPW;
|
|
||||||
for (h = 0; h < dy; h++) {
|
|
||||||
|
|
||||||
pw = (PixelType *)
|
|
||||||
(((char *)(pBitMap->devPrivate.ptr))+(h * pBitMap->devKind));
|
|
||||||
pwLineStart = pw;
|
|
||||||
/* Process all words which are fully in the pixmap */
|
|
||||||
|
|
||||||
fInBox = FALSE;
|
|
||||||
pwEnd = pwLineStart + dxDivPPW;
|
|
||||||
while (pw < pwEnd) {
|
|
||||||
w = *pw;
|
|
||||||
mask = endtab[1];
|
|
||||||
for (ib = 0; ib < PPW; ib++) {
|
|
||||||
if (w & mask) {
|
|
||||||
if (!fInBox) {
|
|
||||||
pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg;
|
|
||||||
pt[ipt].y = h + yOrg;
|
|
||||||
/* start new box */
|
|
||||||
fInBox = TRUE;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (fInBox) {
|
|
||||||
width[ipt] = ((pw - pwLineStart) << PWSH) +
|
|
||||||
ib + xOrg - pt[ipt].x;
|
|
||||||
if (++ipt >= NPT) {
|
|
||||||
(*pGC->ops->FillSpans)(pDrawable, pGC, NPT, pt,
|
|
||||||
width, TRUE);
|
|
||||||
ipt = 0;
|
|
||||||
}
|
|
||||||
/* end box */
|
|
||||||
fInBox = FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mask = SCRRIGHT(mask, 1);
|
|
||||||
}
|
|
||||||
pw++;
|
|
||||||
}
|
|
||||||
ibEnd = dx & PIM;
|
|
||||||
if (ibEnd) {
|
|
||||||
/* Process final partial word on line */
|
|
||||||
w = *pw;
|
|
||||||
mask = endtab[1];
|
|
||||||
for (ib = 0; ib < ibEnd; ib++) {
|
|
||||||
if (w & mask) {
|
|
||||||
if (!fInBox) {
|
|
||||||
/* start new box */
|
|
||||||
pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg;
|
|
||||||
pt[ipt].y = h + yOrg;
|
|
||||||
fInBox = TRUE;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (fInBox) {
|
|
||||||
/* end box */
|
|
||||||
width[ipt] = ((pw - pwLineStart) << PWSH) +
|
|
||||||
ib + xOrg - pt[ipt].x;
|
|
||||||
if (++ipt >= NPT) {
|
|
||||||
(*pGC->ops->FillSpans)(pDrawable, pGC, NPT, pt,
|
|
||||||
width, TRUE);
|
|
||||||
ipt = 0;
|
|
||||||
}
|
|
||||||
fInBox = FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mask = SCRRIGHT(mask, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* If scanline ended with last bit set, end the box */
|
|
||||||
if (fInBox) {
|
|
||||||
width[ipt] = dx + xOrg - pt[ipt].x;
|
|
||||||
if (++ipt >= NPT) {
|
|
||||||
(*pGC->ops->FillSpans)(pDrawable, pGC, NPT, pt, width, TRUE);
|
|
||||||
ipt = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* Flush any remaining spans */
|
|
||||||
if (ipt) {
|
|
||||||
(*pGC->ops->FillSpans)(pDrawable, pGC, ipt, pt, width, TRUE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,251 +0,0 @@
|
|||||||
/* $XFree86: xc/programs/Xserver/ilbm/ilbmscrinit.c,v 3.4 1998/07/26 01:53:45 dawes Exp $ */
|
|
||||||
/***********************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
******************************************************************/
|
|
||||||
/* $XConsortium: ilbmscrinit.c,v 5.17 94/04/17 20:28:34 dpw Exp $ */
|
|
||||||
|
|
||||||
/* Modified jun 95 by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
|
|
||||||
to use interleaved bitplanes instead of normal bitplanes */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include <X11/Xproto.h> /* for xColorItem */
|
|
||||||
#include <X11/Xmd.h>
|
|
||||||
#include "scrnintstr.h"
|
|
||||||
#include "pixmapstr.h"
|
|
||||||
#include "windowstr.h"
|
|
||||||
#include "resource.h"
|
|
||||||
#include "colormap.h"
|
|
||||||
#include "ilbm.h"
|
|
||||||
#include "mistruct.h"
|
|
||||||
#include "dix.h"
|
|
||||||
#include "mi.h"
|
|
||||||
#include "mibstore.h"
|
|
||||||
#include "migc.h"
|
|
||||||
#include "servermd.h"
|
|
||||||
|
|
||||||
#ifdef PIXMAP_PER_WINDOW
|
|
||||||
int frameWindowPrivateIndex;
|
|
||||||
#endif
|
|
||||||
int ilbmWindowPrivateIndex;
|
|
||||||
int ilbmGCPrivateIndex;
|
|
||||||
int ilbmScreenPrivateIndex;
|
|
||||||
|
|
||||||
static unsigned long ilbmGeneration = 0;
|
|
||||||
|
|
||||||
BSFuncRec ilbmBSFuncRec = {
|
|
||||||
ilbmSaveAreas,
|
|
||||||
ilbmRestoreAreas,
|
|
||||||
(BackingStoreSetClipmaskRgnProcPtr) 0,
|
|
||||||
(BackingStoreGetImagePixmapProcPtr) 0,
|
|
||||||
(BackingStoreGetSpansPixmapProcPtr) 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
Bool
|
|
||||||
ilbmCloseScreen(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);
|
|
||||||
xfree(pScreen->devPrivates[ilbmScreenPrivateIndex].ptr);
|
|
||||||
return(TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool
|
|
||||||
ilbmCreateScreenResources(pScreen)
|
|
||||||
ScreenPtr pScreen;
|
|
||||||
{
|
|
||||||
Bool retval;
|
|
||||||
|
|
||||||
pointer oldDevPrivate = pScreen->devPrivate;
|
|
||||||
|
|
||||||
pScreen->devPrivate = pScreen->devPrivates[ilbmScreenPrivateIndex].ptr;
|
|
||||||
retval = miCreateScreenResources(pScreen);
|
|
||||||
|
|
||||||
/* Modify screen's pixmap devKind value stored off devPrivate to
|
|
||||||
* be the width of a single plane in longs rather than the width
|
|
||||||
* of a chunky screen in longs as incorrectly setup by the mi routine.
|
|
||||||
*/
|
|
||||||
((PixmapPtr)pScreen->devPrivate)->devKind = BitmapBytePad(pScreen->width);
|
|
||||||
pScreen->devPrivates[ilbmScreenPrivateIndex].ptr = pScreen->devPrivate;
|
|
||||||
pScreen->devPrivate = oldDevPrivate;
|
|
||||||
return(retval);
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool
|
|
||||||
ilbmAllocatePrivates(pScreen, pWinIndex, pGCIndex)
|
|
||||||
ScreenPtr pScreen;
|
|
||||||
int *pWinIndex, *pGCIndex;
|
|
||||||
{
|
|
||||||
if (ilbmGeneration != serverGeneration) {
|
|
||||||
#ifdef PIXMAP_PER_WINDOW
|
|
||||||
frameWindowPrivateIndex = AllocateWindowPrivateIndex();
|
|
||||||
#endif
|
|
||||||
ilbmWindowPrivateIndex = AllocateWindowPrivateIndex();
|
|
||||||
ilbmGCPrivateIndex = AllocateGCPrivateIndex();
|
|
||||||
ilbmGeneration = serverGeneration;
|
|
||||||
}
|
|
||||||
if (pWinIndex)
|
|
||||||
*pWinIndex = ilbmWindowPrivateIndex;
|
|
||||||
if (pGCIndex)
|
|
||||||
*pGCIndex = ilbmGCPrivateIndex;
|
|
||||||
|
|
||||||
ilbmScreenPrivateIndex = AllocateScreenPrivateIndex();
|
|
||||||
pScreen->GetWindowPixmap = ilbmGetWindowPixmap;
|
|
||||||
pScreen->SetWindowPixmap = ilbmSetWindowPixmap;
|
|
||||||
return(AllocateWindowPrivate(pScreen, ilbmWindowPrivateIndex, sizeof(ilbmPrivWin)) &&
|
|
||||||
AllocateGCPrivate(pScreen, ilbmGCPrivateIndex, sizeof(ilbmPrivGC)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* dts * (inch/dot) * (25.4 mm / inch) = mm */
|
|
||||||
Bool
|
|
||||||
ilbmScreenInit(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 */
|
|
||||||
{
|
|
||||||
VisualPtr visuals;
|
|
||||||
DepthPtr depths;
|
|
||||||
int nvisuals;
|
|
||||||
int ndepths;
|
|
||||||
int rootdepth;
|
|
||||||
VisualID defaultVisual;
|
|
||||||
pointer oldDevPrivate;
|
|
||||||
|
|
||||||
rootdepth = 0;
|
|
||||||
if (!ilbmInitVisuals(&visuals, &depths, &nvisuals, &ndepths, &rootdepth,
|
|
||||||
&defaultVisual, 256, 8)) {
|
|
||||||
ErrorF("ilbmInitVisuals: FALSE\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if (!ilbmAllocatePrivates(pScreen,(int *)NULL, (int *)NULL)) {
|
|
||||||
ErrorF("ilbmAllocatePrivates: FALSE\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
pScreen->defColormap = (Colormap)FakeClientID(0);
|
|
||||||
/* whitePixel, blackPixel */
|
|
||||||
pScreen->blackPixel = 0;
|
|
||||||
pScreen->whitePixel = 0;
|
|
||||||
pScreen->QueryBestSize = ilbmQueryBestSize;
|
|
||||||
/* SaveScreen */
|
|
||||||
pScreen->GetImage = ilbmGetImage;
|
|
||||||
pScreen->GetSpans = ilbmGetSpans;
|
|
||||||
pScreen->CreateWindow = ilbmCreateWindow;
|
|
||||||
pScreen->DestroyWindow = ilbmDestroyWindow;
|
|
||||||
pScreen->PositionWindow = ilbmPositionWindow;
|
|
||||||
pScreen->ChangeWindowAttributes = ilbmChangeWindowAttributes;
|
|
||||||
pScreen->RealizeWindow = ilbmMapWindow;
|
|
||||||
pScreen->UnrealizeWindow = ilbmUnmapWindow;
|
|
||||||
pScreen->PaintWindowBackground = ilbmPaintWindow;
|
|
||||||
pScreen->PaintWindowBorder = ilbmPaintWindow;
|
|
||||||
pScreen->CopyWindow = ilbmCopyWindow;
|
|
||||||
pScreen->CreatePixmap = ilbmCreatePixmap;
|
|
||||||
pScreen->DestroyPixmap = ilbmDestroyPixmap;
|
|
||||||
pScreen->RealizeFont = ilbmRealizeFont;
|
|
||||||
pScreen->UnrealizeFont = ilbmUnrealizeFont;
|
|
||||||
pScreen->CreateGC = ilbmCreateGC;
|
|
||||||
pScreen->CreateColormap = ilbmInitializeColormap;
|
|
||||||
pScreen->DestroyColormap = (void (*)())NoopDDA;
|
|
||||||
pScreen->InstallColormap = ilbmInstallColormap;
|
|
||||||
pScreen->UninstallColormap = ilbmUninstallColormap;
|
|
||||||
pScreen->ListInstalledColormaps = ilbmListInstalledColormaps;
|
|
||||||
pScreen->StoreColors = (void (*)())NoopDDA;
|
|
||||||
pScreen->ResolveColor = ilbmResolveColor;
|
|
||||||
pScreen->BitmapToRegion = ilbmPixmapToRegion;
|
|
||||||
oldDevPrivate = pScreen->devPrivate;
|
|
||||||
if (!miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, rootdepth,
|
|
||||||
ndepths, depths, defaultVisual, nvisuals, visuals)) {
|
|
||||||
ErrorF("miScreenInit: FALSE\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
pScreen->CloseScreen = ilbmCloseScreen;
|
|
||||||
pScreen->CreateScreenResources = ilbmCreateScreenResources;
|
|
||||||
pScreen->BackingStoreFuncs = ilbmBSFuncRec;
|
|
||||||
|
|
||||||
pScreen->devPrivates[ilbmScreenPrivateIndex].ptr = pScreen->devPrivate;
|
|
||||||
pScreen->devPrivate = oldDevPrivate;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
PixmapPtr
|
|
||||||
ilbmGetWindowPixmap(pWin)
|
|
||||||
WindowPtr pWin;
|
|
||||||
{
|
|
||||||
#ifdef PIXMAP_PER_WINDOW
|
|
||||||
return (PixmapPtr)(pWin->devPrivates[frameWindowPrivateIndex].ptr);
|
|
||||||
#else
|
|
||||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
|
||||||
|
|
||||||
return (* pScreen->GetScreenPixmap)(pScreen);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ilbmSetWindowPixmap(pWin, pPix)
|
|
||||||
WindowPtr pWin;
|
|
||||||
PixmapPtr pPix;
|
|
||||||
{
|
|
||||||
#ifdef PIXMAP_PER_WINDOW
|
|
||||||
pWin->devPrivates[frameWindowPrivateIndex].ptr = (pointer)pPix;
|
|
||||||
#else
|
|
||||||
(* pWin->drawable.pScreen->SetScreenPixmap)(pPix);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
269
ilbm/ilbmsetsp.c
269
ilbm/ilbmsetsp.c
@@ -1,269 +0,0 @@
|
|||||||
/* $XFree86: xc/programs/Xserver/ilbm/ilbmsetsp.c,v 3.0 1996/08/18 01:54:10 dawes Exp $ */
|
|
||||||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
|
||||||
/***********************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
******************************************************************/
|
|
||||||
/* $XConsortium: ilbmsetsp.c,v 5.8 94/04/17 20:28:34 dpw Exp $ */
|
|
||||||
|
|
||||||
/* Modified jun 95 by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
|
|
||||||
to use interleaved bitplanes instead of normal bitplanes */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include <X11/Xmd.h>
|
|
||||||
|
|
||||||
#include "misc.h"
|
|
||||||
#include "regionstr.h"
|
|
||||||
#include "gcstruct.h"
|
|
||||||
#include "windowstr.h"
|
|
||||||
#include "pixmapstr.h"
|
|
||||||
#include "scrnintstr.h"
|
|
||||||
|
|
||||||
#include "ilbm.h"
|
|
||||||
#include "maskbits.h"
|
|
||||||
|
|
||||||
#include "servermd.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* ilbmSetScanline -- 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.)
|
|
||||||
*/
|
|
||||||
ilbmSetScanline(y, xOrigin, xStart, xEnd, psrc, alu, pdstBase, widthDst, auxDst,
|
|
||||||
depthDst, widthSrc)
|
|
||||||
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 PixelType *psrc;
|
|
||||||
register int alu; /* raster op */
|
|
||||||
PixelType *pdstBase; /* start of the drawable */
|
|
||||||
int widthDst; /* width of drawable in words */
|
|
||||||
int auxDst;
|
|
||||||
int depthDst;
|
|
||||||
int widthSrc; /* width of drawable in words */
|
|
||||||
{
|
|
||||||
int w; /* width of scanline in bits */
|
|
||||||
register PixelType *pdst; /* where to put the bits */
|
|
||||||
register PixelType tmpSrc; /* scratch buffer to collect bits in */
|
|
||||||
int dstBit; /* offset in bits from beginning of
|
|
||||||
* word */
|
|
||||||
register int nstart; /* number of bits from first partial */
|
|
||||||
register int nend; /* " " last partial word */
|
|
||||||
int offSrc;
|
|
||||||
PixelType startmask, endmask;
|
|
||||||
PixelType *savePsrc = psrc + ((xStart - xOrigin) >> PWSH);
|
|
||||||
int nlMiddle, nl;
|
|
||||||
int d;
|
|
||||||
|
|
||||||
for (d = 0; d < depthDst; d++) {
|
|
||||||
pdst = ilbmScanline(pdstBase, xStart, y, auxDst) + widthDst * d; /* @@@ NEXT PLANE @@@ */
|
|
||||||
psrc = savePsrc + widthSrc * d; /* @@@ NEXT PLANE @@@ */
|
|
||||||
offSrc = (xStart - xOrigin) & PIM;
|
|
||||||
w = xEnd - xStart;
|
|
||||||
dstBit = xStart & PIM;
|
|
||||||
|
|
||||||
if (dstBit + w <= PPW) {
|
|
||||||
getandputrop(psrc, offSrc, dstBit, w, pdst, alu)
|
|
||||||
} else {
|
|
||||||
maskbits(xStart, w, startmask, endmask, nlMiddle);
|
|
||||||
if (startmask)
|
|
||||||
nstart = PPW - dstBit;
|
|
||||||
else
|
|
||||||
nstart = 0;
|
|
||||||
if (endmask)
|
|
||||||
nend = xEnd & PIM;
|
|
||||||
else
|
|
||||||
nend = 0;
|
|
||||||
if (startmask) {
|
|
||||||
getandputrop(psrc, offSrc, dstBit, nstart, pdst, alu)
|
|
||||||
pdst++;
|
|
||||||
offSrc += nstart;
|
|
||||||
if (offSrc > PLST) {
|
|
||||||
psrc++;
|
|
||||||
offSrc -= PPW;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
nl = nlMiddle;
|
|
||||||
while (nl--) {
|
|
||||||
getbits(psrc, offSrc, PPW, tmpSrc);
|
|
||||||
DoRop(*pdst, alu, tmpSrc, *pdst);
|
|
||||||
pdst++;
|
|
||||||
psrc++;
|
|
||||||
}
|
|
||||||
if (endmask) {
|
|
||||||
getandputrop0(psrc, offSrc, nend, pdst, alu);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 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
|
|
||||||
ilbmSetSpans(pDrawable, pGC, pcharsrc, ppt, pwidth, nspans, fSorted)
|
|
||||||
DrawablePtr pDrawable;
|
|
||||||
GCPtr pGC;
|
|
||||||
char *pcharsrc;
|
|
||||||
register DDXPointPtr ppt;
|
|
||||||
int *pwidth;
|
|
||||||
int nspans;
|
|
||||||
int fSorted;
|
|
||||||
{
|
|
||||||
PixelType *psrc = (PixelType *)pcharsrc;
|
|
||||||
PixelType *pdstBase; /* start of dst bitmap */
|
|
||||||
int widthDst; /* width of bitmap in words */
|
|
||||||
int auxDst;
|
|
||||||
int depthDst;
|
|
||||||
int widthSrc;
|
|
||||||
register BoxPtr pbox, pboxLast, pboxTest;
|
|
||||||
register DDXPointPtr pptLast;
|
|
||||||
int alu;
|
|
||||||
RegionPtr prgnDst;
|
|
||||||
int xStart, xEnd;
|
|
||||||
int yMax;
|
|
||||||
|
|
||||||
alu = pGC->alu;
|
|
||||||
prgnDst = pGC->pCompositeClip;
|
|
||||||
|
|
||||||
pptLast = ppt + nspans;
|
|
||||||
|
|
||||||
yMax = pDrawable->y + (int) pDrawable->height;
|
|
||||||
ilbmGetPixelWidthAuxDepthAndPointer(pDrawable, widthDst, auxDst, depthDst,
|
|
||||||
pdstBase);
|
|
||||||
|
|
||||||
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);
|
|
||||||
widthSrc = PixmapWidthInPadUnits(*pwidth, 1);
|
|
||||||
ilbmSetScanline(ppt->y, ppt->x, xStart, xEnd, psrc, alu, pdstBase,
|
|
||||||
widthDst, auxDst, depthDst, widthSrc);
|
|
||||||
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 += widthSrc * depthDst;
|
|
||||||
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);
|
|
||||||
widthSrc = PixmapWidthInPadUnits(*pwidth, 1);
|
|
||||||
ilbmSetScanline(ppt->y, ppt->x, xStart, xEnd, psrc, alu,
|
|
||||||
pdstBase, widthDst, auxDst, depthDst,
|
|
||||||
widthSrc);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
psrc += widthSrc * depthDst;
|
|
||||||
ppt++;
|
|
||||||
pwidth++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,599 +0,0 @@
|
|||||||
/* $XFree86: xc/programs/Xserver/ilbm/ilbmtegblt.c,v 3.0 1996/08/18 01:54:11 dawes Exp $ */
|
|
||||||
/* $XConsortium: ilbmtegblt.c,v 5.14 94/04/17 20:28:35 dpw Exp $ */
|
|
||||||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
|
||||||
/***********************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
******************************************************************/
|
|
||||||
|
|
||||||
/* Modified jun 95 by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
|
|
||||||
to use interleaved bitplanes instead of normal bitplanes */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include <X11/Xmd.h>
|
|
||||||
#include <X11/Xproto.h>
|
|
||||||
#include "ilbm.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 "maskbits.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
this works for fonts with glyphs <= PPW bits wide.
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if defined(NO_3_60_CG4) && defined(FASTPUTBITS) && defined(FASTGETBITS)
|
|
||||||
#define FASTCHARS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* this macro "knows" that only characters <= 8 bits wide will
|
|
||||||
* fit this case (which is why it is independent of GLYPHPADBYTES)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if (BITMAP_BIT_ORDER == MSBFirst) && (GLYPHPADBYTES != 4)
|
|
||||||
#if GLYPHPADBYTES == 1
|
|
||||||
#define ShiftAmnt 24
|
|
||||||
#else
|
|
||||||
#define ShiftAmnt 16
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Note: for BITMAP_BIT_ORDER != IMAGE_BYTE_ORDER, SCRRIGHT() evaluates its
|
|
||||||
* first argument more than once. Thus the imbedded char++ have to be moved.
|
|
||||||
* (DHD)
|
|
||||||
*/
|
|
||||||
#if BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER
|
|
||||||
#if PPW == 32
|
|
||||||
#define GetBits4 c = (*char1++ << ShiftAmnt) | \
|
|
||||||
SCRRIGHT (*char2++ << ShiftAmnt, xoff2) | \
|
|
||||||
SCRRIGHT (*char3++ << ShiftAmnt, xoff3) | \
|
|
||||||
SCRRIGHT (*char4++ << ShiftAmnt, xoff4);
|
|
||||||
#else /* PPW */
|
|
||||||
#define GetBits4 c = ((unsigned long)(*char1++ << ShiftAmnt) << 32 ) | \
|
|
||||||
(SCRRIGHT (*char2++ << ShiftAmnt, xoff2) << 32 ) | \
|
|
||||||
(SCRRIGHT (*char3++ << ShiftAmnt, xoff3) << 32 ) | \
|
|
||||||
(SCRRIGHT (*char4++ << ShiftAmnt, xoff4) << 32 ) | \
|
|
||||||
(*char5++ << ShiftAmnt) | \
|
|
||||||
SCRRIGHT (*char6++ << ShiftAmnt, xoff6) | \
|
|
||||||
SCRRIGHT (*char7++ << ShiftAmnt, xoff7) | \
|
|
||||||
SCRRIGHT (*char8++ << ShiftAmnt, xoff8);
|
|
||||||
#endif /* PPW */
|
|
||||||
#else /* BITMAP_BIT_ORDER != IMAGE_BYTE_ORDER */
|
|
||||||
#if PPW == 32
|
|
||||||
#define GetBits4 c = (*char1++ << ShiftAmnt) | \
|
|
||||||
SCRRIGHT (*char2 << ShiftAmnt, xoff2) | \
|
|
||||||
SCRRIGHT (*char3 << ShiftAmnt, xoff3) | \
|
|
||||||
SCRRIGHT (*char4 << ShiftAmnt, xoff4); \
|
|
||||||
char2++; char3++; char4++;
|
|
||||||
#else /* PPW == 64 */
|
|
||||||
#define GetBits4 c = ((unsigned long)(*char1++ << ShiftAmnt) << 32 ) | \
|
|
||||||
(SCRRIGHT (*char2 << ShiftAmnt, xoff2) << 32 ) | \
|
|
||||||
(SCRRIGHT (*char3 << ShiftAmnt, xoff3) << 32 ) | \
|
|
||||||
(SCRRIGHT (*char4 << ShiftAmnt, xoff4) << 32 ) | \
|
|
||||||
(*char5++ << ShiftAmnt) | \
|
|
||||||
SCRRIGHT (*char6 << ShiftAmnt, xoff6) | \
|
|
||||||
SCRRIGHT (*char7 << ShiftAmnt, xoff7) | \
|
|
||||||
SCRRIGHT (*char8 << ShiftAmnt, xoff8); \
|
|
||||||
char2++; char3++; char4++; char6++; char7++; char8++;
|
|
||||||
#endif /* PPW */
|
|
||||||
#endif /* BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER */
|
|
||||||
|
|
||||||
#else /* (BITMAP_BIT_ORDER != MSBFirst) || (GLYPHPADBYTES == 4) */
|
|
||||||
|
|
||||||
#if BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER
|
|
||||||
#if PPW == 32
|
|
||||||
#define GetBits4 c = *char1++ | \
|
|
||||||
SCRRIGHT (*char2++, xoff2) | \
|
|
||||||
SCRRIGHT (*char3++, xoff3) | \
|
|
||||||
SCRRIGHT (*char4++, xoff4);
|
|
||||||
#else /* PPW == 64 */
|
|
||||||
#define GetBits4 c = (unsigned long)(((*char1++) << 64 ) | \
|
|
||||||
(SCRRIGHT (*char2++, xoff2) << 64 ) | \
|
|
||||||
(SCRRIGHT (*char3++, xoff3) << 64 ) | \
|
|
||||||
(SCRRIGHT (*char4++, xoff4) << 64 ) | \
|
|
||||||
SCRRIGHT (*char5++, xoff5) | \
|
|
||||||
SCRRIGHT (*char6++, xoff6) | \
|
|
||||||
SCRRIGHT (*char7++, xoff7) | \
|
|
||||||
SCRRIGHT (*char8++, xoff8));
|
|
||||||
#endif /* PPW */
|
|
||||||
#else /* BITMAP_BIT_ORDER != IMAGE_BYTE_ORDER */
|
|
||||||
#if PPW == 32
|
|
||||||
#define GetBits4 c = *char1++ | \
|
|
||||||
SCRRIGHT (*char2, xoff2) | \
|
|
||||||
SCRRIGHT (*char3, xoff3) | \
|
|
||||||
SCRRIGHT (*char4, xoff4); \
|
|
||||||
char2++; char3++; char4++;
|
|
||||||
#else /* PPW == 64 */
|
|
||||||
#define GetBits4 c = (unsigned long)(((*char1++) << 64 ) | \
|
|
||||||
(SCRRIGHT (*char2, xoff2) << 64 ) | \
|
|
||||||
(SCRRIGHT (*char3, xoff3) << 64 ) | \
|
|
||||||
(SCRRIGHT (*char4, xoff4) << 64 ) | \
|
|
||||||
SCRRIGHT (*char5, xoff5) | \
|
|
||||||
SCRRIGHT (*char6, xoff6) | \
|
|
||||||
SCRRIGHT (*char7, xoff7) | \
|
|
||||||
SCRRIGHT (*char8, xoff8)); \
|
|
||||||
char2++; char3++; char4++; \
|
|
||||||
char5++; char6++; char7++; char8++;
|
|
||||||
#endif /* PPW */
|
|
||||||
#endif /* BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER */
|
|
||||||
|
|
||||||
#endif /* BITMAP_BIT_ORDER && GLYPHPADBYTES */
|
|
||||||
|
|
||||||
|
|
||||||
#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
|
|
||||||
|
|
||||||
#ifdef USE_LEFTBITS
|
|
||||||
#define GetBits1 getleftbits (char1, widthGlyph, c); \
|
|
||||||
c &= glyphMask; \
|
|
||||||
char1 = (glyphPointer) (((char *) char1) + glyphBytes);
|
|
||||||
#else
|
|
||||||
#define GetBits1 c = *char1++;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
|
||||||
ilbmTEGlyphBlt (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;
|
|
||||||
PixelType *pdstBase; /* pointer to longword with top row
|
|
||||||
of current glyph */
|
|
||||||
|
|
||||||
int h; /* height of glyph and char */
|
|
||||||
register int xpos; /* current x */
|
|
||||||
int ypos; /* current y */
|
|
||||||
int widthGlyph;
|
|
||||||
|
|
||||||
int hTmp; /* counter for height */
|
|
||||||
register PixelType startmask, endmask;
|
|
||||||
int nfirst; /* used if glyphs spans a longword boundary */
|
|
||||||
BoxRec bbox; /* for clipping */
|
|
||||||
int widthGlyphs;
|
|
||||||
int auxDst;
|
|
||||||
int depthDst;
|
|
||||||
PixelType *saveDst;
|
|
||||||
register PixelType *dst;
|
|
||||||
register PixelType c;
|
|
||||||
register int d;
|
|
||||||
register int xoff1, xoff2, xoff3, xoff4;
|
|
||||||
register glyphPointer char1, char2, char3, char4;
|
|
||||||
glyphPointer schar1, schar2, schar3, schar4;
|
|
||||||
#if PPW == 64
|
|
||||||
register int xoff5, xoff6, xoff7, xoff8;
|
|
||||||
register glyphPointer char5, char6, char7, char8;
|
|
||||||
glyphPointer schar5, schar6, schar7, schar8;
|
|
||||||
#endif /* PPW */
|
|
||||||
|
|
||||||
unsigned char *rrops;
|
|
||||||
#ifdef USE_LEFTBITS
|
|
||||||
register PixelType glyphMask;
|
|
||||||
register PixelType tmpSrc;
|
|
||||||
register int glyphBytes;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ilbmGetPixelWidthAuxDepthAndPointer(pDrawable, widthDst, auxDst, depthDst,
|
|
||||||
pdstBase);
|
|
||||||
|
|
||||||
xpos = x + pDrawable->x;
|
|
||||||
ypos = y + pDrawable->y;
|
|
||||||
|
|
||||||
widthGlyph = FONTMAXBOUNDS(pfont,characterWidth);
|
|
||||||
h = FONTASCENT(pfont) + FONTDESCENT(pfont);
|
|
||||||
|
|
||||||
xpos += FONTMAXBOUNDS(pfont,leftSideBearing);
|
|
||||||
ypos -= FONTASCENT(pfont);
|
|
||||||
|
|
||||||
rrops = ((ilbmPrivGCPtr) pGC->devPrivates[ilbmGCPrivateIndex].ptr)->rropOS;
|
|
||||||
|
|
||||||
bbox.x1 = xpos;
|
|
||||||
bbox.x2 = xpos + (widthGlyph * nglyph);
|
|
||||||
bbox.y1 = ypos;
|
|
||||||
bbox.y2 = ypos + h;
|
|
||||||
|
|
||||||
switch (RECT_IN_REGION(pGC->pScreen, pGC->pCompositeClip, &bbox)) {
|
|
||||||
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...
|
|
||||||
*/
|
|
||||||
ilbmImageGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
|
|
||||||
case rgnOUT:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
pdstBase = ilbmScanlineDeltaNoBankSwitch(pdstBase, ypos, auxDst);
|
|
||||||
widthGlyphs = widthGlyph * PGSZB;
|
|
||||||
|
|
||||||
#ifdef USE_LEFTBITS
|
|
||||||
glyphMask = endtab[widthGlyph];
|
|
||||||
glyphBytes = GLYPHWIDTHBYTESPADDED(*ppci);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (nglyph >= PGSZB && widthGlyphs <= PPW) {
|
|
||||||
while (nglyph >= PGSZB) {
|
|
||||||
nglyph -= PGSZB;
|
|
||||||
xoff1 = xpos & PIM;
|
|
||||||
xoff2 = widthGlyph;
|
|
||||||
xoff3 = xoff2 + widthGlyph;
|
|
||||||
xoff4 = xoff3 + widthGlyph;
|
|
||||||
#if PPW == 64
|
|
||||||
xoff5 = xoff4 + widthGlyph;
|
|
||||||
xoff6 = xoff5 + widthGlyph;
|
|
||||||
xoff7 = xoff6 + widthGlyph;
|
|
||||||
xoff8 = xoff7 + widthGlyph;
|
|
||||||
#endif /* PPW */
|
|
||||||
schar1 = (glyphPointer)FONTGLYPHBITS(pglyphBase,(*ppci++));
|
|
||||||
schar2 = (glyphPointer)FONTGLYPHBITS(pglyphBase,(*ppci++));
|
|
||||||
schar3 = (glyphPointer)FONTGLYPHBITS(pglyphBase,(*ppci++));
|
|
||||||
schar4 = (glyphPointer)FONTGLYPHBITS(pglyphBase,(*ppci++));
|
|
||||||
#if PPW == 64
|
|
||||||
schar5 = (glyphPointer)FONTGLYPHBITS(pglyphBase,(*ppci++));
|
|
||||||
schar6 = (glyphPointer)FONTGLYPHBITS(pglyphBase,(*ppci++));
|
|
||||||
schar7 = (glyphPointer)FONTGLYPHBITS(pglyphBase,(*ppci++));
|
|
||||||
schar8 = (glyphPointer)FONTGLYPHBITS(pglyphBase,(*ppci++));
|
|
||||||
#endif /* PPW */
|
|
||||||
|
|
||||||
hTmp = h;
|
|
||||||
saveDst = ilbmScanlineOffset(pdstBase, (xpos >> PWSH)); /* switch now */
|
|
||||||
|
|
||||||
#ifndef FASTCHARS
|
|
||||||
if (xoff1 + widthGlyphs <= PPW) {
|
|
||||||
maskpartialbits (xoff1, widthGlyphs, startmask);
|
|
||||||
#endif
|
|
||||||
for (d = 0; d < depthDst; d++) {
|
|
||||||
hTmp = h;
|
|
||||||
dst = saveDst;
|
|
||||||
saveDst += widthDst; /* @@@ NEXT PLANE @@@ */
|
|
||||||
|
|
||||||
switch (rrops[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
while (hTmp--) {
|
|
||||||
#ifdef FASTCHARS
|
|
||||||
FASTPUTBITS(0, xoff1, widthGlyphs, dst);
|
|
||||||
#else
|
|
||||||
*(dst) &= ~startmask;
|
|
||||||
#endif
|
|
||||||
ilbmScanlineInc(dst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
while (hTmp--) {
|
|
||||||
#ifdef FASTCHARS
|
|
||||||
FASTPUTBITS(~0, xoff1, widthGlyphs, dst);
|
|
||||||
#else
|
|
||||||
*(dst) |= startmask;
|
|
||||||
#endif
|
|
||||||
ilbmScanlineInc(dst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_INVERT:
|
|
||||||
char1 = schar1;
|
|
||||||
char2 = schar2;
|
|
||||||
char3 = schar3;
|
|
||||||
char4 = schar4;
|
|
||||||
/* XXX */
|
|
||||||
while (hTmp--) {
|
|
||||||
GetBits4
|
|
||||||
#ifdef FASTCHARS
|
|
||||||
# if BITMAP_BIT_ORDER == MSBFirst
|
|
||||||
c >>= PPW - widthGlyphs;
|
|
||||||
# endif
|
|
||||||
FASTPUTBITS(~c, xoff1, widthGlyphs, dst);
|
|
||||||
#else
|
|
||||||
*(dst) = (*dst) & ~startmask | ~SCRRIGHT(c, xoff1) & startmask;
|
|
||||||
#endif
|
|
||||||
ilbmScanlineInc(dst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_COPY:
|
|
||||||
char1 = schar1;
|
|
||||||
char2 = schar2;
|
|
||||||
char3 = schar3;
|
|
||||||
char4 = schar4;
|
|
||||||
|
|
||||||
while (hTmp--) {
|
|
||||||
GetBits4
|
|
||||||
#ifdef FASTCHARS
|
|
||||||
# if BITMAP_BIT_ORDER == MSBFirst
|
|
||||||
c >>= PPW - widthGlyphs;
|
|
||||||
#endif
|
|
||||||
FASTPUTBITS(c, xoff1, widthGlyphs, dst);
|
|
||||||
#else
|
|
||||||
*(dst) = (*dst) & ~startmask | SCRRIGHT(c, xoff1) & startmask;
|
|
||||||
#endif
|
|
||||||
ilbmScanlineInc(dst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_NOP:
|
|
||||||
break;
|
|
||||||
} /* switch (rrops[d]) */
|
|
||||||
} /* for (d = ... ) */
|
|
||||||
#ifndef FASTCHARS
|
|
||||||
} else {
|
|
||||||
maskPPWbits (xoff1, widthGlyphs, startmask, endmask);
|
|
||||||
nfirst = PPW - xoff1;
|
|
||||||
for (d = 0; d < depthDst; d++) {
|
|
||||||
hTmp = h;
|
|
||||||
dst = saveDst;
|
|
||||||
saveDst += widthDst; /* @@@ NEXT PLANE @@@ */
|
|
||||||
|
|
||||||
switch (rrops[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
while (hTmp--) {
|
|
||||||
dst[0] &= ~startmask;
|
|
||||||
dst[1] &= ~endmask;
|
|
||||||
ilbmScanlineInc(dst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
while (hTmp--) {
|
|
||||||
dst[0] |= startmask;
|
|
||||||
dst[1] |= endmask;
|
|
||||||
ilbmScanlineInc(dst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_INVERT:
|
|
||||||
char1 = schar1;
|
|
||||||
char2 = schar2;
|
|
||||||
char3 = schar3;
|
|
||||||
char4 = schar4;
|
|
||||||
|
|
||||||
while (hTmp--) {
|
|
||||||
GetBits4
|
|
||||||
dst[0] = dst[0] & ~startmask |
|
|
||||||
~SCRRIGHT(c,xoff1) & startmask;
|
|
||||||
dst[1] = dst[1] & ~endmask |
|
|
||||||
~SCRLEFT(c,nfirst) & endmask;
|
|
||||||
ilbmScanlineInc(dst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_COPY:
|
|
||||||
char1 = schar1;
|
|
||||||
char2 = schar2;
|
|
||||||
char3 = schar3;
|
|
||||||
char4 = schar4;
|
|
||||||
|
|
||||||
while (hTmp--) {
|
|
||||||
GetBits4
|
|
||||||
dst[0] = dst[0] & ~startmask |
|
|
||||||
SCRRIGHT(c,xoff1) & startmask;
|
|
||||||
dst[1] = dst[1] & ~endmask |
|
|
||||||
SCRLEFT(c,nfirst) & endmask;
|
|
||||||
ilbmScanlineInc(dst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RROP_NOP:
|
|
||||||
break;
|
|
||||||
} /* switch */
|
|
||||||
} /* for (d = ... ) */
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
xpos += widthGlyphs;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
while (nglyph--) {
|
|
||||||
xoff1 = xpos & PIM;
|
|
||||||
schar1 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++));
|
|
||||||
hTmp = h;
|
|
||||||
saveDst = ilbmScanlineOffset(pdstBase, (xpos >> PWSH));
|
|
||||||
|
|
||||||
if (xoff1 + widthGlyph <= PPW) {
|
|
||||||
maskpartialbits (xoff1, widthGlyph, startmask);
|
|
||||||
|
|
||||||
for (d = 0; d < depthDst; d++) {
|
|
||||||
hTmp = h;
|
|
||||||
dst = saveDst;
|
|
||||||
saveDst += widthDst; /* @@@ NEXT PLANE @@@ */
|
|
||||||
char1 = schar1;
|
|
||||||
|
|
||||||
switch (rrops[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
while (hTmp--) {
|
|
||||||
(*dst) &= ~startmask;
|
|
||||||
ilbmScanlineInc(dst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
while (hTmp--) {
|
|
||||||
(*dst) |= startmask;
|
|
||||||
ilbmScanlineInc(dst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_INVERT:
|
|
||||||
while (hTmp--) {
|
|
||||||
#ifdef FASTCHARS
|
|
||||||
#ifdef USE_LEFTBITS
|
|
||||||
FASTGETBITS (char1,0,widthGlyph,c);
|
|
||||||
char1 = (glyphPointer) (((char *) char1) + glyphBytes);
|
|
||||||
#else
|
|
||||||
c = *char1++;
|
|
||||||
#if BITMAP_BIT_ORDER == MSBFirst
|
|
||||||
c >>= PPW - widthGlyph;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
FASTPUTBITS (~c,xoff1,widthGlyph,dst);
|
|
||||||
#else
|
|
||||||
GetBits1
|
|
||||||
(*dst) = (*dst) & ~startmask | ~SCRRIGHT(c, xoff1) & startmask;
|
|
||||||
#endif
|
|
||||||
ilbmScanlineInc(dst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_COPY:
|
|
||||||
while (hTmp--) {
|
|
||||||
#ifdef FASTCHARS
|
|
||||||
#ifdef USE_LEFTBITS
|
|
||||||
FASTGETBITS (char1,0,widthGlyph,c);
|
|
||||||
char1 = (glyphPointer) (((char *) char1) + glyphBytes);
|
|
||||||
#else
|
|
||||||
c = *char1++;
|
|
||||||
#if BITMAP_BIT_ORDER == MSBFirst
|
|
||||||
c >>= PPW - widthGlyph;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
FASTPUTBITS (c,xoff1,widthGlyph,dst);
|
|
||||||
#else
|
|
||||||
GetBits1
|
|
||||||
(*dst) = (*dst) & ~startmask | SCRRIGHT(c, xoff1) & startmask;
|
|
||||||
#endif
|
|
||||||
ilbmScanlineInc(dst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_NOP:
|
|
||||||
break;
|
|
||||||
} /* switch */
|
|
||||||
} /* for (d = ...) */
|
|
||||||
} else {
|
|
||||||
maskPPWbits (xoff1, widthGlyph, startmask, endmask);
|
|
||||||
nfirst = PPW - xoff1;
|
|
||||||
|
|
||||||
for (d = 0; d < depthDst; d++) {
|
|
||||||
hTmp = h;
|
|
||||||
dst = saveDst;
|
|
||||||
saveDst += widthDst; /* @@@ NEXT PLANE @@@ */
|
|
||||||
char1 = schar1;
|
|
||||||
|
|
||||||
switch (rrops[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
while (hTmp--) {
|
|
||||||
dst[0] &= ~startmask;
|
|
||||||
dst[1] &= ~endmask;
|
|
||||||
ilbmScanlineInc(dst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
while (hTmp--) {
|
|
||||||
dst[0] |= startmask;
|
|
||||||
dst[1] |= endmask;
|
|
||||||
ilbmScanlineInc(dst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_INVERT:
|
|
||||||
while (hTmp--) {
|
|
||||||
GetBits1
|
|
||||||
dst[0] = dst[0] & ~startmask |
|
|
||||||
~SCRRIGHT(c,xoff1) & startmask;
|
|
||||||
dst[1] = dst[1] & ~endmask |
|
|
||||||
~SCRLEFT(c,nfirst) & endmask;
|
|
||||||
ilbmScanlineInc(dst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_COPY:
|
|
||||||
while (hTmp--) {
|
|
||||||
GetBits1
|
|
||||||
dst[0] = dst[0] & ~startmask |
|
|
||||||
SCRRIGHT(c,xoff1) & startmask;
|
|
||||||
dst[1] = dst[1] & ~endmask |
|
|
||||||
SCRLEFT(c,nfirst) & endmask;
|
|
||||||
ilbmScanlineInc(dst, auxDst);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case RROP_NOP:
|
|
||||||
break;
|
|
||||||
} /* switch */
|
|
||||||
} /* for (d = ...) */
|
|
||||||
}
|
|
||||||
|
|
||||||
xpos += widthGlyph;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
857
ilbm/ilbmtile.c
857
ilbm/ilbmtile.c
@@ -1,857 +0,0 @@
|
|||||||
/* $XFree86$ */
|
|
||||||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
|
||||||
/***********************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
******************************************************************/
|
|
||||||
/* $XConsortium: ilbmtile.c,v 5.8 94/04/17 20:28:36 dpw Exp $ */
|
|
||||||
|
|
||||||
/* Modified jun 95 by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
|
|
||||||
to use interleaved bitplanes instead of normal bitplanes */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
|
|
||||||
#include "windowstr.h"
|
|
||||||
#include "regionstr.h"
|
|
||||||
#include "pixmapstr.h"
|
|
||||||
#include "scrnintstr.h"
|
|
||||||
|
|
||||||
#include "ilbm.h"
|
|
||||||
#include "maskbits.h"
|
|
||||||
|
|
||||||
#include "mergerop.h"
|
|
||||||
/*
|
|
||||||
|
|
||||||
the boxes are already translated.
|
|
||||||
|
|
||||||
NOTE:
|
|
||||||
iy = ++iy < tileHeight ? iy : 0
|
|
||||||
is equivalent to iy%= tileheight, and saves a division.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
tile area with a PPW bit wide pixmap
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
MROP_NAME(ilbmTileAreaPPW)(pDraw, nbox, pbox, alu, ptile, planemask)
|
|
||||||
DrawablePtr pDraw;
|
|
||||||
int nbox;
|
|
||||||
BoxPtr pbox;
|
|
||||||
int alu;
|
|
||||||
PixmapPtr ptile;
|
|
||||||
unsigned long planemask;
|
|
||||||
{
|
|
||||||
register PixelType *psrc;
|
|
||||||
/* pointer to bits in tile, if needed */
|
|
||||||
int tileHeight; /* height of the tile */
|
|
||||||
register PixelType srcpix;
|
|
||||||
int nlwidth; /* width in longwords of the drawable */
|
|
||||||
int w; /* width of current box */
|
|
||||||
MROP_DECLARE_REG ()
|
|
||||||
register int h; /* height of current box */
|
|
||||||
register int nlw; /* loop version of nlwMiddle */
|
|
||||||
register PixelType *p; /* pointer to bits we're writing */
|
|
||||||
int auxDst;
|
|
||||||
int depthDst;
|
|
||||||
int tlwidth;
|
|
||||||
register int d;
|
|
||||||
PixelType startmask;
|
|
||||||
PixelType 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 iy; /* index of current scanline in tile */
|
|
||||||
PixelType *pbits; /* pointer to start of drawable */
|
|
||||||
PixelType *saveP;
|
|
||||||
PixelType *pSaveSrc;
|
|
||||||
int saveH;
|
|
||||||
int saveIY;
|
|
||||||
|
|
||||||
ilbmGetPixelWidthAuxDepthAndPointer(pDraw, nlwidth, auxDst, depthDst,
|
|
||||||
pbits);
|
|
||||||
|
|
||||||
MROP_INITIALIZE(alu,~0)
|
|
||||||
|
|
||||||
tileHeight = ptile->drawable.height;
|
|
||||||
tlwidth = ptile->devKind/sizeof(PixelType);
|
|
||||||
pSaveSrc = (PixelType *)(ptile->devPrivate.ptr);
|
|
||||||
|
|
||||||
while (nbox--) {
|
|
||||||
w = pbox->x2 - pbox->x1;
|
|
||||||
saveH = pbox->y2 - pbox->y1;
|
|
||||||
saveIY = pbox->y1 % tileHeight;
|
|
||||||
saveP = ilbmScanline(pbits, pbox->x1, pbox->y1, auxDst);
|
|
||||||
psrc = pSaveSrc;
|
|
||||||
|
|
||||||
if (((pbox->x1 & PIM) + w) < PPW) {
|
|
||||||
maskpartialbits(pbox->x1, w, startmask);
|
|
||||||
nlwExtra = auxDst;
|
|
||||||
for (d = 0; d < depthDst; d++, saveP += nlwidth, psrc += tileHeight) { /* @@@ NEXT PLANE @@@ */
|
|
||||||
if (!(planemask & (1 << d)))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
p = saveP;
|
|
||||||
h = saveH;
|
|
||||||
iy = saveIY;
|
|
||||||
|
|
||||||
while (h--) {
|
|
||||||
srcpix = psrc[iy];
|
|
||||||
iy++;
|
|
||||||
if (iy == tileHeight)
|
|
||||||
iy = 0;
|
|
||||||
*p = MROP_MASK(srcpix,*p,startmask);
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
maskbits(pbox->x1, w, startmask, endmask, nlwMiddle);
|
|
||||||
|
|
||||||
for (d = 0; d < depthDst; d++, saveP += nlwidth, psrc += tileHeight) { /* @@@ NEXT PLANE @@@ */
|
|
||||||
if (!(planemask & (1 << d)))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
p = saveP;
|
|
||||||
h = saveH;
|
|
||||||
iy = saveIY;
|
|
||||||
nlwExtra = auxDst - nlwMiddle;
|
|
||||||
|
|
||||||
if (startmask && endmask) {
|
|
||||||
nlwExtra -= 1;
|
|
||||||
while (h--) {
|
|
||||||
srcpix = psrc[iy];
|
|
||||||
iy++;
|
|
||||||
if (iy == tileHeight)
|
|
||||||
iy = 0;
|
|
||||||
nlw = nlwMiddle;
|
|
||||||
*p = MROP_MASK (srcpix,*p,startmask);
|
|
||||||
p++;
|
|
||||||
while (nlw--) {
|
|
||||||
*p = MROP_SOLID(srcpix,*p);
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
|
|
||||||
*p = MROP_MASK(srcpix,*p,endmask);
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
} else if (startmask && !endmask) {
|
|
||||||
nlwExtra -= 1;
|
|
||||||
while (h--) {
|
|
||||||
srcpix = psrc[iy];
|
|
||||||
iy++;
|
|
||||||
if (iy == tileHeight)
|
|
||||||
iy = 0;
|
|
||||||
nlw = nlwMiddle;
|
|
||||||
*p = MROP_MASK(srcpix,*p,startmask);
|
|
||||||
p++;
|
|
||||||
while (nlw--) {
|
|
||||||
*p = MROP_SOLID(srcpix,*p);
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
} else if (!startmask && endmask) {
|
|
||||||
while (h--) {
|
|
||||||
srcpix = psrc[iy];
|
|
||||||
iy++;
|
|
||||||
if (iy == tileHeight)
|
|
||||||
iy = 0;
|
|
||||||
nlw = nlwMiddle;
|
|
||||||
while (nlw--) {
|
|
||||||
*p = MROP_SOLID(srcpix,*p);
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
|
|
||||||
*p = MROP_MASK(srcpix,*p,endmask);
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
} else { /* no ragged bits at either end */
|
|
||||||
while (h--) {
|
|
||||||
srcpix = psrc[iy];
|
|
||||||
iy++;
|
|
||||||
if (iy == tileHeight)
|
|
||||||
iy = 0;
|
|
||||||
nlw = nlwMiddle;
|
|
||||||
while (nlw--) {
|
|
||||||
*p = MROP_SOLID (srcpix,*p);
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} /* for (d = ...) */
|
|
||||||
}
|
|
||||||
pbox++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
MROP_NAME(ilbmTileArea)(pDraw, nbox, pbox, alu, pTile, xOff, yOff, planemask)
|
|
||||||
DrawablePtr pDraw;
|
|
||||||
int nbox;
|
|
||||||
BoxPtr pbox;
|
|
||||||
int alu;
|
|
||||||
PixmapPtr pTile;
|
|
||||||
int xOff;
|
|
||||||
int yOff;
|
|
||||||
unsigned long planemask;
|
|
||||||
{
|
|
||||||
register PixelType *psrc;
|
|
||||||
/* pointer to bits in tile, if needed */
|
|
||||||
int nlwidth; /* width in longwords of the drawable */
|
|
||||||
MROP_DECLARE_REG ()
|
|
||||||
register int h; /* height of current box */
|
|
||||||
register PixelType *pdst; /* pointer to bits we're writing */
|
|
||||||
register PixelType tmpsrc, tmpdst;
|
|
||||||
int auxDst;
|
|
||||||
int depthDst;
|
|
||||||
int sizeTile;
|
|
||||||
int tileLine;
|
|
||||||
int iline;
|
|
||||||
int w, width, x, xSrc, ySrc, srcStartOver, nend;
|
|
||||||
int tlwidth, rem, tileWidth, tileHeight, endinc;
|
|
||||||
int saveW;
|
|
||||||
PixelType *psrcT;
|
|
||||||
int d;
|
|
||||||
int nstart;
|
|
||||||
PixelType startmask;
|
|
||||||
PixelType endmask; /* masks for reggedy bits at either end of line */
|
|
||||||
int nlMiddle; /* number of longwords between sides of boxes */
|
|
||||||
int iy;
|
|
||||||
PixelType *pBase; /* pointer to start of drawable */
|
|
||||||
PixelType *saveP;
|
|
||||||
PixelType *pStartDst;
|
|
||||||
PixelType *pStartTile;
|
|
||||||
int saveH;
|
|
||||||
|
|
||||||
ilbmGetPixelWidthAuxDepthAndPointer(pDraw, nlwidth, auxDst, depthDst,
|
|
||||||
pBase);
|
|
||||||
|
|
||||||
MROP_INITIALIZE(alu,~0)
|
|
||||||
|
|
||||||
tileHeight = pTile->drawable.height;
|
|
||||||
tileWidth = pTile->drawable.width;
|
|
||||||
tlwidth = pTile->devKind/sizeof(PixelType);
|
|
||||||
sizeTile = tlwidth * tileHeight;
|
|
||||||
|
|
||||||
xSrc = pDraw->x + ((xOff % tileWidth) - tileWidth);
|
|
||||||
ySrc = pDraw->y + ((yOff % tileHeight) - tileHeight);
|
|
||||||
|
|
||||||
while (nbox--) {
|
|
||||||
saveW = pbox->x2 - pbox->x1;
|
|
||||||
iline = (pbox->y1 - ySrc) % tileHeight;
|
|
||||||
psrcT = (PixelType *) pTile->devPrivate.ptr;
|
|
||||||
tileLine = iline * tlwidth;
|
|
||||||
saveH = pbox->y2 - pbox->y1;
|
|
||||||
saveP = ilbmScanline(pBase, pbox->x1, pbox->y1, auxDst);
|
|
||||||
|
|
||||||
for (d = 0; d < depthDst; d++, psrcT += sizeTile, saveP += nlwidth) { /* @@@ NEXT PLANE @@@ */
|
|
||||||
if (!(planemask & (1 << d)))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
h = saveH;
|
|
||||||
pStartDst = saveP;
|
|
||||||
pStartTile = psrcT + tileLine;
|
|
||||||
iy = iline;
|
|
||||||
|
|
||||||
while (h--) {
|
|
||||||
x = pbox->x1;
|
|
||||||
width = saveW;
|
|
||||||
pdst = pStartDst;
|
|
||||||
while (width > 0) {
|
|
||||||
psrc = pStartTile;
|
|
||||||
w = min(tileWidth, width);
|
|
||||||
if ((rem = (x - xSrc) % tileWidth) != 0) {
|
|
||||||
/* if we're in the middle of the tile, get
|
|
||||||
as many bits as will finish the span, or
|
|
||||||
as many as will get to the left edge of the tile,
|
|
||||||
or a longword worth, starting at the appropriate
|
|
||||||
offset in the tile.
|
|
||||||
*/
|
|
||||||
w = min(min(tileWidth - rem, width), BITMAP_SCANLINE_PAD);
|
|
||||||
endinc = rem / BITMAP_SCANLINE_PAD;
|
|
||||||
|
|
||||||
getbits ((psrc+endinc), (rem&PIM), w, tmpsrc);
|
|
||||||
#if (MROP) != Mcopy
|
|
||||||
getbits (pdst, (x & PIM), w, tmpdst);
|
|
||||||
tmpsrc = DoMergeRop (tmpsrc, tmpdst);
|
|
||||||
#endif
|
|
||||||
putbits (tmpsrc, (x & PIM), w, pdst);
|
|
||||||
|
|
||||||
if ((x & PIM) + w >= PPW)
|
|
||||||
pdst++;
|
|
||||||
} else if (((x & PIM) + w) < PPW) {
|
|
||||||
/* doing < PPW bits is easy, and worth special-casing */
|
|
||||||
tmpsrc = *psrc;
|
|
||||||
#if (MROP) != Mcopy
|
|
||||||
getbits (pdst, (x & PIM), w, tmpdst);
|
|
||||||
tmpsrc = DoMergeRop (tmpsrc, tmpdst);
|
|
||||||
#endif
|
|
||||||
putbits (tmpsrc, (x & PIM), w, pdst);
|
|
||||||
} else {
|
|
||||||
/* start at the left edge of the tile,
|
|
||||||
and put down as much as we can
|
|
||||||
*/
|
|
||||||
maskbits(x, w, startmask, endmask, nlMiddle);
|
|
||||||
|
|
||||||
if (startmask)
|
|
||||||
nstart = PPW - (x & PIM);
|
|
||||||
else
|
|
||||||
nstart = 0;
|
|
||||||
if (endmask)
|
|
||||||
nend = (x + w) & PIM;
|
|
||||||
else
|
|
||||||
nend = 0;
|
|
||||||
|
|
||||||
srcStartOver = nstart > PLST;
|
|
||||||
|
|
||||||
if (startmask) {
|
|
||||||
tmpsrc = *psrc;
|
|
||||||
#if (MROP) != Mcopy
|
|
||||||
getbits (pdst, (x & PIM), nstart, tmpdst);
|
|
||||||
tmpsrc = DoMergeRop (tmpsrc, tmpdst);
|
|
||||||
#endif
|
|
||||||
putbits (tmpsrc, (x & PIM), nstart, pdst);
|
|
||||||
pdst++;
|
|
||||||
if (srcStartOver)
|
|
||||||
psrc++;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (nlMiddle--) {
|
|
||||||
getbits (psrc, nstart, PPW, tmpsrc);
|
|
||||||
#if (MROP) != Mcopy
|
|
||||||
tmpdst = *pdst;
|
|
||||||
tmpsrc = DoMergeRop (tmpsrc, tmpdst);
|
|
||||||
#endif
|
|
||||||
*pdst++ = tmpsrc;
|
|
||||||
/*putbits (tmpsrc, 0, PPW, pdst);
|
|
||||||
pdst++;*/
|
|
||||||
psrc++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (endmask) {
|
|
||||||
getbits (psrc, nstart, nend, tmpsrc);
|
|
||||||
#if (MROP) != Mcopy
|
|
||||||
tmpdst = *pdst;
|
|
||||||
tmpsrc = DoMergeRop (tmpsrc, tmpdst);
|
|
||||||
#endif
|
|
||||||
putbits (tmpsrc, 0, nend, pdst);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
x += w;
|
|
||||||
width -= w;
|
|
||||||
} /* while (width > 0) */
|
|
||||||
|
|
||||||
pStartDst += auxDst;
|
|
||||||
if (++iy >= tileHeight) {
|
|
||||||
iy = 0;
|
|
||||||
pStartTile = psrcT;
|
|
||||||
} else
|
|
||||||
pStartTile += tlwidth;
|
|
||||||
|
|
||||||
} /* while (h) */
|
|
||||||
} /* for (d = ... ) */
|
|
||||||
pbox++;
|
|
||||||
} /* for each box */
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
MROP_NAME(ilbmOpaqueStippleAreaPPW)(pDraw, nbox, pbox, alu, ptile,
|
|
||||||
rropsOS, planemask)
|
|
||||||
DrawablePtr pDraw;
|
|
||||||
int nbox;
|
|
||||||
BoxPtr pbox;
|
|
||||||
int alu;
|
|
||||||
PixmapPtr ptile;
|
|
||||||
register unsigned char *rropsOS;
|
|
||||||
unsigned long planemask;
|
|
||||||
{
|
|
||||||
register PixelType *psrc;
|
|
||||||
/* pointer to bits in tile, if needed */
|
|
||||||
int tileHeight; /* height of the tile */
|
|
||||||
register PixelType srcpix;
|
|
||||||
int nlwidth; /* width in longwords of the drawable */
|
|
||||||
int w; /* width of current box */
|
|
||||||
MROP_DECLARE_REG ()
|
|
||||||
register int h; /* height of current box */
|
|
||||||
register int nlw; /* loop version of nlwMiddle */
|
|
||||||
register PixelType *p; /* pointer to bits we're writing */
|
|
||||||
int auxDst;
|
|
||||||
int depthDst;
|
|
||||||
register int d;
|
|
||||||
PixelType startmask;
|
|
||||||
PixelType 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 iy; /* index of current scanline in tile */
|
|
||||||
PixelType *pbits; /* pointer to start of drawable */
|
|
||||||
PixelType *saveP;
|
|
||||||
int saveH;
|
|
||||||
int saveIY;
|
|
||||||
|
|
||||||
ilbmGetPixelWidthAuxDepthAndPointer(pDraw, nlwidth, auxDst, depthDst,
|
|
||||||
pbits);
|
|
||||||
|
|
||||||
MROP_INITIALIZE(alu,~0)
|
|
||||||
|
|
||||||
tileHeight = ptile->drawable.height;
|
|
||||||
psrc = (PixelType *)(ptile->devPrivate.ptr);
|
|
||||||
|
|
||||||
while (nbox--) {
|
|
||||||
w = pbox->x2 - pbox->x1;
|
|
||||||
saveH = pbox->y2 - pbox->y1;
|
|
||||||
saveIY = pbox->y1 % tileHeight;
|
|
||||||
saveP = ilbmScanline(pbits, pbox->x1, pbox->y1, auxDst);
|
|
||||||
|
|
||||||
if ( ((pbox->x1 & PIM) + w) < PPW) {
|
|
||||||
maskpartialbits(pbox->x1, w, startmask);
|
|
||||||
nlwExtra = auxDst;
|
|
||||||
for (d = 0; d < depthDst; d++, saveP += nlwidth) { /* @@@ NEXT PLANE @@@ */
|
|
||||||
if (!(planemask & (1 << d)))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
p = saveP;
|
|
||||||
h = saveH;
|
|
||||||
iy = saveIY;
|
|
||||||
|
|
||||||
while (h--) {
|
|
||||||
switch (rropsOS[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
srcpix = 0;
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
srcpix = ~0;
|
|
||||||
break;
|
|
||||||
case RROP_COPY:
|
|
||||||
srcpix = psrc[iy];
|
|
||||||
break;
|
|
||||||
case RROP_INVERT:
|
|
||||||
srcpix = ~psrc[iy];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
iy++;
|
|
||||||
if (iy == tileHeight)
|
|
||||||
iy = 0;
|
|
||||||
*p = MROP_MASK(srcpix,*p,startmask);
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
maskbits(pbox->x1, w, startmask, endmask, nlwMiddle);
|
|
||||||
|
|
||||||
for (d = 0; d < depthDst; d++, saveP += nlwidth) { /* @@@ NEXT PLANE @@@ */
|
|
||||||
if (!(planemask & (1 << d)))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
p = saveP;
|
|
||||||
h = saveH;
|
|
||||||
iy = saveIY;
|
|
||||||
nlwExtra = auxDst - nlwMiddle;
|
|
||||||
|
|
||||||
if (startmask && endmask) {
|
|
||||||
nlwExtra -= 1;
|
|
||||||
while (h--) {
|
|
||||||
switch (rropsOS[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
srcpix = 0;
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
srcpix = ~0;
|
|
||||||
break;
|
|
||||||
case RROP_COPY:
|
|
||||||
srcpix = psrc[iy];
|
|
||||||
break;
|
|
||||||
case RROP_INVERT:
|
|
||||||
srcpix = ~psrc[iy];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
iy++;
|
|
||||||
if (iy == tileHeight)
|
|
||||||
iy = 0;
|
|
||||||
nlw = nlwMiddle;
|
|
||||||
*p = MROP_MASK (srcpix,*p,startmask);
|
|
||||||
p++;
|
|
||||||
while (nlw--) {
|
|
||||||
*p = MROP_SOLID(srcpix,*p);
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
|
|
||||||
*p = MROP_MASK(srcpix,*p,endmask);
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
} else if (startmask && !endmask) {
|
|
||||||
nlwExtra -= 1;
|
|
||||||
while (h--) {
|
|
||||||
switch (rropsOS[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
srcpix = 0;
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
srcpix = ~0;
|
|
||||||
break;
|
|
||||||
case RROP_COPY:
|
|
||||||
srcpix = psrc[iy];
|
|
||||||
break;
|
|
||||||
case RROP_INVERT:
|
|
||||||
srcpix = ~psrc[iy];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
iy++;
|
|
||||||
if (iy == tileHeight)
|
|
||||||
iy = 0;
|
|
||||||
nlw = nlwMiddle;
|
|
||||||
*p = MROP_MASK(srcpix,*p,startmask);
|
|
||||||
p++;
|
|
||||||
while (nlw--) {
|
|
||||||
*p = MROP_SOLID(srcpix,*p);
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
} else if (!startmask && endmask) {
|
|
||||||
while (h--) {
|
|
||||||
switch (rropsOS[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
srcpix = 0;
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
srcpix = ~0;
|
|
||||||
break;
|
|
||||||
case RROP_COPY:
|
|
||||||
srcpix = psrc[iy];
|
|
||||||
break;
|
|
||||||
case RROP_INVERT:
|
|
||||||
srcpix = ~psrc[iy];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
iy++;
|
|
||||||
if (iy == tileHeight)
|
|
||||||
iy = 0;
|
|
||||||
nlw = nlwMiddle;
|
|
||||||
while (nlw--) {
|
|
||||||
*p = MROP_SOLID(srcpix,*p);
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
|
|
||||||
*p = MROP_MASK(srcpix,*p,endmask);
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
} else { /* no ragged bits at either end */
|
|
||||||
while (h--) {
|
|
||||||
switch (rropsOS[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
srcpix = 0;
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
srcpix = ~0;
|
|
||||||
break;
|
|
||||||
case RROP_COPY:
|
|
||||||
srcpix = psrc[iy];
|
|
||||||
break;
|
|
||||||
case RROP_INVERT:
|
|
||||||
srcpix = ~psrc[iy];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
iy++;
|
|
||||||
if (iy == tileHeight)
|
|
||||||
iy = 0;
|
|
||||||
nlw = nlwMiddle;
|
|
||||||
while (nlw--) {
|
|
||||||
*p = MROP_SOLID (srcpix,*p);
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
ilbmScanlineInc(p, nlwExtra);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} /* for (d = ...) */
|
|
||||||
}
|
|
||||||
pbox++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
MROP_NAME(ilbmOpaqueStippleArea)(pDraw, nbox, pbox, alu, pTile, xOff, yOff,
|
|
||||||
rropsOS, planemask)
|
|
||||||
DrawablePtr pDraw;
|
|
||||||
int nbox;
|
|
||||||
BoxPtr pbox;
|
|
||||||
int alu;
|
|
||||||
PixmapPtr pTile;
|
|
||||||
int xOff;
|
|
||||||
int yOff;
|
|
||||||
register unsigned char *rropsOS;
|
|
||||||
unsigned long planemask;
|
|
||||||
{
|
|
||||||
register PixelType *psrc;
|
|
||||||
/* pointer to bits in tile, if needed */
|
|
||||||
int nlwidth; /* width in longwords of the drawable */
|
|
||||||
MROP_DECLARE_REG ()
|
|
||||||
register int h; /* height of current box */
|
|
||||||
register PixelType *pdst; /* pointer to bits we're writing */
|
|
||||||
register PixelType tmpsrc, tmpdst;
|
|
||||||
int auxDst;
|
|
||||||
int depthDst;
|
|
||||||
int tileLine;
|
|
||||||
int iline;
|
|
||||||
int w, width, x, xSrc, ySrc, srcStartOver, nend;
|
|
||||||
int tlwidth, rem, tileWidth, tileHeight, endinc;
|
|
||||||
int saveW;
|
|
||||||
PixelType *psrcT;
|
|
||||||
int d;
|
|
||||||
int nstart;
|
|
||||||
PixelType startmask;
|
|
||||||
PixelType endmask; /* masks for reggedy bits at either end of line */
|
|
||||||
int nlMiddle; /* number of longwords between sides of boxes */
|
|
||||||
int iy;
|
|
||||||
PixelType *pBase; /* pointer to start of drawable */
|
|
||||||
PixelType *saveP;
|
|
||||||
PixelType *pStartDst;
|
|
||||||
PixelType *pStartTile;
|
|
||||||
int saveH;
|
|
||||||
|
|
||||||
ilbmGetPixelWidthAuxDepthAndPointer(pDraw, nlwidth, auxDst, depthDst,
|
|
||||||
pBase);
|
|
||||||
|
|
||||||
MROP_INITIALIZE(alu,~0)
|
|
||||||
|
|
||||||
tileHeight = pTile->drawable.height;
|
|
||||||
tileWidth = pTile->drawable.width;
|
|
||||||
tlwidth = pTile->devKind/sizeof(PixelType);
|
|
||||||
|
|
||||||
xSrc = pDraw->x + ((xOff % tileWidth) - tileWidth);
|
|
||||||
ySrc = pDraw->y + ((yOff % tileHeight) - tileHeight);
|
|
||||||
|
|
||||||
while (nbox--) {
|
|
||||||
saveW = pbox->x2 - pbox->x1;
|
|
||||||
iline = (pbox->y1 - ySrc) % tileHeight;
|
|
||||||
psrcT = (PixelType *) pTile->devPrivate.ptr;
|
|
||||||
tileLine = iline * tlwidth;
|
|
||||||
saveH = pbox->y2 - pbox->y1;
|
|
||||||
saveP = ilbmScanline(pBase, pbox->x1, pbox->y1, auxDst);
|
|
||||||
|
|
||||||
for (d = 0; d < depthDst; d++, saveP += nlwidth) { /* @@@ NEXT PLANE @@@ */
|
|
||||||
if (!(planemask & (1 << d)))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
h = saveH;
|
|
||||||
pStartDst = saveP;
|
|
||||||
pStartTile = psrcT + tileLine;
|
|
||||||
iy = iline;
|
|
||||||
|
|
||||||
while (h--) {
|
|
||||||
x = pbox->x1;
|
|
||||||
width = saveW;
|
|
||||||
pdst = pStartDst;
|
|
||||||
while (width > 0) {
|
|
||||||
psrc = pStartTile;
|
|
||||||
w = min(tileWidth, width);
|
|
||||||
if ((rem = (x - xSrc) % tileWidth) != 0) {
|
|
||||||
/* if we're in the middle of the tile, get
|
|
||||||
as many bits as will finish the span, or
|
|
||||||
as many as will get to the left edge of the tile,
|
|
||||||
or a longword worth, starting at the appropriate
|
|
||||||
offset in the tile.
|
|
||||||
*/
|
|
||||||
w = min(min(tileWidth - rem, width), BITMAP_SCANLINE_PAD);
|
|
||||||
endinc = rem / BITMAP_SCANLINE_PAD;
|
|
||||||
|
|
||||||
switch (rropsOS[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
tmpsrc = 0;
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
tmpsrc = ~0;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RROP_COPY:
|
|
||||||
getbits ((psrc+endinc), (rem&PIM), w, tmpsrc);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RROP_INVERT:
|
|
||||||
getbits ((psrc+endinc), (rem&PIM), w, tmpsrc);
|
|
||||||
tmpsrc = ~tmpsrc;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#if (MROP) != Mcopy
|
|
||||||
getbits (pdst, (x & PIM), w, tmpdst);
|
|
||||||
tmpsrc = DoMergeRop (tmpsrc, tmpdst);
|
|
||||||
#endif
|
|
||||||
putbits (tmpsrc, (x & PIM), w, pdst);
|
|
||||||
|
|
||||||
if ((x & PIM) + w >= PPW)
|
|
||||||
pdst++;
|
|
||||||
} else if (((x & PIM) + w) < PPW) {
|
|
||||||
/* doing < PPW bits is easy, and worth special-casing */
|
|
||||||
switch (rropsOS[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
tmpsrc = 0;
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
tmpsrc = ~0;
|
|
||||||
break;
|
|
||||||
case RROP_COPY:
|
|
||||||
tmpsrc = *psrc;
|
|
||||||
break;
|
|
||||||
case RROP_INVERT:
|
|
||||||
tmpsrc = ~*psrc;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#if (MROP) != Mcopy
|
|
||||||
getbits (pdst, (x & PIM), w, tmpdst);
|
|
||||||
tmpsrc = DoMergeRop (tmpsrc, tmpdst);
|
|
||||||
#endif
|
|
||||||
putbits (tmpsrc, (x & PIM), w, pdst);
|
|
||||||
} else {
|
|
||||||
/* start at the left edge of the tile,
|
|
||||||
and put down as much as we can
|
|
||||||
*/
|
|
||||||
maskbits(x, w, startmask, endmask, nlMiddle);
|
|
||||||
|
|
||||||
if (startmask)
|
|
||||||
nstart = PPW - (x & PIM);
|
|
||||||
else
|
|
||||||
nstart = 0;
|
|
||||||
if (endmask)
|
|
||||||
nend = (x + w) & PIM;
|
|
||||||
else
|
|
||||||
nend = 0;
|
|
||||||
|
|
||||||
srcStartOver = nstart > PLST;
|
|
||||||
|
|
||||||
if (startmask) {
|
|
||||||
switch (rropsOS[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
tmpsrc = 0;
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
tmpsrc = ~0;
|
|
||||||
break;
|
|
||||||
case RROP_COPY:
|
|
||||||
tmpsrc = *psrc;
|
|
||||||
break;
|
|
||||||
case RROP_INVERT:
|
|
||||||
tmpsrc = ~*psrc;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#if (MROP) != Mcopy
|
|
||||||
getbits (pdst, (x & PIM), nstart, tmpdst);
|
|
||||||
tmpsrc = DoMergeRop (tmpsrc, tmpdst);
|
|
||||||
#endif
|
|
||||||
putbits (tmpsrc, (x & PIM), nstart, pdst);
|
|
||||||
pdst++;
|
|
||||||
if (srcStartOver)
|
|
||||||
psrc++;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (nlMiddle--) {
|
|
||||||
switch (rropsOS[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
tmpsrc = 0;
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
tmpsrc = ~0;
|
|
||||||
break;
|
|
||||||
case RROP_COPY:
|
|
||||||
getbits (psrc, nstart, PPW, tmpsrc);
|
|
||||||
break;
|
|
||||||
case RROP_INVERT:
|
|
||||||
getbits (psrc, nstart, PPW, tmpsrc);
|
|
||||||
tmpsrc = ~tmpsrc;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#if (MROP) != Mcopy
|
|
||||||
tmpdst = *pdst;
|
|
||||||
tmpsrc = DoMergeRop (tmpsrc, tmpdst);
|
|
||||||
#endif
|
|
||||||
*pdst++ = tmpsrc;
|
|
||||||
/*putbits (tmpsrc, 0, PPW, pdst);
|
|
||||||
pdst++; */
|
|
||||||
psrc++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (endmask) {
|
|
||||||
switch (rropsOS[d]) {
|
|
||||||
case RROP_BLACK:
|
|
||||||
tmpsrc = 0;
|
|
||||||
break;
|
|
||||||
case RROP_WHITE:
|
|
||||||
tmpsrc = ~0;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RROP_COPY:
|
|
||||||
getbits (psrc, nstart, nend, tmpsrc);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RROP_INVERT:
|
|
||||||
getbits (psrc, nstart, nend, tmpsrc);
|
|
||||||
tmpsrc = ~tmpsrc;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#if (MROP) != Mcopy
|
|
||||||
tmpdst = *pdst;
|
|
||||||
tmpsrc = DoMergeRop (tmpsrc, tmpdst);
|
|
||||||
#endif
|
|
||||||
putbits (tmpsrc, 0, nend, pdst);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
x += w;
|
|
||||||
width -= w;
|
|
||||||
} /* while (width > 0) */
|
|
||||||
|
|
||||||
pStartDst += auxDst;
|
|
||||||
if (++iy >= tileHeight) {
|
|
||||||
iy = 0;
|
|
||||||
pStartTile = psrcT;
|
|
||||||
} else
|
|
||||||
pStartTile += tlwidth;
|
|
||||||
|
|
||||||
} /* while (h) */
|
|
||||||
} /* for (d = ... ) */
|
|
||||||
pbox++;
|
|
||||||
} /* for each box */
|
|
||||||
}
|
|
||||||
@@ -1,323 +0,0 @@
|
|||||||
/* $XFree86$ */
|
|
||||||
/* $XConsortium: ilbmwindow.c,v 5.14 94/04/17 20:28:36 dpw Exp $ */
|
|
||||||
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
|
|
||||||
/***********************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
******************************************************************/
|
|
||||||
|
|
||||||
/* Modified jun 95 by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
|
|
||||||
to use interleaved bitplanes instead of normal bitplanes */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include "scrnintstr.h"
|
|
||||||
#include "windowstr.h"
|
|
||||||
#include "ilbm.h"
|
|
||||||
#include "mistruct.h"
|
|
||||||
#include "regionstr.h"
|
|
||||||
#include "maskbits.h"
|
|
||||||
|
|
||||||
extern WindowPtr *WindowTable;
|
|
||||||
|
|
||||||
Bool
|
|
||||||
ilbmCreateWindow(pWin)
|
|
||||||
register WindowPtr pWin;
|
|
||||||
{
|
|
||||||
register ilbmPrivWin *pPrivWin;
|
|
||||||
|
|
||||||
pPrivWin = (ilbmPrivWin *)(pWin->devPrivates[ilbmWindowPrivateIndex].ptr);
|
|
||||||
pPrivWin->pRotatedBorder = NullPixmap;
|
|
||||||
pPrivWin->pRotatedBackground = NullPixmap;
|
|
||||||
pPrivWin->fastBackground = FALSE;
|
|
||||||
pPrivWin->fastBorder = FALSE;
|
|
||||||
#ifdef PIXMAP_PER_WINDOW
|
|
||||||
pWin->devPrivates[frameWindowPrivateIndex].ptr =
|
|
||||||
pWin->pDrawable.pScreen->devPrivates[ilbmScreenPrivateIndex].ptr;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return (TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This always returns true, because Xfree can't fail. It might be possible
|
|
||||||
* on some devices for Destroy to fail */
|
|
||||||
Bool
|
|
||||||
ilbmDestroyWindow(pWin)
|
|
||||||
WindowPtr pWin;
|
|
||||||
{
|
|
||||||
register ilbmPrivWin *pPrivWin;
|
|
||||||
|
|
||||||
pPrivWin = (ilbmPrivWin *)(pWin->devPrivates[ilbmWindowPrivateIndex].ptr);
|
|
||||||
|
|
||||||
if (pPrivWin->pRotatedBorder)
|
|
||||||
(*pWin->drawable.pScreen->DestroyPixmap)(pPrivWin->pRotatedBorder);
|
|
||||||
if (pPrivWin->pRotatedBackground)
|
|
||||||
(*pWin->drawable.pScreen->DestroyPixmap)(pPrivWin->pRotatedBackground);
|
|
||||||
|
|
||||||
return (TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*ARGSUSED*/
|
|
||||||
Bool
|
|
||||||
ilbmMapWindow(pWindow)
|
|
||||||
WindowPtr pWindow;
|
|
||||||
{
|
|
||||||
return (TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (x, y) is the upper left corner of the window on the screen
|
|
||||||
do we really need to pass this? (is it a;ready in pWin->absCorner?)
|
|
||||||
we only do the rotation for pixmaps that are 32 bits wide (padded
|
|
||||||
or otherwise.)
|
|
||||||
ilbmChangeWindowAttributes() has already put a copy of the pixmap
|
|
||||||
in pPrivWin->pRotated*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*ARGSUSED*/
|
|
||||||
Bool
|
|
||||||
ilbmPositionWindow(pWin, x, y)
|
|
||||||
WindowPtr pWin;
|
|
||||||
int x, y;
|
|
||||||
{
|
|
||||||
register ilbmPrivWin *pPrivWin;
|
|
||||||
int reset = 0;
|
|
||||||
|
|
||||||
pPrivWin = (ilbmPrivWin *)(pWin->devPrivates[ilbmWindowPrivateIndex].ptr);
|
|
||||||
if (pWin->backgroundState == BackgroundPixmap && pPrivWin->fastBackground) {
|
|
||||||
ilbmXRotatePixmap(pPrivWin->pRotatedBackground,
|
|
||||||
pWin->drawable.x - pPrivWin->oldRotate.x);
|
|
||||||
ilbmYRotatePixmap(pPrivWin->pRotatedBackground,
|
|
||||||
pWin->drawable.y - pPrivWin->oldRotate.y);
|
|
||||||
reset = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pWin->borderIsPixel && pPrivWin->fastBorder) {
|
|
||||||
while (pWin->backgroundState == ParentRelative)
|
|
||||||
pWin = pWin->parent;
|
|
||||||
ilbmXRotatePixmap(pPrivWin->pRotatedBorder,
|
|
||||||
pWin->drawable.x - pPrivWin->oldRotate.x);
|
|
||||||
ilbmYRotatePixmap(pPrivWin->pRotatedBorder,
|
|
||||||
pWin->drawable.y - pPrivWin->oldRotate.y);
|
|
||||||
reset = 1;
|
|
||||||
}
|
|
||||||
if (reset) {
|
|
||||||
pPrivWin->oldRotate.x = pWin->drawable.x;
|
|
||||||
pPrivWin->oldRotate.y = pWin->drawable.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This is the "wrong" fix to the right problem, but it doesn't really
|
|
||||||
* cost very much. When the window is moved, we need to invalidate any
|
|
||||||
* RotatedPixmap that exists in any GC currently validated against this
|
|
||||||
* window.
|
|
||||||
*/
|
|
||||||
pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER;
|
|
||||||
|
|
||||||
/* Again, we have no failure modes indicated by any of the routines
|
|
||||||
* we've called, so we have to assume it worked */
|
|
||||||
return (TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*ARGSUSED*/
|
|
||||||
Bool
|
|
||||||
ilbmUnmapWindow(pWindow)
|
|
||||||
WindowPtr pWindow;
|
|
||||||
{
|
|
||||||
return (TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* UNCLEAN!
|
|
||||||
this code calls the bitblt helper code directly.
|
|
||||||
|
|
||||||
ilbmCopyWindow copies only the parts of the destination that are
|
|
||||||
visible in the source.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
ilbmCopyWindow(pWin, ptOldOrg, prgnSrc)
|
|
||||||
WindowPtr pWin;
|
|
||||||
DDXPointRec ptOldOrg;
|
|
||||||
RegionPtr prgnSrc;
|
|
||||||
{
|
|
||||||
DDXPointPtr pptSrc;
|
|
||||||
register DDXPointPtr ppt;
|
|
||||||
RegionPtr prgnDst;
|
|
||||||
register BoxPtr pbox;
|
|
||||||
register int dx, dy;
|
|
||||||
register int i, nbox;
|
|
||||||
WindowPtr pwinRoot;
|
|
||||||
|
|
||||||
pwinRoot = WindowTable[pWin->drawable.pScreen->myNum];
|
|
||||||
|
|
||||||
prgnDst = REGION_CREATE(pWin->drawable.pScreen, NULL, 1);
|
|
||||||
|
|
||||||
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, prgnDst, &pWin->borderClip,
|
|
||||||
prgnSrc);
|
|
||||||
|
|
||||||
pbox = REGION_RECTS(prgnDst);
|
|
||||||
nbox = REGION_NUM_RECTS(prgnDst);
|
|
||||||
if (!(pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec))))
|
|
||||||
return;
|
|
||||||
ppt = pptSrc;
|
|
||||||
|
|
||||||
for (i=nbox; --i >= 0; ppt++, pbox++) {
|
|
||||||
ppt->x = pbox->x1 + dx;
|
|
||||||
ppt->y = pbox->y1 + dy;
|
|
||||||
}
|
|
||||||
|
|
||||||
ilbmDoBitblt((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot, GXcopy, prgnDst,
|
|
||||||
pptSrc, ~0);
|
|
||||||
DEALLOCATE_LOCAL(pptSrc);
|
|
||||||
REGION_DESTROY(pWin->drawable.pScreen, prgnDst);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* swap in correct PaintWindow* routine. If we can use a fast output
|
|
||||||
routine (i.e. the pixmap is paddable to 32 bits), also pre-rotate a copy
|
|
||||||
of it in devPrivate.
|
|
||||||
*/
|
|
||||||
Bool
|
|
||||||
ilbmChangeWindowAttributes(pWin, mask)
|
|
||||||
register WindowPtr pWin;
|
|
||||||
register unsigned long mask;
|
|
||||||
{
|
|
||||||
register unsigned long index;
|
|
||||||
register ilbmPrivWin *pPrivWin;
|
|
||||||
WindowPtr pBgWin;
|
|
||||||
|
|
||||||
pPrivWin = (ilbmPrivWin *)(pWin->devPrivates[ilbmWindowPrivateIndex].ptr);
|
|
||||||
/*
|
|
||||||
* When background state changes from ParentRelative and
|
|
||||||
* we had previously rotated the fast border pixmap to match
|
|
||||||
* the parent relative origin, rerotate to match window
|
|
||||||
*/
|
|
||||||
if (mask & (CWBackPixmap | CWBackPixel) &&
|
|
||||||
pWin->backgroundState != ParentRelative && pPrivWin->fastBorder &&
|
|
||||||
(pPrivWin->oldRotate.x != pWin->drawable.x ||
|
|
||||||
pPrivWin->oldRotate.y != pWin->drawable.y)) {
|
|
||||||
ilbmXRotatePixmap(pPrivWin->pRotatedBorder,
|
|
||||||
pWin->drawable.x - pPrivWin->oldRotate.x);
|
|
||||||
ilbmYRotatePixmap(pPrivWin->pRotatedBorder,
|
|
||||||
pWin->drawable.y - pPrivWin->oldRotate.y);
|
|
||||||
pPrivWin->oldRotate.x = pWin->drawable.x;
|
|
||||||
pPrivWin->oldRotate.y = pWin->drawable.y;
|
|
||||||
}
|
|
||||||
while (mask) {
|
|
||||||
index = lowbit (mask);
|
|
||||||
mask &= ~index;
|
|
||||||
switch (index) {
|
|
||||||
case CWBackPixmap:
|
|
||||||
if (pWin->backgroundState == None)
|
|
||||||
pPrivWin->fastBackground = FALSE;
|
|
||||||
else if (pWin->backgroundState == ParentRelative) {
|
|
||||||
pPrivWin->fastBackground = FALSE;
|
|
||||||
/* Rotate border to match parent origin */
|
|
||||||
if (pPrivWin->pRotatedBorder) {
|
|
||||||
for (pBgWin = pWin->parent;
|
|
||||||
pBgWin->backgroundState == ParentRelative;
|
|
||||||
pBgWin = pBgWin->parent);
|
|
||||||
ilbmXRotatePixmap(pPrivWin->pRotatedBorder,
|
|
||||||
pBgWin->drawable.x - pPrivWin->oldRotate.x);
|
|
||||||
ilbmYRotatePixmap(pPrivWin->pRotatedBorder,
|
|
||||||
pBgWin->drawable.y - pPrivWin->oldRotate.y);
|
|
||||||
pPrivWin->oldRotate.x = pBgWin->drawable.x;
|
|
||||||
pPrivWin->oldRotate.y = pBgWin->drawable.y;
|
|
||||||
}
|
|
||||||
} else if ((pWin->background.pixmap->drawable.width <= PPW) &&
|
|
||||||
!(pWin->background.pixmap->drawable.width &
|
|
||||||
(pWin->background.pixmap->drawable.width - 1))) {
|
|
||||||
ilbmCopyRotatePixmap(pWin->background.pixmap,
|
|
||||||
&pPrivWin->pRotatedBackground,
|
|
||||||
pWin->drawable.x, pWin->drawable.y);
|
|
||||||
if (pPrivWin->pRotatedBackground) {
|
|
||||||
pPrivWin->fastBackground = TRUE;
|
|
||||||
pPrivWin->oldRotate.x = pWin->drawable.x;
|
|
||||||
pPrivWin->oldRotate.y = pWin->drawable.y;
|
|
||||||
} else
|
|
||||||
pPrivWin->fastBackground = FALSE;
|
|
||||||
} else
|
|
||||||
pPrivWin->fastBackground = FALSE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CWBackPixel:
|
|
||||||
pPrivWin->fastBackground = FALSE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CWBorderPixmap:
|
|
||||||
if ((pWin->border.pixmap->drawable.width <= PPW) &&
|
|
||||||
!(pWin->border.pixmap->drawable.width &
|
|
||||||
(pWin->border.pixmap->drawable.width - 1))) {
|
|
||||||
for (pBgWin = pWin;
|
|
||||||
pBgWin->backgroundState == ParentRelative;
|
|
||||||
pBgWin = pBgWin->parent);
|
|
||||||
ilbmCopyRotatePixmap(pWin->border.pixmap,
|
|
||||||
&pPrivWin->pRotatedBorder,
|
|
||||||
pBgWin->drawable.x, pBgWin->drawable.y);
|
|
||||||
if (pPrivWin->pRotatedBorder) {
|
|
||||||
pPrivWin->fastBorder = TRUE;
|
|
||||||
pPrivWin->oldRotate.x = pBgWin->drawable.x;
|
|
||||||
pPrivWin->oldRotate.y = pBgWin->drawable.y;
|
|
||||||
} else
|
|
||||||
pPrivWin->fastBorder = FALSE;
|
|
||||||
} else
|
|
||||||
pPrivWin->fastBorder = FALSE;
|
|
||||||
break;
|
|
||||||
case CWBorderPixel:
|
|
||||||
pPrivWin->fastBorder = FALSE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* Again, we have no failure modes indicated by any of the routines
|
|
||||||
* we've called, so we have to assume it worked */
|
|
||||||
return (TRUE);
|
|
||||||
}
|
|
||||||
@@ -1,214 +0,0 @@
|
|||||||
/* $XFree86: xc/programs/Xserver/ilbm/ilbmzerarc.c,v 3.0 1996/08/18 01:54:15 dawes Exp $ */
|
|
||||||
/************************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1989 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
********************************************************/
|
|
||||||
|
|
||||||
/* $XConsortium: ilbmzerarc.c,v 5.19 94/04/17 20:28:37 dpw Exp $ */
|
|
||||||
|
|
||||||
/* 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Modified jun 95 by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
|
|
||||||
to use interleaved bitplanes instead of normal bitplanes */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include <X11/Xprotostr.h>
|
|
||||||
#include "miscstruct.h"
|
|
||||||
#include "gcstruct.h"
|
|
||||||
#include "pixmapstr.h"
|
|
||||||
#include "scrnintstr.h"
|
|
||||||
#include "ilbm.h"
|
|
||||||
#include "maskbits.h"
|
|
||||||
#include "mizerarc.h"
|
|
||||||
#include "mi.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Note: LEFTMOST must be the bit leftmost in the actual screen
|
|
||||||
* representation. This depends also on the IMAGE_BYTE_ORDER.
|
|
||||||
* LONG2CHARS() takes care of the re-ordering as required. (DHD)
|
|
||||||
*/
|
|
||||||
#if (BITMAP_BIT_ORDER == MSBFirst)
|
|
||||||
#define LEFTMOST ((PixelType) LONG2CHARS((1 << PLST)))
|
|
||||||
#else
|
|
||||||
#define LEFTMOST ((PixelType) LONG2CHARS(1))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define Pixelate(base,yoff,xoff) \
|
|
||||||
{ \
|
|
||||||
paddr = ilbmScanlineOffset(base, (yoff) + ((xoff)>>PWSH)); \
|
|
||||||
pmask = SCRRIGHT(LEFTMOST, (xoff) & PIM); \
|
|
||||||
for (de = 0; de < depthDst; de++, paddr += nlwidth) /* @@@ NEXT PLANE @@@ */ \
|
|
||||||
switch (rrops[de]) { \
|
|
||||||
case RROP_BLACK: \
|
|
||||||
*paddr &= ~pmask; \
|
|
||||||
break; \
|
|
||||||
case RROP_WHITE: \
|
|
||||||
*paddr |= pmask; \
|
|
||||||
break; \
|
|
||||||
case RROP_INVERT: \
|
|
||||||
*paddr ^= pmask; \
|
|
||||||
break; \
|
|
||||||
case RROP_NOP: \
|
|
||||||
break; \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define DoPix(bit,base,yoff,xoff) if (mask & bit) Pixelate(base,yoff,xoff);
|
|
||||||
|
|
||||||
static void
|
|
||||||
ilbmZeroArcSS(pDraw, pGC, arc)
|
|
||||||
DrawablePtr pDraw;
|
|
||||||
GCPtr pGC;
|
|
||||||
xArc *arc;
|
|
||||||
{
|
|
||||||
miZeroArcRec info;
|
|
||||||
Bool do360;
|
|
||||||
register int de;
|
|
||||||
register int x, y, a, b, d, mask;
|
|
||||||
register int k1, k3, dx, dy;
|
|
||||||
PixelType *addrl;
|
|
||||||
PixelType *yorgl, *yorgol;
|
|
||||||
PixelType pixel;
|
|
||||||
int nlwidth, yoffset, dyoffset;
|
|
||||||
int auxDst, depthDst;
|
|
||||||
PixelType pmask;
|
|
||||||
register PixelType *paddr;
|
|
||||||
register unsigned char *rrops;
|
|
||||||
|
|
||||||
rrops = ((ilbmPrivGC *)(pGC->devPrivates[ilbmGCPrivateIndex].ptr))->rrops;
|
|
||||||
|
|
||||||
ilbmGetPixelWidthAuxDepthAndPointer(pDraw, nlwidth, auxDst, depthDst,
|
|
||||||
addrl);
|
|
||||||
do360 = miZeroArcSetup(arc, &info, TRUE);
|
|
||||||
yorgl = addrl + ((info.yorg + pDraw->y) * auxDst);
|
|
||||||
yorgol = addrl + ((info.yorgo + pDraw->y) * auxDst);
|
|
||||||
info.xorg += pDraw->x;
|
|
||||||
info.xorgo += pDraw->x;
|
|
||||||
MIARCSETUP();
|
|
||||||
yoffset = y ? auxDst : 0;
|
|
||||||
dyoffset = 0;
|
|
||||||
mask = info.initialMask;
|
|
||||||
if (!(arc->width & 1)) {
|
|
||||||
DoPix(2, yorgl, 0, info.xorgo);
|
|
||||||
DoPix(8, yorgol, 0, info.xorgo);
|
|
||||||
}
|
|
||||||
if (!info.end.x || !info.end.y) {
|
|
||||||
mask = info.end.mask;
|
|
||||||
info.end = info.altend;
|
|
||||||
}
|
|
||||||
if (do360 && (arc->width == arc->height) && !(arc->width & 1)) {
|
|
||||||
int xoffset = auxDst;
|
|
||||||
PixelType *yorghl = ilbmScanlineDeltaNoBankSwitch(yorgl, info.h, auxDst);
|
|
||||||
int xorghp = info.xorg + info.h;
|
|
||||||
int xorghn = info.xorg - info.h;
|
|
||||||
|
|
||||||
while (1) {
|
|
||||||
Pixelate(yorgl, yoffset, info.xorg + x);
|
|
||||||
Pixelate(yorgl, yoffset, info.xorg - x);
|
|
||||||
Pixelate(yorgol, -yoffset, info.xorg - x);
|
|
||||||
Pixelate(yorgol, -yoffset, info.xorg + x);
|
|
||||||
if (a < 0)
|
|
||||||
break;
|
|
||||||
Pixelate(yorghl, -xoffset, xorghp - y);
|
|
||||||
Pixelate(yorghl, -xoffset, xorghn + y);
|
|
||||||
Pixelate(yorghl, xoffset, xorghn + y);
|
|
||||||
Pixelate(yorghl, xoffset, xorghp - y);
|
|
||||||
xoffset += auxDst;
|
|
||||||
MIARCCIRCLESTEP(yoffset += auxDst;);
|
|
||||||
}
|
|
||||||
x = info.w;
|
|
||||||
yoffset = info.h * auxDst;
|
|
||||||
} else if (do360) {
|
|
||||||
while (y < info.h || x < info.w) {
|
|
||||||
MIARCOCTANTSHIFT(dyoffset = auxDst;);
|
|
||||||
Pixelate(yorgl, yoffset, info.xorg + x);
|
|
||||||
Pixelate(yorgl, yoffset, info.xorgo - x);
|
|
||||||
Pixelate(yorgol, -yoffset, info.xorgo - x);
|
|
||||||
Pixelate(yorgol, -yoffset, info.xorg + x);
|
|
||||||
MIARCSTEP(yoffset += dyoffset;, yoffset += auxDst;);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
while (y < info.h || x < info.w) {
|
|
||||||
MIARCOCTANTSHIFT(dyoffset = auxDst;);
|
|
||||||
if ((x == info.start.x) || (y == info.start.y)) {
|
|
||||||
mask = info.start.mask;
|
|
||||||
info.start = info.altstart;
|
|
||||||
}
|
|
||||||
DoPix(1, yorgl, yoffset, info.xorg + x);
|
|
||||||
DoPix(2, yorgl, yoffset, info.xorgo - x);
|
|
||||||
DoPix(4, yorgol, -yoffset, info.xorgo - x);
|
|
||||||
DoPix(8, yorgol, -yoffset, info.xorg + x);
|
|
||||||
if ((x == info.end.x) || (y == info.end.y)) {
|
|
||||||
mask = info.end.mask;
|
|
||||||
info.end = info.altend;
|
|
||||||
}
|
|
||||||
MIARCSTEP(yoffset += dyoffset;, yoffset += auxDst;);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((x == info.start.x) || (y == info.start.y))
|
|
||||||
mask = info.start.mask;
|
|
||||||
DoPix(1, yorgl, yoffset, info.xorg + x);
|
|
||||||
DoPix(4, yorgol, -yoffset, info.xorgo - x);
|
|
||||||
if (arc->height & 1) {
|
|
||||||
DoPix(2, yorgl, yoffset, info.xorgo - x);
|
|
||||||
DoPix(8, yorgol, -yoffset, info.xorg + x);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ilbmZeroPolyArcSS(pDraw, pGC, narcs, parcs)
|
|
||||||
DrawablePtr pDraw;
|
|
||||||
GCPtr pGC;
|
|
||||||
int narcs;
|
|
||||||
xArc *parcs;
|
|
||||||
{
|
|
||||||
register xArc *arc;
|
|
||||||
register int i;
|
|
||||||
BoxRec box;
|
|
||||||
RegionPtr cclip;
|
|
||||||
|
|
||||||
cclip = pGC->pCompositeClip;
|
|
||||||
for (arc = parcs, i = narcs; --i >= 0; arc++) {
|
|
||||||
if (miCanZeroArc(arc)) {
|
|
||||||
box.x1 = arc->x + pDraw->x;
|
|
||||||
box.y1 = arc->y + pDraw->y;
|
|
||||||
box.x2 = box.x1 + (int)arc->width + 1;
|
|
||||||
box.y2 = box.y1 + (int)arc->height + 1;
|
|
||||||
if (RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN)
|
|
||||||
ilbmZeroArcSS(pDraw, pGC, arc);
|
|
||||||
else
|
|
||||||
miZeroPolyArc(pDraw, pGC, 1, arc);
|
|
||||||
} else
|
|
||||||
miPolyArc(pDraw, pGC, 1, arc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
EXTRA_DIST = \
|
|
||||||
ipl.h \
|
|
||||||
iplallpriv.c \
|
|
||||||
iplbitblt.c \
|
|
||||||
iplblt.c \
|
|
||||||
iplbres.c \
|
|
||||||
iplbresd.c \
|
|
||||||
iplbstore.c \
|
|
||||||
iplcmap.c \
|
|
||||||
iplfillarc.c \
|
|
||||||
iplfillrct.c \
|
|
||||||
iplfillsp.c \
|
|
||||||
iplgc.c \
|
|
||||||
iplgetsp.c \
|
|
||||||
iplhrzvert.c \
|
|
||||||
iplimage.c \
|
|
||||||
iplline.c \
|
|
||||||
iplmap.h \
|
|
||||||
iplmergerop.h \
|
|
||||||
iplmskbits.c \
|
|
||||||
iplmskbits.h \
|
|
||||||
iplpack.c \
|
|
||||||
iplpack.h \
|
|
||||||
iplpixmap.c \
|
|
||||||
iplply1rct.c \
|
|
||||||
iplpntwin.c \
|
|
||||||
iplpolypnt.c \
|
|
||||||
iplrrop.c \
|
|
||||||
iplrrop.h \
|
|
||||||
iplscrinit.c \
|
|
||||||
iplsetsp.c \
|
|
||||||
iplsolid.c \
|
|
||||||
ipltegblt.c \
|
|
||||||
ipltile32.c \
|
|
||||||
ipltileodd.c \
|
|
||||||
iplwindow.c
|
|
||||||
1254
iplan2p4/ipl.h
1254
iplan2p4/ipl.h
File diff suppressed because it is too large
Load Diff
@@ -1,93 +0,0 @@
|
|||||||
/* $XFree86$ */
|
|
||||||
/*
|
|
||||||
* $XConsortium: iplallpriv.c,v 1.5 94/04/17 20:28:42 dpw Exp $
|
|
||||||
*
|
|
||||||
Copyright (c) 1991 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
*
|
|
||||||
* Author: Keith Packard, MIT X Consortium
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
|
|
||||||
interleaved planes */
|
|
||||||
|
|
||||||
#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 "ipl.h"
|
|
||||||
#include "mi.h"
|
|
||||||
#include "mistruct.h"
|
|
||||||
#include "dix.h"
|
|
||||||
#include "mibstore.h"
|
|
||||||
|
|
||||||
int iplWindowPrivateIndex;
|
|
||||||
int iplGCPrivateIndex;
|
|
||||||
#ifdef CFB_NEED_SCREEN_PRIVATE
|
|
||||||
int iplScreenPrivateIndex;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern RegionPtr (*iplPuntCopyPlane)();
|
|
||||||
|
|
||||||
Bool
|
|
||||||
iplAllocatePrivates(pScreen, window_index, gc_index)
|
|
||||||
ScreenPtr pScreen;
|
|
||||||
int *window_index, *gc_index;
|
|
||||||
{
|
|
||||||
if (!window_index || !gc_index ||
|
|
||||||
*window_index == -1 && *gc_index == -1)
|
|
||||||
{
|
|
||||||
if (!mfbAllocatePrivates(pScreen,
|
|
||||||
&iplWindowPrivateIndex, &iplGCPrivateIndex))
|
|
||||||
return FALSE;
|
|
||||||
if (window_index)
|
|
||||||
*window_index = iplWindowPrivateIndex;
|
|
||||||
if (gc_index)
|
|
||||||
*gc_index = iplGCPrivateIndex;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
iplWindowPrivateIndex = *window_index;
|
|
||||||
iplGCPrivateIndex = *gc_index;
|
|
||||||
}
|
|
||||||
if (!AllocateWindowPrivate(pScreen, iplWindowPrivateIndex,
|
|
||||||
sizeof(iplPrivWin)) ||
|
|
||||||
!AllocateGCPrivate(pScreen, iplGCPrivateIndex, sizeof(iplPrivGC)))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
iplPuntCopyPlane = miCopyPlane;
|
|
||||||
#ifdef CFB_NEED_SCREEN_PRIVATE
|
|
||||||
iplScreenPrivateIndex = AllocateScreenPrivateIndex ();
|
|
||||||
if (iplScreenPrivateIndex == -1)
|
|
||||||
return FALSE;
|
|
||||||
#endif
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
@@ -1,388 +0,0 @@
|
|||||||
/* $XFree86: xc/programs/Xserver/iplan2p4/iplbitblt.c,v 3.1tsi Exp $ */
|
|
||||||
/*
|
|
||||||
* ipl copy area
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
Copyright (c) 1989 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
Author: Keith Packard
|
|
||||||
|
|
||||||
*/
|
|
||||||
/* $XConsortium: iplbitblt.c,v 5.51 94/05/27 11:00:56 dpw Exp $ */
|
|
||||||
|
|
||||||
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
|
|
||||||
interleaved planes */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-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"
|
|
||||||
#include "ipl.h"
|
|
||||||
#include "fastblt.h"
|
|
||||||
#define MFB_CONSTS_ONLY
|
|
||||||
#include "maskbits.h"
|
|
||||||
|
|
||||||
#include "iplmskbits.h"
|
|
||||||
|
|
||||||
RegionPtr
|
|
||||||
iplBitBlt (pSrcDrawable, pDstDrawable,
|
|
||||||
pGC, srcx, srcy, width, height, dstx, dsty, doBitBlt, bitPlane)
|
|
||||||
register DrawablePtr pSrcDrawable;
|
|
||||||
register DrawablePtr pDstDrawable;
|
|
||||||
GC *pGC;
|
|
||||||
int srcx, srcy;
|
|
||||||
int width, height;
|
|
||||||
int dstx, dsty;
|
|
||||||
void (*doBitBlt)();
|
|
||||||
unsigned long bitPlane;
|
|
||||||
{
|
|
||||||
RegionPtr prgnSrcClip; /* 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 = iplGetCompositeClip(pGC);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fastClip = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (pGC->subWindowMode == IncludeInferiors)
|
|
||||||
{
|
|
||||||
if (!((WindowPtr) pSrcDrawable)->parent)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* 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 = iplGetCompositeClip(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 = iplGetCompositeClip(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,
|
|
||||||
iplGetCompositeClip(pGC));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Do bit blitting */
|
|
||||||
numRects = REGION_NUM_RECTS(&rgnDst);
|
|
||||||
if (numRects && width && height)
|
|
||||||
{
|
|
||||||
if(!(pptSrc = (DDXPointPtr)ALLOCATE_LOCAL(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, bitPlane);
|
|
||||||
DEALLOCATE_LOCAL(pptSrc);
|
|
||||||
}
|
|
||||||
|
|
||||||
prgnExposed = NULL;
|
|
||||||
if (pGC->fExpose)
|
|
||||||
{
|
|
||||||
extern RegionPtr miHandleExposures();
|
|
||||||
|
|
||||||
/* 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
|
|
||||||
iplDoBitblt (pSrc, pDst, alu, prgnDst, pptSrc, planemask)
|
|
||||||
DrawablePtr pSrc, pDst;
|
|
||||||
int alu;
|
|
||||||
RegionPtr prgnDst;
|
|
||||||
DDXPointPtr pptSrc;
|
|
||||||
unsigned long planemask;
|
|
||||||
{
|
|
||||||
void (*blt)() = iplDoBitbltGeneral;
|
|
||||||
if ((planemask & INTER_PMSK) == INTER_PMSK) {
|
|
||||||
switch (alu) {
|
|
||||||
case GXcopy:
|
|
||||||
blt = iplDoBitbltCopy;
|
|
||||||
break;
|
|
||||||
case GXxor:
|
|
||||||
blt = iplDoBitbltXor;
|
|
||||||
break;
|
|
||||||
case GXor:
|
|
||||||
blt = iplDoBitbltOr;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
(*blt) (pSrc, pDst, alu, prgnDst, pptSrc, planemask);
|
|
||||||
}
|
|
||||||
|
|
||||||
RegionPtr
|
|
||||||
iplCopyArea(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) ();
|
|
||||||
|
|
||||||
doBitBlt = iplDoBitbltCopy;
|
|
||||||
if (pGC->alu != GXcopy || (pGC->planemask & INTER_PMSK) != INTER_PMSK)
|
|
||||||
{
|
|
||||||
doBitBlt = iplDoBitbltGeneral;
|
|
||||||
if ((pGC->planemask & INTER_PMSK) == INTER_PMSK)
|
|
||||||
{
|
|
||||||
switch (pGC->alu) {
|
|
||||||
case GXxor:
|
|
||||||
doBitBlt = iplDoBitbltXor;
|
|
||||||
break;
|
|
||||||
case GXor:
|
|
||||||
doBitBlt = iplDoBitbltOr;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return iplBitBlt (pSrcDrawable, pDstDrawable,
|
|
||||||
pGC, srcx, srcy, width, height, dstx, dsty, doBitBlt, 0L);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* shared among all different ipl depths through linker magic */
|
|
||||||
RegionPtr (*iplPuntCopyPlane)();
|
|
||||||
|
|
||||||
RegionPtr iplCopyPlane(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;
|
|
||||||
extern RegionPtr miHandleExposures();
|
|
||||||
void (*doBitBlt)();
|
|
||||||
|
|
||||||
ret = (*iplPuntCopyPlane) (pSrcDrawable, pDstDrawable,
|
|
||||||
pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
@@ -1,431 +0,0 @@
|
|||||||
/* $XFree86$ */
|
|
||||||
/*
|
|
||||||
* ipl copy area
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
Copyright (c) 1989 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
Author: Keith Packard
|
|
||||||
|
|
||||||
*/
|
|
||||||
/* $XConsortium: iplblt.c,v 1.13 94/04/17 20:28:44 dpw Exp $ */
|
|
||||||
|
|
||||||
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
|
|
||||||
interleaved planes */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-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"
|
|
||||||
#include "ipl.h"
|
|
||||||
#include "fastblt.h"
|
|
||||||
#include "iplmergerop.h"
|
|
||||||
#include "iplmskbits.h"
|
|
||||||
|
|
||||||
void
|
|
||||||
INTER_MROP_NAME(iplDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc, planemask)
|
|
||||||
DrawablePtr pSrc, pDst;
|
|
||||||
int alu;
|
|
||||||
RegionPtr prgnDst;
|
|
||||||
DDXPointPtr pptSrc;
|
|
||||||
unsigned long planemask;
|
|
||||||
{
|
|
||||||
INTER_DECLAREG(*psrcBase);
|
|
||||||
INTER_DECLAREG(*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 */
|
|
||||||
|
|
||||||
INTER_DECLAREG(*psrcLine);
|
|
||||||
INTER_DECLAREG(*pdstLine); /* pointers to line with current src and dst */
|
|
||||||
INTER_DECLAREG(*psrc); /* pointer to current src group */
|
|
||||||
INTER_DECLAREG(*pdst); /* pointer to current dst group */
|
|
||||||
|
|
||||||
INTER_MROP_DECLARE_REG()
|
|
||||||
|
|
||||||
/* following used for looping through a line */
|
|
||||||
INTER_DECLAREG(startmask);
|
|
||||||
INTER_DECLAREG(endmask); /* masks for writing ends of dst */
|
|
||||||
int ngMiddle; /* whole groups in dst */
|
|
||||||
int xoffSrc, xoffDst;
|
|
||||||
register int leftShift, rightShift;
|
|
||||||
INTER_DECLAREGP(bits);
|
|
||||||
INTER_DECLAREGP(bits1);
|
|
||||||
INTER_DECLAREGP(bits2);
|
|
||||||
register int ng; /* temp copy of ngMiddle */
|
|
||||||
|
|
||||||
/* place to store full source word */
|
|
||||||
int nstart; /* number of ragged bits at start of dst */
|
|
||||||
int nend; /* number of ragged bits at end of dst */
|
|
||||||
int srcStartOver; /* pulling nstart bits from src
|
|
||||||
overflows into the next word? */
|
|
||||||
int careful;
|
|
||||||
int tmpSrc;
|
|
||||||
|
|
||||||
INTER_MROP_INITIALIZE(alu,planemask);
|
|
||||||
|
|
||||||
iplGetGroupWidthAndPointer (pSrc, widthSrc, psrcBase)
|
|
||||||
|
|
||||||
iplGetGroupWidthAndPointer (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)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox);
|
|
||||||
if(!pboxNew1)
|
|
||||||
return;
|
|
||||||
pptNew1 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox);
|
|
||||||
if(!pptNew1)
|
|
||||||
{
|
|
||||||
DEALLOCATE_LOCAL(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)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox);
|
|
||||||
pptNew2 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox);
|
|
||||||
if(!pboxNew2 || !pptNew2)
|
|
||||||
{
|
|
||||||
if (pptNew2) DEALLOCATE_LOCAL(pptNew2);
|
|
||||||
if (pboxNew2) DEALLOCATE_LOCAL(pboxNew2);
|
|
||||||
if (pboxNew1)
|
|
||||||
{
|
|
||||||
DEALLOCATE_LOCAL(pptNew1);
|
|
||||||
DEALLOCATE_LOCAL(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 (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 ((pbox->x1 & INTER_PIM) + w <= INTER_PPG)
|
|
||||||
{
|
|
||||||
INTER_maskpartialbits (pbox->x1, w, endmask);
|
|
||||||
startmask = 0;
|
|
||||||
ngMiddle = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
INTER_maskbits(pbox->x1, w, startmask, endmask, ngMiddle);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (xdir == 1)
|
|
||||||
{
|
|
||||||
xoffSrc = pptSrc->x & INTER_PIM;
|
|
||||||
xoffDst = pbox->x1 & INTER_PIM;
|
|
||||||
pdstLine += (pbox->x1 >> INTER_PGSH) * INTER_PLANES;
|
|
||||||
psrcLine += (pptSrc->x >> INTER_PGSH) * INTER_PLANES;
|
|
||||||
ng = xoffSrc - xoffDst;
|
|
||||||
if (xoffSrc == xoffDst)
|
|
||||||
{
|
|
||||||
while (h--)
|
|
||||||
{
|
|
||||||
psrc = psrcLine;
|
|
||||||
pdst = pdstLine;
|
|
||||||
pdstLine += widthDst;
|
|
||||||
psrcLine += widthSrc;
|
|
||||||
if (startmask)
|
|
||||||
{
|
|
||||||
INTER_MROP_MASK(psrc, pdst, startmask, pdst);
|
|
||||||
INTER_NEXT_GROUP(psrc);
|
|
||||||
INTER_NEXT_GROUP(pdst);
|
|
||||||
}
|
|
||||||
ng = ngMiddle;
|
|
||||||
|
|
||||||
DuffL(ng, label1,
|
|
||||||
INTER_MROP_SOLID(psrc, pdst, pdst);
|
|
||||||
INTER_NEXT_GROUP(psrc);
|
|
||||||
INTER_NEXT_GROUP(pdst);
|
|
||||||
)
|
|
||||||
if (endmask)
|
|
||||||
INTER_MROP_MASK(psrc, pdst, endmask, pdst);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (xoffSrc > xoffDst)
|
|
||||||
{
|
|
||||||
leftShift = xoffSrc - xoffDst;
|
|
||||||
rightShift = (INTER_PIM+1) - leftShift;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
rightShift = xoffDst - xoffSrc;
|
|
||||||
leftShift = (INTER_PIM+1) - rightShift;
|
|
||||||
}
|
|
||||||
while (h--)
|
|
||||||
{
|
|
||||||
psrc = psrcLine;
|
|
||||||
pdst = pdstLine;
|
|
||||||
pdstLine += widthDst;
|
|
||||||
psrcLine += widthSrc;
|
|
||||||
INTER_CLR(bits);
|
|
||||||
if (xoffSrc > xoffDst) {
|
|
||||||
INTER_COPY(psrc, bits);
|
|
||||||
INTER_NEXT_GROUP(psrc);
|
|
||||||
}
|
|
||||||
if (startmask)
|
|
||||||
{
|
|
||||||
INTER_GETLRC(leftShift, rightShift, psrc, bits, bits1);
|
|
||||||
INTER_MROP_MASK(bits1, pdst, startmask, pdst);
|
|
||||||
INTER_NEXT_GROUP(psrc);
|
|
||||||
INTER_NEXT_GROUP(pdst);
|
|
||||||
}
|
|
||||||
ng = ngMiddle;
|
|
||||||
DuffL (ng,label2,
|
|
||||||
INTER_GETLRC(leftShift, rightShift, psrc, bits, bits1);
|
|
||||||
INTER_MROP_SOLID(bits1, pdst, pdst);
|
|
||||||
INTER_NEXT_GROUP(psrc);
|
|
||||||
INTER_NEXT_GROUP(pdst);
|
|
||||||
)
|
|
||||||
if (endmask)
|
|
||||||
{
|
|
||||||
if ((endmask << rightShift) & 0xffff) {
|
|
||||||
INTER_GETLRC(leftShift, rightShift, psrc, bits,
|
|
||||||
bits1);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
INTER_SCRLEFT(leftShift, bits, bits1);
|
|
||||||
}
|
|
||||||
INTER_MROP_MASK(bits1, pdst, endmask, pdst);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else /* xdir == -1 */
|
|
||||||
{
|
|
||||||
xoffSrc = (pptSrc->x + w - 1) & INTER_PIM;
|
|
||||||
xoffDst = (pbox->x2 - 1) & INTER_PIM;
|
|
||||||
pdstLine += (((pbox->x2-1) >> INTER_PGSH) + 1) * INTER_PLANES;
|
|
||||||
psrcLine += (((pptSrc->x+w - 1) >> INTER_PGSH) + 1) * INTER_PLANES;
|
|
||||||
if (xoffSrc == xoffDst)
|
|
||||||
{
|
|
||||||
while (h--)
|
|
||||||
{
|
|
||||||
psrc = psrcLine;
|
|
||||||
pdst = pdstLine;
|
|
||||||
pdstLine += widthDst;
|
|
||||||
psrcLine += widthSrc;
|
|
||||||
if (endmask)
|
|
||||||
{
|
|
||||||
INTER_PREV_GROUP(psrc);
|
|
||||||
INTER_PREV_GROUP(pdst);
|
|
||||||
INTER_MROP_MASK(psrc, pdst, endmask, pdst);
|
|
||||||
}
|
|
||||||
ng = ngMiddle;
|
|
||||||
|
|
||||||
DuffL(ng,label3,
|
|
||||||
INTER_PREV_GROUP(psrc);
|
|
||||||
INTER_PREV_GROUP(pdst);
|
|
||||||
INTER_MROP_SOLID(psrc, pdst, pdst);
|
|
||||||
)
|
|
||||||
|
|
||||||
if (startmask)
|
|
||||||
{
|
|
||||||
INTER_PREV_GROUP(psrc);
|
|
||||||
INTER_PREV_GROUP(pdst);
|
|
||||||
INTER_MROP_MASK(psrc, pdst, startmask, pdst);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (xoffDst > xoffSrc)
|
|
||||||
{
|
|
||||||
rightShift = xoffDst - xoffSrc;
|
|
||||||
leftShift = (INTER_PIM + 1) - rightShift;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
leftShift = xoffSrc - xoffDst;
|
|
||||||
rightShift = (INTER_PIM + 1) - leftShift;
|
|
||||||
}
|
|
||||||
while (h--)
|
|
||||||
{
|
|
||||||
psrc = psrcLine;
|
|
||||||
pdst = pdstLine;
|
|
||||||
pdstLine += widthDst;
|
|
||||||
psrcLine += widthSrc;
|
|
||||||
INTER_CLR(bits);
|
|
||||||
if (xoffDst > xoffSrc) {
|
|
||||||
INTER_PREV_GROUP(psrc);
|
|
||||||
INTER_COPY(psrc, bits);
|
|
||||||
}
|
|
||||||
if (endmask)
|
|
||||||
{
|
|
||||||
INTER_PREV_GROUP(psrc);
|
|
||||||
INTER_PREV_GROUP(pdst);
|
|
||||||
INTER_GETRLC(rightShift, leftShift, psrc, bits, bits1);
|
|
||||||
INTER_MROP_MASK(bits1, pdst, endmask, pdst);
|
|
||||||
}
|
|
||||||
ng = ngMiddle;
|
|
||||||
DuffL (ng, label4,
|
|
||||||
INTER_PREV_GROUP(psrc);
|
|
||||||
INTER_PREV_GROUP(pdst);
|
|
||||||
INTER_GETRLC(rightShift, leftShift, psrc, bits, bits1);
|
|
||||||
INTER_MROP_SOLID(bits1, pdst, pdst);
|
|
||||||
)
|
|
||||||
if (startmask)
|
|
||||||
{
|
|
||||||
INTER_PREV_GROUP(psrc);
|
|
||||||
INTER_PREV_GROUP(pdst);
|
|
||||||
if ((startmask >> leftShift) & 0xffff) {
|
|
||||||
INTER_GETRLC(rightShift, leftShift, psrc, bits,
|
|
||||||
bits1);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
INTER_SCRRIGHT(rightShift, bits, bits1);
|
|
||||||
}
|
|
||||||
INTER_MROP_MASK(bits1, pdst, startmask, pdst);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pbox++;
|
|
||||||
pptSrc++;
|
|
||||||
}
|
|
||||||
if (pboxNew2)
|
|
||||||
{
|
|
||||||
DEALLOCATE_LOCAL(pptNew2);
|
|
||||||
DEALLOCATE_LOCAL(pboxNew2);
|
|
||||||
}
|
|
||||||
if (pboxNew1)
|
|
||||||
{
|
|
||||||
DEALLOCATE_LOCAL(pptNew1);
|
|
||||||
DEALLOCATE_LOCAL(pboxNew1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,186 +0,0 @@
|
|||||||
/* $XFree86$ */
|
|
||||||
/***********************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
******************************************************************/
|
|
||||||
/* $XConsortium: iplbres.c,v 1.15 94/04/17 20:28:45 dpw Exp $ */
|
|
||||||
|
|
||||||
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
|
|
||||||
interleaved planes */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include "misc.h"
|
|
||||||
#include "ipl.h"
|
|
||||||
#include "servermd.h"
|
|
||||||
#include "miline.h"
|
|
||||||
|
|
||||||
#include "iplmskbits.h"
|
|
||||||
|
|
||||||
/* Solid bresenham line */
|
|
||||||
/* NOTES
|
|
||||||
e2 is used less often than e1, so it's not in a register
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
iplBresS(rop, andp, xorp, addrg, ngwidth, signdx, signdy, axis, x1, y1, e, e1,
|
|
||||||
e2, len)
|
|
||||||
int rop;
|
|
||||||
INTER_DECLARERRAX(andp);
|
|
||||||
INTER_DECLARERRAX(xorp);
|
|
||||||
INTER_DECLAREG(*addrg); /* pointer to base of bitmap */
|
|
||||||
int ngwidth; /* 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;
|
|
||||||
INTER_DECLAREG(bit);
|
|
||||||
INTER_DECLAREG(leftbit);
|
|
||||||
INTER_DECLAREG(rightbit);
|
|
||||||
|
|
||||||
/* point to longword containing first point */
|
|
||||||
addrg = addrg + y1 * ngwidth + (x1 >> INTER_PGSH) * INTER_PLANES;
|
|
||||||
|
|
||||||
if (signdy < 0)
|
|
||||||
ngwidth = -ngwidth;
|
|
||||||
e = e-e1; /* to make looping easier */
|
|
||||||
|
|
||||||
leftbit = iplmask[0];
|
|
||||||
rightbit = iplmask[INTER_PPG-1];
|
|
||||||
bit = iplmask[x1 & INTER_PIM];
|
|
||||||
|
|
||||||
if (axis == X_AXIS)
|
|
||||||
{
|
|
||||||
if (signdx > 0)
|
|
||||||
{
|
|
||||||
while (len--)
|
|
||||||
{
|
|
||||||
INTER_DoMaskRRop(addrg, andp, xorp, bit, addrg);
|
|
||||||
bit = bit >> 1;
|
|
||||||
e += e1;
|
|
||||||
if (e >= 0)
|
|
||||||
{
|
|
||||||
addrg += ngwidth;
|
|
||||||
e += e3;
|
|
||||||
}
|
|
||||||
if (!bit)
|
|
||||||
{
|
|
||||||
bit = leftbit;
|
|
||||||
addrg += INTER_PLANES;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
while (len--)
|
|
||||||
{
|
|
||||||
INTER_DoMaskRRop(addrg, andp, xorp, bit, addrg);
|
|
||||||
e += e1;
|
|
||||||
bit = bit << 1;
|
|
||||||
if (e >= 0)
|
|
||||||
{
|
|
||||||
addrg += ngwidth;
|
|
||||||
e += e3;
|
|
||||||
}
|
|
||||||
if (!bit)
|
|
||||||
{
|
|
||||||
bit = rightbit;
|
|
||||||
addrg -= INTER_PLANES;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} /* if X_AXIS */
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (signdx > 0)
|
|
||||||
{
|
|
||||||
while(len--)
|
|
||||||
{
|
|
||||||
INTER_DoMaskRRop(addrg, andp, xorp, bit, addrg);
|
|
||||||
e += e1;
|
|
||||||
if (e >= 0)
|
|
||||||
{
|
|
||||||
bit = bit >> 1;
|
|
||||||
if (!bit)
|
|
||||||
{
|
|
||||||
bit = leftbit;
|
|
||||||
addrg += INTER_PLANES;
|
|
||||||
}
|
|
||||||
e += e3;
|
|
||||||
}
|
|
||||||
addrg += ngwidth;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
while(len--)
|
|
||||||
{
|
|
||||||
INTER_DoMaskRRop(addrg, andp, xorp, bit, addrg);
|
|
||||||
e += e1;
|
|
||||||
if (e >= 0)
|
|
||||||
{
|
|
||||||
bit = bit << 1;
|
|
||||||
if (!bit)
|
|
||||||
{
|
|
||||||
bit = rightbit;
|
|
||||||
addrg -= INTER_PLANES;
|
|
||||||
}
|
|
||||||
e += e3;
|
|
||||||
}
|
|
||||||
addrg += ngwidth;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} /* else Y_AXIS */
|
|
||||||
}
|
|
||||||
@@ -1,212 +0,0 @@
|
|||||||
/* $XFree86$ */
|
|
||||||
/***********************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
******************************************************************/
|
|
||||||
/* $XConsortium: iplbresd.c,v 1.16 94/04/17 20:28:45 dpw Exp $ */
|
|
||||||
|
|
||||||
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
|
|
||||||
interleaved planes */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include "misc.h"
|
|
||||||
#include "ipl.h"
|
|
||||||
#include "miline.h"
|
|
||||||
#include "iplmskbits.h"
|
|
||||||
|
|
||||||
/* Dashed bresenham line */
|
|
||||||
|
|
||||||
void
|
|
||||||
iplBresD(rrops,
|
|
||||||
pdashIndex, pDash, numInDashList, pdashOffset, isDoubleDash,
|
|
||||||
addrg, ngwidth,
|
|
||||||
signdx, signdy, axis, x1, y1, e, e1, e2, len)
|
|
||||||
iplRRopPtr 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;
|
|
||||||
INTER_DECLAREG(*addrg); /* pointer to base of bitmap */
|
|
||||||
int ngwidth; /* width in groups 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 */
|
|
||||||
{
|
|
||||||
register int e3 = e2-e1;
|
|
||||||
int dashIndex;
|
|
||||||
int dashOffset;
|
|
||||||
int dashRemaining;
|
|
||||||
INTER_DECLARERRAX(xorFg);
|
|
||||||
INTER_DECLARERRAX(andFg);
|
|
||||||
INTER_DECLARERRAX(xorBg);
|
|
||||||
INTER_DECLARERRAX(andBg);
|
|
||||||
int thisDash;
|
|
||||||
|
|
||||||
dashOffset = *pdashOffset;
|
|
||||||
dashIndex = *pdashIndex;
|
|
||||||
xorFg = rrops[0].xorg;
|
|
||||||
andFg = rrops[0].andg;
|
|
||||||
xorBg = rrops[1].xorg;
|
|
||||||
andBg = rrops[1].andg;
|
|
||||||
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; \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
INTER_DECLAREG(startbit);
|
|
||||||
INTER_DECLAREG(bit);
|
|
||||||
|
|
||||||
/* point to longword containing first point */
|
|
||||||
addrg = addrg + (y1 * ngwidth) + (x1 >> INTER_PGSH) * INTER_PLANES;
|
|
||||||
signdy = signdy * ngwidth;
|
|
||||||
signdx = signdx * INTER_PLANES;
|
|
||||||
|
|
||||||
if (signdx > 0)
|
|
||||||
startbit = iplmask[0];
|
|
||||||
else
|
|
||||||
startbit = iplmask[INTER_PPG-1];
|
|
||||||
bit = iplmask[x1 & INTER_PIM];
|
|
||||||
|
|
||||||
#define X_Loop(store) while(thisDash--) {\
|
|
||||||
store; \
|
|
||||||
BresStep(addrg += signdy, \
|
|
||||||
if (signdx > 0) \
|
|
||||||
bit >>= 1; \
|
|
||||||
else \
|
|
||||||
bit <<= 1; \
|
|
||||||
if (!bit) \
|
|
||||||
{ \
|
|
||||||
bit = startbit; \
|
|
||||||
addrg += signdx; \
|
|
||||||
}) \
|
|
||||||
}
|
|
||||||
#define Y_Loop(store) while(thisDash--) {\
|
|
||||||
store; \
|
|
||||||
BresStep(if (signdx > 0) \
|
|
||||||
bit >>= 1; \
|
|
||||||
else \
|
|
||||||
bit <<= 1; \
|
|
||||||
if (!bit) \
|
|
||||||
{ \
|
|
||||||
bit = startbit; \
|
|
||||||
addrg += signdx; \
|
|
||||||
}, \
|
|
||||||
addrg += signdy) \
|
|
||||||
}
|
|
||||||
|
|
||||||
if (axis == X_AXIS)
|
|
||||||
{
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
len -= thisDash;
|
|
||||||
if (dashIndex & 1) {
|
|
||||||
if (isDoubleDash) {
|
|
||||||
X_Loop(
|
|
||||||
INTER_DoMaskRRop(addrg, andBg, xorBg, bit, addrg);
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
X_Loop(;)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
X_Loop(INTER_DoMaskRRop(addrg, andFg, xorFg, bit, addrg));
|
|
||||||
}
|
|
||||||
if (!len)
|
|
||||||
break;
|
|
||||||
NextDash
|
|
||||||
}
|
|
||||||
} /* if X_AXIS */
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
len -= thisDash;
|
|
||||||
if (dashIndex & 1) {
|
|
||||||
if (isDoubleDash) {
|
|
||||||
Y_Loop(
|
|
||||||
INTER_DoMaskRRop(addrg, andBg, xorBg, bit, addrg);
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
Y_Loop(;)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Y_Loop(INTER_DoMaskRRop(addrg, andFg, xorFg, bit, addrg));
|
|
||||||
}
|
|
||||||
if (!len)
|
|
||||||
break;
|
|
||||||
NextDash
|
|
||||||
}
|
|
||||||
} /* else Y_AXIS */
|
|
||||||
}
|
|
||||||
*pdashIndex = dashIndex;
|
|
||||||
*pdashOffset = pDash[dashIndex] - dashRemaining;
|
|
||||||
}
|
|
||||||
@@ -1,159 +0,0 @@
|
|||||||
/* $XFree86$ */
|
|
||||||
|
|
||||||
/*-
|
|
||||||
* iplbstore.c --
|
|
||||||
* Functions required by the backing-store implementation in MI.
|
|
||||||
*
|
|
||||||
* Copyright (c) 1987 by the Regents of the University of California
|
|
||||||
*
|
|
||||||
* 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. The University of California
|
|
||||||
* makes no representations about the suitability of this
|
|
||||||
* software for any purpose. It is provided "as is" without
|
|
||||||
* express or implied warranty.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef lint
|
|
||||||
static char rcsid[] =
|
|
||||||
"$XConsortium: iplbstore.c,v 5.8 93/12/13 17:21:51 dpw Exp $ SPRITE (Berkeley)";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
|
|
||||||
interleaved planes */
|
|
||||||
|
|
||||||
#include "ipl.h"
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include "mibstore.h"
|
|
||||||
#include "regionstr.h"
|
|
||||||
#include "scrnintstr.h"
|
|
||||||
#include "pixmapstr.h"
|
|
||||||
#include "windowstr.h"
|
|
||||||
|
|
||||||
/*-
|
|
||||||
*-----------------------------------------------------------------------
|
|
||||||
* iplSaveAreas --
|
|
||||||
* Function called by miSaveAreas to actually fetch the areas to be
|
|
||||||
* saved into the backing pixmap. This is very simple to do, since
|
|
||||||
* iplDoBitblt is designed for this very thing. The region to save is
|
|
||||||
* already destination-relative and we're given the offset to the
|
|
||||||
* window origin, so we have only to create an array of points of the
|
|
||||||
* u.l. corners of the boxes in the region translated to the screen
|
|
||||||
* coordinate system and fetch the screen pixmap out of its devPrivate
|
|
||||||
* field....
|
|
||||||
*
|
|
||||||
* Results:
|
|
||||||
* None.
|
|
||||||
*
|
|
||||||
* Side Effects:
|
|
||||||
* Data are copied from the screen into the pixmap.
|
|
||||||
*
|
|
||||||
*-----------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
iplSaveAreas(pPixmap, prgnSave, xorg, yorg, pWin)
|
|
||||||
PixmapPtr pPixmap; /* Backing pixmap */
|
|
||||||
RegionPtr prgnSave; /* Region to save (pixmap-relative) */
|
|
||||||
int xorg; /* X origin of region */
|
|
||||||
int yorg; /* Y origin of region */
|
|
||||||
WindowPtr pWin;
|
|
||||||
{
|
|
||||||
register DDXPointPtr pPt;
|
|
||||||
DDXPointPtr pPtsInit;
|
|
||||||
register BoxPtr pBox;
|
|
||||||
register int i;
|
|
||||||
ScreenPtr pScreen = pPixmap->drawable.pScreen;
|
|
||||||
PixmapPtr pScrPix;
|
|
||||||
|
|
||||||
i = REGION_NUM_RECTS(prgnSave);
|
|
||||||
pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(i * sizeof(DDXPointRec));
|
|
||||||
if (!pPtsInit)
|
|
||||||
return;
|
|
||||||
|
|
||||||
pBox = REGION_RECTS(prgnSave);
|
|
||||||
pPt = pPtsInit;
|
|
||||||
while (--i >= 0) {
|
|
||||||
pPt->x = pBox->x1 + xorg;
|
|
||||||
pPt->y = pBox->y1 + yorg;
|
|
||||||
pPt++;
|
|
||||||
pBox++;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CFB_NEED_SCREEN_PRIVATE
|
|
||||||
pScrPix = (PixmapPtr) pScreen->devPrivates[iplScreenPrivateIndex].ptr;
|
|
||||||
#else
|
|
||||||
pScrPix = (PixmapPtr) pScreen->devPrivate;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
iplDoBitbltCopy((DrawablePtr) pScrPix, (DrawablePtr)pPixmap,
|
|
||||||
GXcopy, prgnSave, pPtsInit, ~0L);
|
|
||||||
|
|
||||||
DEALLOCATE_LOCAL (pPtsInit);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*-
|
|
||||||
*-----------------------------------------------------------------------
|
|
||||||
* iplRestoreAreas --
|
|
||||||
* Function called by miRestoreAreas to actually fetch the areas to be
|
|
||||||
* restored from the backing pixmap. This is very simple to do, since
|
|
||||||
* iplDoBitblt is designed for this very thing. The region to restore is
|
|
||||||
* already destination-relative and we're given the offset to the
|
|
||||||
* window origin, so we have only to create an array of points of the
|
|
||||||
* u.l. corners of the boxes in the region translated to the pixmap
|
|
||||||
* coordinate system and fetch the screen pixmap out of its devPrivate
|
|
||||||
* field....
|
|
||||||
*
|
|
||||||
* Results:
|
|
||||||
* None.
|
|
||||||
*
|
|
||||||
* Side Effects:
|
|
||||||
* Data are copied from the pixmap into the screen.
|
|
||||||
*
|
|
||||||
*-----------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
iplRestoreAreas(pPixmap, prgnRestore, xorg, yorg, pWin)
|
|
||||||
PixmapPtr pPixmap; /* Backing pixmap */
|
|
||||||
RegionPtr prgnRestore; /* Region to restore (screen-relative)*/
|
|
||||||
int xorg; /* X origin of window */
|
|
||||||
int yorg; /* Y origin of window */
|
|
||||||
WindowPtr pWin;
|
|
||||||
{
|
|
||||||
register DDXPointPtr pPt;
|
|
||||||
DDXPointPtr pPtsInit;
|
|
||||||
register BoxPtr pBox;
|
|
||||||
register int i;
|
|
||||||
ScreenPtr pScreen = pPixmap->drawable.pScreen;
|
|
||||||
PixmapPtr pScrPix;
|
|
||||||
|
|
||||||
i = REGION_NUM_RECTS(prgnRestore);
|
|
||||||
pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(i*sizeof(DDXPointRec));
|
|
||||||
if (!pPtsInit)
|
|
||||||
return;
|
|
||||||
|
|
||||||
pBox = REGION_RECTS(prgnRestore);
|
|
||||||
pPt = pPtsInit;
|
|
||||||
while (--i >= 0) {
|
|
||||||
pPt->x = pBox->x1 - xorg;
|
|
||||||
pPt->y = pBox->y1 - yorg;
|
|
||||||
pPt++;
|
|
||||||
pBox++;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CFB_NEED_SCREEN_PRIVATE
|
|
||||||
pScrPix = (PixmapPtr) pScreen->devPrivates[iplScreenPrivateIndex].ptr;
|
|
||||||
#else
|
|
||||||
pScrPix = (PixmapPtr) pScreen->devPrivate;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
iplDoBitbltCopy((DrawablePtr)pPixmap, (DrawablePtr) pScrPix,
|
|
||||||
GXcopy, prgnRestore, pPtsInit, ~0L);
|
|
||||||
|
|
||||||
DEALLOCATE_LOCAL (pPtsInit);
|
|
||||||
}
|
|
||||||
@@ -1,126 +0,0 @@
|
|||||||
/* $XFree86: xc/programs/Xserver/iplan2p4/iplcmap.c,v 3.0 1996/08/18 01:54:40 dawes Exp $ */
|
|
||||||
/* $XConsortium: iplcmap.c,v 4.19 94/04/17 20:28:46 dpw Exp $ */
|
|
||||||
/************************************************************
|
|
||||||
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 X Consortium
|
|
||||||
not be used in advertising or publicity pertaining to
|
|
||||||
distribution of the software without specific prior
|
|
||||||
written permission. Sun and X Consortium 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.
|
|
||||||
|
|
||||||
********************************************************/
|
|
||||||
|
|
||||||
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
|
|
||||||
interleaved planes */
|
|
||||||
|
|
||||||
#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"
|
|
||||||
|
|
||||||
int
|
|
||||||
iplListInstalledColormaps(pScreen, pmaps)
|
|
||||||
ScreenPtr pScreen;
|
|
||||||
Colormap *pmaps;
|
|
||||||
{
|
|
||||||
return miListInstalledColormaps(pScreen, pmaps);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
iplInstallColormap(pmap)
|
|
||||||
ColormapPtr pmap;
|
|
||||||
{
|
|
||||||
miInstallColormap(pmap);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
iplUninstallColormap(pmap)
|
|
||||||
ColormapPtr pmap;
|
|
||||||
{
|
|
||||||
miUninstallColormap(pmap);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
iplResolveColor(pred, pgreen, pblue, pVisual)
|
|
||||||
unsigned short *pred, *pgreen, *pblue;
|
|
||||||
register VisualPtr pVisual;
|
|
||||||
{
|
|
||||||
miResolveColor(pred, pgreen, pblue, pVisual);
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool
|
|
||||||
iplInitializeColormap(pmap)
|
|
||||||
register ColormapPtr pmap;
|
|
||||||
{
|
|
||||||
return miInitializeColormap(pmap);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
iplExpandDirectColors (pmap, ndef, indefs, outdefs)
|
|
||||||
ColormapPtr pmap;
|
|
||||||
int ndef;
|
|
||||||
xColorItem *indefs, *outdefs;
|
|
||||||
{
|
|
||||||
return miExpandDirectColors(pmap, ndef, indefs, outdefs);
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool
|
|
||||||
iplCreateDefColormap(pScreen)
|
|
||||||
ScreenPtr pScreen;
|
|
||||||
{
|
|
||||||
return miCreateDefColormap(pScreen);
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool
|
|
||||||
iplSetVisualTypes (depth, visuals, bitsPerRGB)
|
|
||||||
int depth;
|
|
||||||
int visuals;
|
|
||||||
{
|
|
||||||
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 ipl.
|
|
||||||
*/
|
|
||||||
|
|
||||||
Bool
|
|
||||||
iplInitVisuals (visualp, depthp, nvisualp, ndepthp, rootDepthp, defaultVisp, sizes, bitsPerRGB)
|
|
||||||
VisualPtr *visualp;
|
|
||||||
DepthPtr *depthp;
|
|
||||||
int *nvisualp, *ndepthp;
|
|
||||||
int *rootDepthp;
|
|
||||||
VisualID *defaultVisp;
|
|
||||||
unsigned long sizes;
|
|
||||||
int bitsPerRGB;
|
|
||||||
{
|
|
||||||
return miInitVisuals(visualp, depthp, nvisualp, ndepthp, rootDepthp,
|
|
||||||
defaultVisp, sizes, bitsPerRGB, -1);
|
|
||||||
}
|
|
||||||
@@ -1,271 +0,0 @@
|
|||||||
/* $XFree86$ */
|
|
||||||
/************************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1989 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
********************************************************/
|
|
||||||
|
|
||||||
/* $XConsortium: iplfillarc.c,v 5.15 94/04/17 20:28:47 dpw Exp $ */
|
|
||||||
|
|
||||||
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
|
|
||||||
interleaved planes */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include <X11/Xprotostr.h>
|
|
||||||
#include "miscstruct.h"
|
|
||||||
#include "gcstruct.h"
|
|
||||||
#include "pixmapstr.h"
|
|
||||||
#include "scrnintstr.h"
|
|
||||||
#include "ipl.h"
|
|
||||||
#include "mifillarc.h"
|
|
||||||
#include "iplrrop.h"
|
|
||||||
#include "mi.h"
|
|
||||||
#include "iplmskbits.h"
|
|
||||||
|
|
||||||
static void
|
|
||||||
INTER_RROP_NAME(iplFillEllipseSolid) (pDraw, pGC, arc)
|
|
||||||
DrawablePtr pDraw;
|
|
||||||
GCPtr pGC;
|
|
||||||
xArc *arc;
|
|
||||||
{
|
|
||||||
int x, y, e;
|
|
||||||
int yk, xk, ym, xm, dx, dy, xorg, yorg;
|
|
||||||
miFillArcRec info;
|
|
||||||
INTER_DECLAREG(*addrgt);
|
|
||||||
INTER_DECLAREG(*addrgb);
|
|
||||||
INTER_DECLAREG(*addrg);
|
|
||||||
register int n;
|
|
||||||
int ngwidth;
|
|
||||||
INTER_RROP_DECLARE
|
|
||||||
register int xpos;
|
|
||||||
register int slw;
|
|
||||||
INTER_DECLAREG(startmask);
|
|
||||||
INTER_DECLAREG(endmask);
|
|
||||||
int nlmiddle;
|
|
||||||
|
|
||||||
iplGetGroupWidthAndPointer (pDraw, ngwidth, addrgt);
|
|
||||||
|
|
||||||
INTER_RROP_FETCH_GC(pGC);
|
|
||||||
miFillArcSetup(arc, &info);
|
|
||||||
MIFILLARCSETUP();
|
|
||||||
xorg += pDraw->x;
|
|
||||||
yorg += pDraw->y;
|
|
||||||
addrgb = addrgt;
|
|
||||||
addrgt += ngwidth * (yorg - y);
|
|
||||||
addrgb += ngwidth * (yorg + y + dy);
|
|
||||||
while (y)
|
|
||||||
{
|
|
||||||
addrgt += ngwidth;
|
|
||||||
addrgb -= ngwidth;
|
|
||||||
MIFILLARCSTEP(slw);
|
|
||||||
if (!slw)
|
|
||||||
continue;
|
|
||||||
xpos = xorg - x;
|
|
||||||
addrg = addrgt + (xpos >> INTER_PGSH) * INTER_PLANES;
|
|
||||||
if (((xpos & INTER_PIM) + slw) <= INTER_PPG)
|
|
||||||
{
|
|
||||||
INTER_maskpartialbits(xpos, slw, startmask);
|
|
||||||
INTER_RROP_SOLID_MASK(addrg,startmask);
|
|
||||||
if (miFillArcLower(slw))
|
|
||||||
{
|
|
||||||
addrg = addrgb + (xpos >> INTER_PGSH) * INTER_PLANES;
|
|
||||||
INTER_RROP_SOLID_MASK(addrg, startmask);
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
INTER_maskbits(xpos, slw, startmask, endmask, nlmiddle);
|
|
||||||
if (startmask)
|
|
||||||
{
|
|
||||||
INTER_RROP_SOLID_MASK(addrg, startmask);
|
|
||||||
INTER_NEXT_GROUP(addrg);
|
|
||||||
}
|
|
||||||
n = nlmiddle;
|
|
||||||
INTER_RROP_SPAN(addrg,n)
|
|
||||||
|
|
||||||
if (endmask)
|
|
||||||
INTER_RROP_SOLID_MASK(addrg, endmask);
|
|
||||||
if (!miFillArcLower(slw))
|
|
||||||
continue;
|
|
||||||
addrg = addrgb + (xpos >> INTER_PGSH) * INTER_PLANES;
|
|
||||||
if (startmask)
|
|
||||||
{
|
|
||||||
INTER_RROP_SOLID_MASK(addrg, startmask);
|
|
||||||
INTER_NEXT_GROUP(addrg);
|
|
||||||
}
|
|
||||||
n = nlmiddle;
|
|
||||||
INTER_RROP_SPAN(addrg, n);
|
|
||||||
if (endmask)
|
|
||||||
INTER_RROP_SOLID_MASK(addrg, endmask);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#define FILLSPAN(xl,xr,addr) \
|
|
||||||
if (xr >= xl) \
|
|
||||||
{ \
|
|
||||||
n = xr - xl + 1; \
|
|
||||||
addrg = addr + (xl >> INTER_PGSH) * INTER_PLANES; \
|
|
||||||
if (((xl & INTER_PIM) + n) <= INTER_PPG) \
|
|
||||||
{ \
|
|
||||||
INTER_maskpartialbits(xl, n, startmask); \
|
|
||||||
INTER_RROP_SOLID_MASK(addrg, startmask); \
|
|
||||||
} \
|
|
||||||
else \
|
|
||||||
{ \
|
|
||||||
INTER_maskbits(xl, n, startmask, endmask, n); \
|
|
||||||
if (startmask) \
|
|
||||||
{ \
|
|
||||||
INTER_RROP_SOLID_MASK(addrg, startmask); \
|
|
||||||
INTER_NEXT_GROUP(addrg); \
|
|
||||||
} \
|
|
||||||
while (n--) \
|
|
||||||
{ \
|
|
||||||
INTER_RROP_SOLID(addrg); \
|
|
||||||
INTER_NEXT_GROUP(addrg); \
|
|
||||||
} \
|
|
||||||
if (endmask) \
|
|
||||||
INTER_RROP_SOLID_MASK(addrg, endmask); \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
#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
|
|
||||||
INTER_RROP_NAME(iplFillArcSliceSolid)(pDraw, pGC, arc)
|
|
||||||
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;
|
|
||||||
INTER_DECLAREG(*addrgt);
|
|
||||||
INTER_DECLAREG(*addrgb);
|
|
||||||
INTER_DECLAREG(*addrg);
|
|
||||||
register int n;
|
|
||||||
int ngwidth;
|
|
||||||
INTER_RROP_DECLARE
|
|
||||||
INTER_DECLAREG(startmask);
|
|
||||||
INTER_DECLAREG(endmask);
|
|
||||||
|
|
||||||
iplGetGroupWidthAndPointer (pDraw, ngwidth, addrgt);
|
|
||||||
|
|
||||||
INTER_RROP_FETCH_GC(pGC);
|
|
||||||
miFillArcSetup(arc, &info);
|
|
||||||
miFillArcSliceSetup(arc, &slice, pGC);
|
|
||||||
MIFILLARCSETUP();
|
|
||||||
xorg += pDraw->x;
|
|
||||||
yorg += pDraw->y;
|
|
||||||
addrgb = addrgt;
|
|
||||||
addrgt += ngwidth * (yorg - y);
|
|
||||||
addrgb += ngwidth * (yorg + y + dy);
|
|
||||||
slice.edge1.x += pDraw->x;
|
|
||||||
slice.edge2.x += pDraw->x;
|
|
||||||
while (y > 0)
|
|
||||||
{
|
|
||||||
addrgt += ngwidth;
|
|
||||||
addrgb -= ngwidth;
|
|
||||||
MIFILLARCSTEP(slw);
|
|
||||||
MIARCSLICESTEP(slice.edge1);
|
|
||||||
MIARCSLICESTEP(slice.edge2);
|
|
||||||
if (miFillSliceUpper(slice))
|
|
||||||
{
|
|
||||||
MIARCSLICEUPPER(xl, xr, slice, slw);
|
|
||||||
FILLSLICESPANS(slice.flip_top, addrgt);
|
|
||||||
}
|
|
||||||
if (miFillSliceLower(slice))
|
|
||||||
{
|
|
||||||
MIARCSLICELOWER(xl, xr, slice, slw);
|
|
||||||
FILLSLICESPANS(slice.flip_bot, addrgb);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
INTER_RROP_NAME(iplPolyFillArcSolid) (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 = iplGetCompositeClip(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 <= MAXSHORT) && (y2 <= MAXSHORT) &&
|
|
||||||
(RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN) )
|
|
||||||
{
|
|
||||||
if ((arc->angle2 >= FULLCIRCLE) ||
|
|
||||||
(arc->angle2 <= -FULLCIRCLE))
|
|
||||||
INTER_RROP_NAME(iplFillEllipseSolid)(pDraw, pGC, arc);
|
|
||||||
else
|
|
||||||
INTER_RROP_NAME(iplFillArcSliceSolid)(pDraw, pGC, arc);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
miPolyFillArc(pDraw, pGC, 1, arc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,281 +0,0 @@
|
|||||||
/* $XFree86: xc/programs/Xserver/iplan2p4/iplfillrct.c,v 3.0 1996/08/18 01:54:42 dawes Exp $ */
|
|
||||||
/*
|
|
||||||
* Fill rectangles.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
Copyright (c) 1989 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* $XConsortium: iplfillrct.c,v 5.18 94/04/17 20:28:47 dpw Exp $ */
|
|
||||||
|
|
||||||
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
|
|
||||||
interleaved planes */
|
|
||||||
|
|
||||||
#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 "ipl.h"
|
|
||||||
#include "iplmskbits.h"
|
|
||||||
#include "mergerop.h"
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
iplFillBoxTileOdd (pDrawable, n, rects, tile, xrot, yrot)
|
|
||||||
DrawablePtr pDrawable;
|
|
||||||
int n;
|
|
||||||
BoxPtr rects;
|
|
||||||
PixmapPtr tile;
|
|
||||||
int xrot, yrot;
|
|
||||||
{
|
|
||||||
if (tile->drawable.width & INTER_PIM)
|
|
||||||
iplFillBoxTileOddCopy (pDrawable, n, rects, tile, xrot, yrot, GXcopy, ~0L);
|
|
||||||
else
|
|
||||||
iplFillBoxTile32sCopy (pDrawable, n, rects, tile, xrot, yrot, GXcopy, ~0L);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
iplFillRectTileOdd (pDrawable, pGC, nBox, pBox)
|
|
||||||
DrawablePtr pDrawable;
|
|
||||||
GCPtr pGC;
|
|
||||||
int nBox;
|
|
||||||
BoxPtr pBox;
|
|
||||||
{
|
|
||||||
int xrot, yrot;
|
|
||||||
void (*fill)();
|
|
||||||
|
|
||||||
xrot = pDrawable->x + pGC->patOrg.x;
|
|
||||||
yrot = pDrawable->y + pGC->patOrg.y;
|
|
||||||
if (pGC->tile.pixmap->drawable.width & INTER_PIM)
|
|
||||||
{
|
|
||||||
fill = iplFillBoxTileOddGeneral;
|
|
||||||
if ((pGC->planemask & INTER_PMSK) == INTER_PMSK)
|
|
||||||
{
|
|
||||||
if (pGC->alu == GXcopy)
|
|
||||||
fill = iplFillBoxTileOddCopy;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fill = iplFillBoxTile32sGeneral;
|
|
||||||
if ((pGC->planemask & INTER_PMSK) == INTER_PMSK)
|
|
||||||
{
|
|
||||||
if (pGC->alu == GXcopy)
|
|
||||||
fill = iplFillBoxTile32sCopy;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
(*fill) (pDrawable, nBox, pBox, pGC->tile.pixmap, xrot, yrot, pGC->alu, pGC->planemask);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define NUM_STACK_RECTS 1024
|
|
||||||
|
|
||||||
void
|
|
||||||
iplPolyFillRect(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];
|
|
||||||
iplPrivGC *priv;
|
|
||||||
int numRects;
|
|
||||||
void (*BoxFill)();
|
|
||||||
int n;
|
|
||||||
int xorg, yorg;
|
|
||||||
|
|
||||||
priv = iplGetGCPrivate(pGC);
|
|
||||||
prgnClip = pGC->pCompositeClip;
|
|
||||||
|
|
||||||
BoxFill = 0;
|
|
||||||
switch (pGC->fillStyle)
|
|
||||||
{
|
|
||||||
case FillSolid:
|
|
||||||
switch (priv->rop) {
|
|
||||||
case GXcopy:
|
|
||||||
BoxFill = iplFillRectSolidCopy;
|
|
||||||
break;
|
|
||||||
case GXxor:
|
|
||||||
BoxFill = iplFillRectSolidXor;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
BoxFill = iplFillRectSolidGeneral;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case FillTiled:
|
|
||||||
if (!pGC->pRotatedPixmap)
|
|
||||||
BoxFill = iplFillRectTileOdd;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (pGC->alu == GXcopy && (pGC->planemask & INTER_PMSK) == INTER_PMSK)
|
|
||||||
BoxFill = iplFillRectTile32Copy;
|
|
||||||
else
|
|
||||||
BoxFill = iplFillRectTile32General;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
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)ALLOCATE_LOCAL(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)
|
|
||||||
DEALLOCATE_LOCAL(pboxClippedBase);
|
|
||||||
}
|
|
||||||
@@ -1,384 +0,0 @@
|
|||||||
/* $XFree86$ */
|
|
||||||
/************************************************************
|
|
||||||
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 X Consortium
|
|
||||||
not be used in advertising or publicity pertaining to
|
|
||||||
distribution of the software without specific prior
|
|
||||||
written permission. Sun and X Consortium 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 (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
******************************************************************/
|
|
||||||
|
|
||||||
/* $XConsortium: iplfillsp.c,v 5.24 94/04/17 20:28:48 dpw Exp $ */
|
|
||||||
|
|
||||||
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
|
|
||||||
interleaved planes */
|
|
||||||
|
|
||||||
#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 "ipl.h"
|
|
||||||
|
|
||||||
#include "mergerop.h"
|
|
||||||
|
|
||||||
#define MFB_CONSTS_ONLY
|
|
||||||
#include "maskbits.h"
|
|
||||||
|
|
||||||
#include "mi.h"
|
|
||||||
#include "mispans.h"
|
|
||||||
|
|
||||||
#include "iplmskbits.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 iplCreateGC().)
|
|
||||||
|
|
||||||
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
|
|
||||||
iplUnnaturalTileFS(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)();
|
|
||||||
int xrot, yrot;
|
|
||||||
|
|
||||||
if (!(pGC->planemask))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (pGC->tile.pixmap->drawable.width & INTER_PIM)
|
|
||||||
{
|
|
||||||
fill = iplFillSpanTileOddGeneral;
|
|
||||||
if ((pGC->planemask & INTER_PMSK) == INTER_PMSK)
|
|
||||||
{
|
|
||||||
if (pGC->alu == GXcopy)
|
|
||||||
fill = iplFillSpanTileOddCopy;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fill = iplFillSpanTile32sGeneral;
|
|
||||||
if ((pGC->planemask & INTER_PMSK) == INTER_PMSK)
|
|
||||||
{
|
|
||||||
if (pGC->alu == GXcopy)
|
|
||||||
fill = iplFillSpanTile32sCopy;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
n = nInit * miFindMaxBand( iplGetCompositeClip(pGC) );
|
|
||||||
if ( n == 0 )
|
|
||||||
return;
|
|
||||||
pwidth = (int *)ALLOCATE_LOCAL(n * sizeof(int));
|
|
||||||
ppt = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
|
|
||||||
if(!ppt || !pwidth)
|
|
||||||
{
|
|
||||||
if (ppt) DEALLOCATE_LOCAL(ppt);
|
|
||||||
if (pwidth) DEALLOCATE_LOCAL(pwidth);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
n = miClipSpans( iplGetCompositeClip(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);
|
|
||||||
|
|
||||||
DEALLOCATE_LOCAL(ppt);
|
|
||||||
DEALLOCATE_LOCAL(pwidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Fill spans with stipples that aren't 32 bits wide */
|
|
||||||
void
|
|
||||||
iplUnnaturalStippleFS(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 */
|
|
||||||
INTER_DECLAREG(*addrgBase); /* pointer to start of bitmap */
|
|
||||||
int ngwidth; /* width in groups of bitmap */
|
|
||||||
INTER_DECLAREG(*pdst); /* pointer to current group in bitmap */
|
|
||||||
PixmapPtr pStipple; /* pointer to stipple we want to fill with */
|
|
||||||
register int w;
|
|
||||||
int width, x, xrem, xSrc, ySrc;
|
|
||||||
INTER_DECLAREGP(tmpSrc);
|
|
||||||
INTER_DECLAREGP(tmpDst1);
|
|
||||||
INTER_DECLAREGP(tmpDst2);
|
|
||||||
int stwidth, stippleWidth;
|
|
||||||
unsigned long *psrcS;
|
|
||||||
int rop, stiprop;
|
|
||||||
int stippleHeight;
|
|
||||||
int *pwidthFree; /* copies of the pointers to free */
|
|
||||||
DDXPointPtr pptFree;
|
|
||||||
INTER_DECLARERRAXP(bgfill);
|
|
||||||
INTER_DECLARERRAXP(fgfill);
|
|
||||||
|
|
||||||
if (!(pGC->planemask))
|
|
||||||
return;
|
|
||||||
|
|
||||||
n = nInit * miFindMaxBand( iplGetCompositeClip(pGC) );
|
|
||||||
if ( n == 0 )
|
|
||||||
return;
|
|
||||||
pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
|
|
||||||
pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
|
|
||||||
if(!pptFree || !pwidthFree)
|
|
||||||
{
|
|
||||||
if (pptFree) DEALLOCATE_LOCAL(pptFree);
|
|
||||||
if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
pwidth = pwidthFree;
|
|
||||||
ppt = pptFree;
|
|
||||||
n = miClipSpans( iplGetCompositeClip(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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
INTER_PFILL(pGC->fgPixel, fgfill);
|
|
||||||
INTER_PFILL(pGC->bgPixel, bgfill);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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 / MFB_PGSZB;
|
|
||||||
stippleWidth = pStipple->drawable.width;
|
|
||||||
stippleHeight = pStipple->drawable.height;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The Target:
|
|
||||||
* Depth = INTER_PLANES
|
|
||||||
* Width = determined from *pwidth
|
|
||||||
* Groups per scanline = ngwidth
|
|
||||||
* Pointer to pixels = addrgBase
|
|
||||||
*/
|
|
||||||
|
|
||||||
iplGetGroupWidthAndPointer (pDrawable, ngwidth, addrgBase)
|
|
||||||
|
|
||||||
/* 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 = addrgBase + (ppt->y * ngwidth);
|
|
||||||
psrcS = (unsigned long *) pStipple->devPrivate.ptr + (iline * stwidth);
|
|
||||||
|
|
||||||
if (*pwidth)
|
|
||||||
{
|
|
||||||
width = *pwidth;
|
|
||||||
while(width > 0)
|
|
||||||
{
|
|
||||||
int xtemp, tmpx;
|
|
||||||
register unsigned long *ptemp;
|
|
||||||
INTER_DECLAREG(*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;
|
|
||||||
w = min((stippleWidth - xrem), width);
|
|
||||||
/* dist to word bound in dest */
|
|
||||||
w = min(w, INTER_PPG - (x & INTER_PIM));
|
|
||||||
/* dist to word bound in stip */
|
|
||||||
w = min(w, MFB_PPW - (x & MFB_PIM));
|
|
||||||
|
|
||||||
xtemp = (xrem & MFB_PIM);
|
|
||||||
ptemp = (unsigned long *)(psrcS + (xrem >> MFB_PWSH));
|
|
||||||
tmpx = x & INTER_PIM;
|
|
||||||
pdsttmp = pdst + (x >> INTER_PGSH) * INTER_PLANES;
|
|
||||||
switch ( pGC->fillStyle ) {
|
|
||||||
case FillOpaqueStippled:
|
|
||||||
INTER_getstipplepixelsb(ptemp,xtemp,w,bgfill,fgfill,
|
|
||||||
tmpDst1);
|
|
||||||
INTER_putbitsrop(tmpDst1, tmpx, w, pdsttmp,
|
|
||||||
pGC->planemask, rop);
|
|
||||||
break;
|
|
||||||
case FillStippled:
|
|
||||||
/* Fill tmpSrc with the source pixels */
|
|
||||||
INTER_getbits(pdsttmp, tmpx, w, tmpSrc);
|
|
||||||
INTER_getstipplepixels(ptemp, xtemp, w, 0, tmpSrc,
|
|
||||||
tmpDst1);
|
|
||||||
if (rop != stiprop) {
|
|
||||||
INTER_putbitsrop(fgfill, 0, w, tmpSrc, pGC->planemask, stiprop);
|
|
||||||
} else {
|
|
||||||
INTER_COPY(fgfill, tmpSrc);
|
|
||||||
}
|
|
||||||
INTER_getstipplepixels(ptemp, xtemp, w, 1, tmpSrc, tmpDst2);
|
|
||||||
INTER_OR(tmpDst1,tmpDst2,tmpDst2);
|
|
||||||
INTER_putbitsrop(tmpDst2, tmpx, w, pdsttmp,
|
|
||||||
pGC->planemask, rop);
|
|
||||||
}
|
|
||||||
x += w;
|
|
||||||
width -= w;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ppt++;
|
|
||||||
pwidth++;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEALLOCATE_LOCAL(pptFree);
|
|
||||||
DEALLOCATE_LOCAL(pwidthFree);
|
|
||||||
}
|
|
||||||
|
|
||||||
786
iplan2p4/iplgc.c
786
iplan2p4/iplgc.c
@@ -1,786 +0,0 @@
|
|||||||
/* $XFree86: xc/programs/Xserver/iplan2p4/iplgc.c,v 3.0 1996/08/18 01:54:45 dawes Exp $ */
|
|
||||||
/***********************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
******************************************************************/
|
|
||||||
|
|
||||||
/* $XConsortium: iplgc.c,v 5.62 94/04/17 20:28:49 dpw Exp $ */
|
|
||||||
|
|
||||||
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
|
|
||||||
interleaved planes */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include <X11/Xmd.h>
|
|
||||||
#include <X11/Xproto.h>
|
|
||||||
#include "ipl.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 "iplmskbits.h"
|
|
||||||
|
|
||||||
# ifdef WriteBitGroup
|
|
||||||
# define useTEGlyphBlt iplImageGlyphBlt8
|
|
||||||
# else
|
|
||||||
# define useTEGlyphBlt iplTEGlyphBlt
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#ifdef WriteBitGroup
|
|
||||||
# define useImageGlyphBlt iplImageGlyphBlt8
|
|
||||||
# define usePolyGlyphBlt iplPolyGlyphBlt8
|
|
||||||
#else
|
|
||||||
# define useImageGlyphBlt miImageGlyphBlt
|
|
||||||
# define usePolyGlyphBlt miPolyGlyphBlt
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FOUR_BIT_CODE
|
|
||||||
# define usePushPixels iplPushPixels8
|
|
||||||
#else
|
|
||||||
# define usePushPixels mfbPushPixels
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PIXEL_ADDR
|
|
||||||
# define ZeroPolyArc iplZeroPolyArcSS8Copy
|
|
||||||
#else
|
|
||||||
# define ZeroPolyArc miZeroPolyArc
|
|
||||||
#endif
|
|
||||||
|
|
||||||
GCFuncs iplGCFuncs = {
|
|
||||||
iplValidateGC,
|
|
||||||
miChangeGC,
|
|
||||||
miCopyGC,
|
|
||||||
miDestroyGC,
|
|
||||||
miChangeClip,
|
|
||||||
miDestroyClip,
|
|
||||||
miCopyClip,
|
|
||||||
};
|
|
||||||
|
|
||||||
GCOps iplTEOps1Rect = {
|
|
||||||
iplSolidSpansCopy,
|
|
||||||
iplSetSpans,
|
|
||||||
iplPutImage,
|
|
||||||
iplCopyArea,
|
|
||||||
iplCopyPlane,
|
|
||||||
iplPolyPoint,
|
|
||||||
#ifdef PIXEL_ADDR
|
|
||||||
ipl8LineSS1Rect,
|
|
||||||
ipl8SegmentSS1Rect,
|
|
||||||
#else
|
|
||||||
iplLineSS,
|
|
||||||
iplSegmentSS,
|
|
||||||
#endif
|
|
||||||
miPolyRectangle,
|
|
||||||
ZeroPolyArc,
|
|
||||||
iplFillPoly1RectCopy,
|
|
||||||
iplPolyFillRect,
|
|
||||||
iplPolyFillArcSolidCopy,
|
|
||||||
miPolyText8,
|
|
||||||
miPolyText16,
|
|
||||||
miImageText8,
|
|
||||||
miImageText16,
|
|
||||||
useTEGlyphBlt,
|
|
||||||
usePolyGlyphBlt,
|
|
||||||
usePushPixels
|
|
||||||
#ifdef NEED_LINEHELPER
|
|
||||||
,NULL
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
GCOps iplNonTEOps1Rect = {
|
|
||||||
iplSolidSpansCopy,
|
|
||||||
iplSetSpans,
|
|
||||||
iplPutImage,
|
|
||||||
iplCopyArea,
|
|
||||||
iplCopyPlane,
|
|
||||||
iplPolyPoint,
|
|
||||||
#ifdef PIXEL_ADDR
|
|
||||||
ipl8LineSS1Rect,
|
|
||||||
ipl8SegmentSS1Rect,
|
|
||||||
#else
|
|
||||||
iplLineSS,
|
|
||||||
iplSegmentSS,
|
|
||||||
#endif
|
|
||||||
miPolyRectangle,
|
|
||||||
ZeroPolyArc,
|
|
||||||
iplFillPoly1RectCopy,
|
|
||||||
iplPolyFillRect,
|
|
||||||
iplPolyFillArcSolidCopy,
|
|
||||||
miPolyText8,
|
|
||||||
miPolyText16,
|
|
||||||
miImageText8,
|
|
||||||
miImageText16,
|
|
||||||
useImageGlyphBlt,
|
|
||||||
usePolyGlyphBlt,
|
|
||||||
usePushPixels
|
|
||||||
#ifdef NEED_LINEHELPER
|
|
||||||
,NULL
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
GCOps iplTEOps = {
|
|
||||||
iplSolidSpansCopy,
|
|
||||||
iplSetSpans,
|
|
||||||
iplPutImage,
|
|
||||||
iplCopyArea,
|
|
||||||
iplCopyPlane,
|
|
||||||
iplPolyPoint,
|
|
||||||
iplLineSS,
|
|
||||||
iplSegmentSS,
|
|
||||||
miPolyRectangle,
|
|
||||||
ZeroPolyArc,
|
|
||||||
miFillPolygon,
|
|
||||||
iplPolyFillRect,
|
|
||||||
iplPolyFillArcSolidCopy,
|
|
||||||
miPolyText8,
|
|
||||||
miPolyText16,
|
|
||||||
miImageText8,
|
|
||||||
miImageText16,
|
|
||||||
useTEGlyphBlt,
|
|
||||||
usePolyGlyphBlt,
|
|
||||||
usePushPixels
|
|
||||||
#ifdef NEED_LINEHELPER
|
|
||||||
,NULL
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
GCOps iplNonTEOps = {
|
|
||||||
iplSolidSpansCopy,
|
|
||||||
iplSetSpans,
|
|
||||||
iplPutImage,
|
|
||||||
iplCopyArea,
|
|
||||||
iplCopyPlane,
|
|
||||||
iplPolyPoint,
|
|
||||||
iplLineSS,
|
|
||||||
iplSegmentSS,
|
|
||||||
miPolyRectangle,
|
|
||||||
#ifdef PIXEL_ADDR
|
|
||||||
iplZeroPolyArcSS8Copy,
|
|
||||||
#else
|
|
||||||
miZeroPolyArc,
|
|
||||||
#endif
|
|
||||||
miFillPolygon,
|
|
||||||
iplPolyFillRect,
|
|
||||||
iplPolyFillArcSolidCopy,
|
|
||||||
miPolyText8,
|
|
||||||
miPolyText16,
|
|
||||||
miImageText8,
|
|
||||||
miImageText16,
|
|
||||||
useImageGlyphBlt,
|
|
||||||
usePolyGlyphBlt,
|
|
||||||
usePushPixels
|
|
||||||
#ifdef NEED_LINEHELPER
|
|
||||||
,NULL
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
GCOps *
|
|
||||||
iplMatchCommon (pGC, devPriv)
|
|
||||||
GCPtr pGC;
|
|
||||||
iplPrivGCPtr 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 &iplTEOps1Rect;
|
|
||||||
#else
|
|
||||||
if (devPriv->oneRect)
|
|
||||||
return &iplTEOps1Rect;
|
|
||||||
else
|
|
||||||
return &iplTEOps;
|
|
||||||
#endif
|
|
||||||
else
|
|
||||||
#ifdef NO_ONE_RECT
|
|
||||||
return &iplNonTEOps1Rect;
|
|
||||||
#else
|
|
||||||
if (devPriv->oneRect)
|
|
||||||
return &iplNonTEOps1Rect;
|
|
||||||
else
|
|
||||||
return &iplNonTEOps;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool
|
|
||||||
iplCreateGC(pGC)
|
|
||||||
register GCPtr pGC;
|
|
||||||
{
|
|
||||||
iplPrivGC *pPriv;
|
|
||||||
|
|
||||||
if (PixmapWidthPaddingInfo[pGC->depth].padPixelsLog2 == LOG2_BITMAP_PAD)
|
|
||||||
return (mfbCreateGC(pGC));
|
|
||||||
pGC->clientClip = NULL;
|
|
||||||
pGC->clientClipType = CT_NONE;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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 = &iplNonTEOps;
|
|
||||||
pGC->funcs = &iplGCFuncs;
|
|
||||||
|
|
||||||
/* ipl wants to translate before scan conversion */
|
|
||||||
pGC->miTranslate = 1;
|
|
||||||
|
|
||||||
pPriv = iplGetGCPrivate(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
|
|
||||||
iplValidateGC(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 */
|
|
||||||
iplPrivGCPtr 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 = iplGetGCPrivate(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 <= INTER_PGSZ) && !(width & (width - 1)) &&
|
|
||||||
(nstipple = iplCopyPixmap(pGC->stipple)))
|
|
||||||
{
|
|
||||||
iplPadPixmap(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;
|
|
||||||
|
|
||||||
if ((width <= INTER_PGSZ) && !(width & (width - 1)))
|
|
||||||
{
|
|
||||||
iplCopyRotatePixmap(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 <= INTER_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 = iplReduceRasterOp(pGC->alu, pGC->fgPixel,
|
|
||||||
pGC->planemask, devPriv->andg, devPriv->xorg);
|
|
||||||
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 = iplMatchCommon (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 = iplFillPoly1RectCopy;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
pGC->ops->FillPolygon = iplFillPoly1RectGeneral;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
if (devPriv->oneRect && pGC->fillStyle == FillSolid)
|
|
||||||
{
|
|
||||||
switch (devPriv->rop) {
|
|
||||||
case GXcopy:
|
|
||||||
pGC->ops->FillPolygon = iplFillPoly1RectCopy;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
pGC->ops->FillPolygon = iplFillPoly1RectGeneral;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (pGC->lineWidth == 0)
|
|
||||||
{
|
|
||||||
#ifdef PIXEL_ADDR
|
|
||||||
if ((pGC->lineStyle == LineSolid) && (pGC->fillStyle == FillSolid))
|
|
||||||
{
|
|
||||||
switch (devPriv->rop)
|
|
||||||
{
|
|
||||||
case GXxor:
|
|
||||||
pGC->ops->PolyArc = iplZeroPolyArcSS8Xor;
|
|
||||||
break;
|
|
||||||
case GXcopy:
|
|
||||||
pGC->ops->PolyArc = iplZeroPolyArcSS8Copy;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
pGC->ops->PolyArc = iplZeroPolyArcSS8General;
|
|
||||||
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 = ipl8LineSS1Rect;
|
|
||||||
pGC->ops->PolySegment = ipl8SegmentSS1Rect;
|
|
||||||
} else
|
|
||||||
#endif
|
|
||||||
#ifdef NO_ONE_RECT
|
|
||||||
{
|
|
||||||
pGC->ops->Polylines = ipl8LineSS1Rect;
|
|
||||||
pGC->ops->PolySegment = ipl8SegmentSS1Rect;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
{
|
|
||||||
pGC->ops->Polylines = iplLineSS;
|
|
||||||
pGC->ops->PolySegment = iplSegmentSS;
|
|
||||||
}
|
|
||||||
#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 = iplLineSD;
|
|
||||||
pGC->ops->PolySegment = iplSegmentSD;
|
|
||||||
} 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 = iplPolyGlyphBlt8;
|
|
||||||
else
|
|
||||||
#ifdef FOUR_BIT_CODE
|
|
||||||
pGC->ops->PolyGlyphBlt = iplPolyGlyphRop8;
|
|
||||||
#else
|
|
||||||
pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
|
|
||||||
/* special case ImageGlyphBlt for terminal emulator fonts */
|
|
||||||
#if !defined(WriteBitGroup)
|
|
||||||
if (TERMINALFONT(pGC->font) &&
|
|
||||||
(pGC->planemask & INTER_PMSK) == INTER_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 & INTER_PMSK) == INTER_PMSK)
|
|
||||||
pGC->ops->ImageGlyphBlt = iplImageGlyphBlt8;
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
pGC->ops->ImageGlyphBlt = miImageGlyphBlt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (new_fillspans) {
|
|
||||||
switch (pGC->fillStyle) {
|
|
||||||
case FillSolid:
|
|
||||||
switch (devPriv->rop) {
|
|
||||||
case GXcopy:
|
|
||||||
pGC->ops->FillSpans = iplSolidSpansCopy;
|
|
||||||
break;
|
|
||||||
case GXxor:
|
|
||||||
pGC->ops->FillSpans = iplSolidSpansXor;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
pGC->ops->FillSpans = iplSolidSpansGeneral;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case FillTiled:
|
|
||||||
if (pGC->pRotatedPixmap)
|
|
||||||
{
|
|
||||||
if (pGC->alu == GXcopy && (pGC->planemask & INTER_PMSK) == INTER_PMSK)
|
|
||||||
pGC->ops->FillSpans = iplTile32FSCopy;
|
|
||||||
else
|
|
||||||
pGC->ops->FillSpans = iplTile32FSGeneral;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
pGC->ops->FillSpans = iplUnnaturalTileFS;
|
|
||||||
break;
|
|
||||||
case FillStippled:
|
|
||||||
#ifdef FOUR_BIT_CODE
|
|
||||||
if (pGC->pRotatedPixmap)
|
|
||||||
pGC->ops->FillSpans = ipl8Stipple32FS;
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
pGC->ops->FillSpans = iplUnnaturalStippleFS;
|
|
||||||
break;
|
|
||||||
case FillOpaqueStippled:
|
|
||||||
#ifdef FOUR_BIT_CODE
|
|
||||||
if (pGC->pRotatedPixmap)
|
|
||||||
pGC->ops->FillSpans = ipl8OpaqueStipple32FS;
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
pGC->ops->FillSpans = iplUnnaturalStippleFS;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
FatalError("iplValidateGC: 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 = iplPolyFillRect;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef FOUR_BIT_CODE
|
|
||||||
pGC->ops->PushPixels = mfbPushPixels;
|
|
||||||
if (pGC->fillStyle == FillSolid && devPriv->rop == GXcopy)
|
|
||||||
pGC->ops->PushPixels = iplPushPixels8;
|
|
||||||
#endif
|
|
||||||
pGC->ops->PolyFillArc = miPolyFillArc;
|
|
||||||
if (pGC->fillStyle == FillSolid)
|
|
||||||
{
|
|
||||||
switch (devPriv->rop)
|
|
||||||
{
|
|
||||||
case GXcopy:
|
|
||||||
pGC->ops->PolyFillArc = iplPolyFillArcSolidCopy;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
pGC->ops->PolyFillArc = iplPolyFillArcSolidGeneral;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,166 +0,0 @@
|
|||||||
/* $XFree86$ */
|
|
||||||
/* $XConsortium: iplgetsp.c,v 5.14 94/04/17 20:28:50 dpw Exp $ */
|
|
||||||
/***********************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
******************************************************************/
|
|
||||||
|
|
||||||
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
|
|
||||||
interleaved planes */
|
|
||||||
|
|
||||||
#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 "ipl.h"
|
|
||||||
#include "iplmskbits.h"
|
|
||||||
#include "iplpack.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
|
|
||||||
iplGetSpans(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 */
|
|
||||||
{
|
|
||||||
unsigned long *pdst = (unsigned long *)pchardstStart;
|
|
||||||
INTER_DECLAREG(*psrc); /* where to get the bits */
|
|
||||||
INTER_DECLAREGP(tmpSrc); /* scratch buffer for bits */
|
|
||||||
INTER_DECLAREG(*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 */
|
|
||||||
register int nstart;
|
|
||||||
int nend;
|
|
||||||
INTER_DECLAREG(startmask);
|
|
||||||
INTER_DECLAREG(endmask);
|
|
||||||
int nlMiddle, nl, srcBit;
|
|
||||||
int w,longs;
|
|
||||||
INTER_DECLAREG(*tmppdst);
|
|
||||||
INTER_DECLAREG(*ipdst);
|
|
||||||
|
|
||||||
switch (pDrawable->bitsPerPixel) {
|
|
||||||
case 1:
|
|
||||||
mfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart);
|
|
||||||
return;
|
|
||||||
case INTER_PLANES:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
FatalError("iplGetSpans: invalid depth\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
longs = NUM_LONGS(INTER_PLANES, 0, wMax);
|
|
||||||
tmppdst = (unsigned short *)
|
|
||||||
ALLOCATE_LOCAL(NUM_TEMP_BYTES(INTER_PLANES, longs));
|
|
||||||
iplGetGroupWidthAndPointer (pDrawable, widthSrc, psrcBase)
|
|
||||||
|
|
||||||
pptLast = ppt + nspans;
|
|
||||||
while(ppt < pptLast)
|
|
||||||
{
|
|
||||||
xEnd = min(ppt->x + *pwidth, (widthSrc / INTER_PLANES) << INTER_PGSH);
|
|
||||||
psrc = psrcBase + ppt->y * widthSrc +
|
|
||||||
(ppt->x >> INTER_PGSH) * INTER_PLANES;
|
|
||||||
w = xEnd - ppt->x;
|
|
||||||
srcBit = ppt->x & INTER_PIM;
|
|
||||||
ipdst = tmppdst;
|
|
||||||
|
|
||||||
if (srcBit + w <= INTER_PPG)
|
|
||||||
{
|
|
||||||
INTER_getbits(psrc, srcBit, w, tmpSrc);
|
|
||||||
INTER_putbits(tmpSrc, 0, w, ipdst, ~((unsigned long)0));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
INTER_maskbits(ppt->x, w, startmask, endmask, nlMiddle);
|
|
||||||
nstart = 0;
|
|
||||||
if (startmask)
|
|
||||||
{
|
|
||||||
nstart = INTER_PPG - srcBit;
|
|
||||||
INTER_getbits(psrc, srcBit, nstart, tmpSrc);
|
|
||||||
INTER_putbits(tmpSrc, 0, nstart, ipdst, ~((unsigned long)0));
|
|
||||||
if(srcBit + nstart >= INTER_PPG)
|
|
||||||
INTER_NEXT_GROUP(psrc);
|
|
||||||
}
|
|
||||||
nl = nlMiddle;
|
|
||||||
while (nl--)
|
|
||||||
{
|
|
||||||
INTER_putbits(psrc, nstart, INTER_PPG, ipdst, ~((unsigned long)0));
|
|
||||||
INTER_NEXT_GROUP(psrc);
|
|
||||||
INTER_NEXT_GROUP(ipdst);
|
|
||||||
}
|
|
||||||
if (endmask)
|
|
||||||
{
|
|
||||||
nend = xEnd & INTER_PIM;
|
|
||||||
INTER_getbits(psrc, 0, nend, tmpSrc);
|
|
||||||
INTER_putbits(tmpSrc, nstart, nend, ipdst, ~((unsigned long)0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
longs=(w * INTER_PLANES + 31)/32;
|
|
||||||
iplPackLine(INTER_PLANES, longs, tmppdst, pdst);
|
|
||||||
pdst+=longs;
|
|
||||||
ppt++;
|
|
||||||
pwidth++;
|
|
||||||
}
|
|
||||||
DEALLOCATE_LOCAL(tmppdst);
|
|
||||||
}
|
|
||||||
@@ -1,128 +0,0 @@
|
|||||||
/* $XFree86$ */
|
|
||||||
/***********************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
******************************************************************/
|
|
||||||
/* $XConsortium: iplhrzvert.c,v 1.8 94/04/17 20:28:51 dpw Exp $ */
|
|
||||||
|
|
||||||
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
|
|
||||||
interleaved planes */
|
|
||||||
|
|
||||||
#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 "ipl.h"
|
|
||||||
|
|
||||||
#include "iplmskbits.h"
|
|
||||||
|
|
||||||
/* horizontal solid line
|
|
||||||
abs(len) > 1
|
|
||||||
*/
|
|
||||||
iplHorzS(rop, andp, xorp, addrg, ngwidth, x1, y1, len)
|
|
||||||
register int rop;
|
|
||||||
INTER_DECLARERRAX(andp);
|
|
||||||
INTER_DECLARERRAX(xorp);
|
|
||||||
INTER_DECLAREG(*addrg); /* pointer to base of bitmap */
|
|
||||||
int ngwidth; /* width in groups of bitmap */
|
|
||||||
int x1; /* initial point */
|
|
||||||
int y1;
|
|
||||||
int len; /* length of line */
|
|
||||||
{
|
|
||||||
register int ngmiddle;
|
|
||||||
INTER_DECLAREG(startmask);
|
|
||||||
INTER_DECLAREG(endmask);
|
|
||||||
|
|
||||||
addrg = addrg + y1 * ngwidth + (x1 >> INTER_PGSH) * INTER_PLANES;
|
|
||||||
/* all bits inside same group */
|
|
||||||
if ( ((x1 & INTER_PIM) + len) < INTER_PPG)
|
|
||||||
{
|
|
||||||
INTER_maskpartialbits(x1, len, startmask);
|
|
||||||
INTER_DoMaskRRop(addrg, andp, xorp, startmask, addrg);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
INTER_maskbits(x1, len, startmask, endmask, ngmiddle);
|
|
||||||
if (startmask)
|
|
||||||
{
|
|
||||||
INTER_DoMaskRRop(addrg, andp, xorp, startmask, addrg);
|
|
||||||
addrg += INTER_PLANES;
|
|
||||||
}
|
|
||||||
while (ngmiddle--)
|
|
||||||
{
|
|
||||||
INTER_DoRRop(addrg, andp, xorp, addrg);
|
|
||||||
addrg += INTER_PLANES;
|
|
||||||
}
|
|
||||||
if (endmask)
|
|
||||||
INTER_DoMaskRRop(addrg, andp, xorp, endmask, addrg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* vertical solid line */
|
|
||||||
|
|
||||||
iplVertS(rop, andp, xorp, addrg, ngwidth, x1, y1, len)
|
|
||||||
int rop;
|
|
||||||
INTER_DECLARERRAX(andp);
|
|
||||||
INTER_DECLARERRAX(xorp);
|
|
||||||
INTER_DECLAREG(*addrg); /* pointer to base of bitmap */
|
|
||||||
register int ngwidth; /* width in groups of bitmap */
|
|
||||||
int x1, y1; /* initial point */
|
|
||||||
register int len; /* length of line */
|
|
||||||
{
|
|
||||||
addrg = addrg + (y1 * ngwidth) + (x1 >> INTER_PGSH) * INTER_PLANES;
|
|
||||||
while (len--)
|
|
||||||
{
|
|
||||||
INTER_DoMaskRRop(addrg, andp, xorp, iplmask[x1 & INTER_PIM], addrg);
|
|
||||||
addrg += ngwidth;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
/* $XFree86$ */
|
|
||||||
/***********************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
******************************************************************/
|
|
||||||
/* $XConsortium: iplimage.c,v 1.18 94/04/17 20:28:52 dpw Exp $ */
|
|
||||||
|
|
||||||
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
|
|
||||||
interleaved planes */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include "windowstr.h"
|
|
||||||
#include "pixmapstr.h"
|
|
||||||
#include "scrnintstr.h"
|
|
||||||
#include "gcstruct.h"
|
|
||||||
#include "ipl.h"
|
|
||||||
#include "servermd.h"
|
|
||||||
|
|
||||||
void
|
|
||||||
iplPutImage(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;
|
|
||||||
{
|
|
||||||
miPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
iplGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine)
|
|
||||||
DrawablePtr pDrawable;
|
|
||||||
int sx, sy, w, h;
|
|
||||||
unsigned int format;
|
|
||||||
unsigned long planeMask;
|
|
||||||
char *pdstLine;
|
|
||||||
{
|
|
||||||
miGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine);
|
|
||||||
}
|
|
||||||
@@ -1,758 +0,0 @@
|
|||||||
/* $XFree86: xc/programs/Xserver/iplan2p4/iplline.c,v 3.0 1996/08/18 01:54:50 dawes Exp $ */
|
|
||||||
/***********************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
******************************************************************/
|
|
||||||
/* $XConsortium: iplline.c,v 1.23 94/04/17 20:28:53 dpw Exp $ */
|
|
||||||
|
|
||||||
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
|
|
||||||
interleaved planes */
|
|
||||||
|
|
||||||
#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 "mistruct.h"
|
|
||||||
|
|
||||||
#include "ipl.h"
|
|
||||||
#include "miline.h"
|
|
||||||
|
|
||||||
#include "iplmskbits.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
|
|
||||||
iplSegmentSS (pDrawable, pGC, nseg, pSeg)
|
|
||||||
DrawablePtr pDrawable;
|
|
||||||
GCPtr pGC;
|
|
||||||
int nseg;
|
|
||||||
register xSegment *pSeg;
|
|
||||||
#else
|
|
||||||
iplLineSS (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 */
|
|
||||||
|
|
||||||
INTER_DECLAREG(*addrg); /* address of destination pixmap */
|
|
||||||
int ngwidth; /* width in groups 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;
|
|
||||||
iplPrivGCPtr devPriv;
|
|
||||||
INTER_DECLARERRAX(xor);
|
|
||||||
INTER_DECLARERRAX(and);
|
|
||||||
int alu;
|
|
||||||
|
|
||||||
devPriv = iplGetGCPrivate(pGC);
|
|
||||||
cclip = pGC->pCompositeClip;
|
|
||||||
pboxInit = REGION_RECTS(cclip);
|
|
||||||
nboxInit = REGION_NUM_RECTS(cclip);
|
|
||||||
|
|
||||||
iplGetGroupWidthAndPointer (pDrawable, ngwidth, addrg)
|
|
||||||
|
|
||||||
alu = devPriv->rop;
|
|
||||||
xor = devPriv->xorg;
|
|
||||||
and = devPriv->andg;
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
iplVertS (alu, and, xor,
|
|
||||||
addrg, ngwidth,
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
iplHorzS (alu, and, xor,
|
|
||||||
addrg, ngwidth,
|
|
||||||
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
|
|
||||||
iplBresS (alu, and, xor,
|
|
||||||
addrg, ngwidth,
|
|
||||||
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;
|
|
||||||
iplBresS(alu, and, xor,
|
|
||||||
addrg, ngwidth,
|
|
||||||
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))
|
|
||||||
{
|
|
||||||
INTER_DECLAREG(mask);
|
|
||||||
INTER_DECLAREGP(temp);
|
|
||||||
|
|
||||||
mask = iplmask[x2 & INTER_PIM];
|
|
||||||
addrg += (y2 * ngwidth) + (x2 >> INTER_PGSH) * INTER_PLANES;
|
|
||||||
|
|
||||||
INTER_DoRRop(addrg, and, xor, temp);
|
|
||||||
INTER_COPYM(temp, addrg, mask, addrg);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
pbox++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Draw dashed 1-pixel lines.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
#ifdef POLYSEGMENT
|
|
||||||
iplSegmentSD (pDrawable, pGC, nseg, pSeg)
|
|
||||||
DrawablePtr pDrawable;
|
|
||||||
register GCPtr pGC;
|
|
||||||
int nseg;
|
|
||||||
register xSegment *pSeg;
|
|
||||||
#else
|
|
||||||
iplLineSD( 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 */
|
|
||||||
|
|
||||||
INTER_DECLAREG(*addrg); /* address of destination pixmap */
|
|
||||||
int ngwidth; /* width in groups 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;
|
|
||||||
iplRRopRec rrops[2];
|
|
||||||
unsigned char *pDash;
|
|
||||||
int dashOffset;
|
|
||||||
int numInDashList;
|
|
||||||
int dashIndex;
|
|
||||||
int isDoubleDash;
|
|
||||||
int dashIndexTmp, dashOffsetTmp;
|
|
||||||
int unclippedlen;
|
|
||||||
iplPrivGCPtr devPriv;
|
|
||||||
|
|
||||||
devPriv = iplGetGCPrivate(pGC);
|
|
||||||
cclip = pGC->pCompositeClip;
|
|
||||||
rrops[0].rop = devPriv->rop;
|
|
||||||
INTER_COPY(devPriv->andg, rrops[0].andg)
|
|
||||||
INTER_COPY(devPriv->xorg, rrops[0].xorg)
|
|
||||||
#if 0
|
|
||||||
if (pGC->alu == GXcopy)
|
|
||||||
{
|
|
||||||
rrops[1].rop = GXcopy;
|
|
||||||
rrops[1].and = 0;
|
|
||||||
rrops[1].xor = PFILL (pGC->bgPixel);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
rrops[1].rop = iplReduceRasterOp (pGC->alu,
|
|
||||||
pGC->bgPixel, pGC->planemask,
|
|
||||||
rrops[1].andg, rrops[1].xorg);
|
|
||||||
}
|
|
||||||
pboxInit = REGION_RECTS(cclip);
|
|
||||||
nboxInit = REGION_NUM_RECTS(cclip);
|
|
||||||
|
|
||||||
iplGetGroupWidthAndPointer (pDrawable, ngwidth, addrg)
|
|
||||||
|
|
||||||
/* 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;
|
|
||||||
iplBresD (rrops,
|
|
||||||
&dashIndexTmp, pDash, numInDashList,
|
|
||||||
&dashOffsetTmp, isDoubleDash,
|
|
||||||
addrg, ngwidth,
|
|
||||||
signdx, signdy, axis, x1, y1,
|
|
||||||
e, e1, e2, unclippedlen);
|
|
||||||
break;
|
|
||||||
#else
|
|
||||||
iplBresD (rrops,
|
|
||||||
&dashIndex, pDash, numInDashList,
|
|
||||||
&dashOffset, isDoubleDash,
|
|
||||||
addrg, ngwidth,
|
|
||||||
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;
|
|
||||||
int dashIndexTmp, dashOffsetTmp;
|
|
||||||
|
|
||||||
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;
|
|
||||||
iplBresD (rrops,
|
|
||||||
&dashIndexTmp, pDash, numInDashList,
|
|
||||||
&dashOffsetTmp, isDoubleDash,
|
|
||||||
addrg, ngwidth,
|
|
||||||
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))
|
|
||||||
{
|
|
||||||
INTER_DECLAREG(mask);
|
|
||||||
int pix;
|
|
||||||
|
|
||||||
pix = 0;
|
|
||||||
if (dashIndex & 1)
|
|
||||||
pix = 1;
|
|
||||||
mask = iplmask[x2 & INTER_PIM];
|
|
||||||
addrg += (y2 * ngwidth) + (x2 >> INTER_PGSH) * INTER_PLANES;
|
|
||||||
INTER_DoMaskRRop(addrg, rrops[pix].andg, rrops[pix].xorg,
|
|
||||||
mask, addrg);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
pbox++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
@@ -1,176 +0,0 @@
|
|||||||
/* $XFree86: xc/programs/Xserver/iplan2p4/iplmap.h,v 3.1 1998/04/05 16:42:26 robin Exp $ */
|
|
||||||
/*
|
|
||||||
* $XConsortium: iplmap.h,v 1.9 94/04/17 20:28:54 dpw Exp $
|
|
||||||
*
|
|
||||||
Copyright (c) 1991 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
*
|
|
||||||
* Author: Keith Packard, MIT X Consortium
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
|
|
||||||
interleaved planes */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Map names around so that multiple depths can be supported simultaneously
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* a losing vendor cpp dumps core if we define NAME in terms of CATNAME */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if INTER_PLANES == 2
|
|
||||||
#define NAME(subname) ipl2p2##subname
|
|
||||||
#elif INTER_PLANES == 4
|
|
||||||
#define NAME(subname) ipl2p4##subname
|
|
||||||
#elif INTER_PLANES == 8
|
|
||||||
#define NAME(subname) ipl2p8##subname
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if !defined(UNIXCPP) || defined(ANSICPP)
|
|
||||||
#define CATNAME(prefix,subname) prefix##subname
|
|
||||||
#else
|
|
||||||
#define CATNAME(prefix,subname) prefix/**/subname
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define iplScreenPrivateIndex NAME(ScreenPrivateIndex)
|
|
||||||
#define QuartetBitsTable NAME(QuartetBitsTable)
|
|
||||||
#define QuartetPixelMaskTable NAME(QuartetPixelMaskTable)
|
|
||||||
#define iplAllocatePrivates NAME(AllocatePrivates)
|
|
||||||
#define iplBSFuncRec NAME(BSFuncRec)
|
|
||||||
#define iplBitBlt NAME(BitBlt)
|
|
||||||
#define iplBresD NAME(BresD)
|
|
||||||
#define iplBresS NAME(BresS)
|
|
||||||
#define iplChangeWindowAttributes NAME(ChangeWindowAttributes)
|
|
||||||
#define iplCloseScreen NAME(CloseScreen)
|
|
||||||
#define iplCopyArea NAME(CopyArea)
|
|
||||||
#define iplCopyImagePlane NAME(CopyImagePlane)
|
|
||||||
#define iplCopyPixmap NAME(CopyPixmap)
|
|
||||||
#define iplCopyPlane NAME(CopyPlane)
|
|
||||||
#define iplCopyRotatePixmap NAME(CopyRotatePixmap)
|
|
||||||
#define iplCopyWindow NAME(CopyWindow)
|
|
||||||
#define iplCreateGC NAME(CreateGC)
|
|
||||||
#define iplCreatePixmap NAME(CreatePixmap)
|
|
||||||
#define iplCreateWindow NAME(CreateWindow)
|
|
||||||
#define iplCreateScreenResources NAME(CreateScreenResoures)
|
|
||||||
#define iplDestroyPixmap NAME(DestroyPixmap)
|
|
||||||
#define iplDestroyWindow NAME(DestroyWindow)
|
|
||||||
#define iplDoBitblt NAME(DoBitblt)
|
|
||||||
#define iplDoBitbltCopy NAME(DoBitbltCopy)
|
|
||||||
#define iplDoBitbltGeneral NAME(DoBitbltGeneral)
|
|
||||||
#define iplDoBitbltOr NAME(DoBitbltOr)
|
|
||||||
#define iplDoBitbltXor NAME(DoBitbltXor)
|
|
||||||
#define iplFillBoxSolid NAME(FillBoxSolid)
|
|
||||||
#define iplFillBoxTile32 NAME(FillBoxTile32)
|
|
||||||
#define iplFillBoxTile32sCopy NAME(FillBoxTile32sCopy)
|
|
||||||
#define iplFillBoxTile32sGeneral NAME(FillBoxTile32sGeneral)
|
|
||||||
#define iplFillBoxTileOdd NAME(FillBoxTileOdd)
|
|
||||||
#define iplFillBoxTileOddCopy NAME(FillBoxTileOddCopy)
|
|
||||||
#define iplFillBoxTileOddGeneral NAME(FillBoxTileOddGeneral)
|
|
||||||
#define iplFillPoly1RectCopy NAME(FillPoly1RectCopy)
|
|
||||||
#define iplFillPoly1RectGeneral NAME(FillPoly1RectGeneral)
|
|
||||||
#define iplFillRectSolidCopy NAME(FillRectSolidCopy)
|
|
||||||
#define iplFillRectSolidGeneral NAME(FillRectSolidGeneral)
|
|
||||||
#define iplFillRectSolidXor NAME(FillRectSolidXor)
|
|
||||||
#define iplFillRectTile32Copy NAME(FillRectTile32Copy)
|
|
||||||
#define iplFillRectTile32General NAME(FillRectTile32General)
|
|
||||||
#define iplFillRectTileOdd NAME(FillRectTileOdd)
|
|
||||||
#define iplFillSpanTile32sCopy NAME(FillSpanTile32sCopy)
|
|
||||||
#define iplFillSpanTile32sGeneral NAME(FillSpanTile32sGeneral)
|
|
||||||
#define iplFillSpanTileOddCopy NAME(FillSpanTileOddCopy)
|
|
||||||
#define iplFillSpanTileOddGeneral NAME(FillSpanTileOddGeneral)
|
|
||||||
#define iplFinishScreenInit NAME(FinishScreenInit)
|
|
||||||
#define iplGCFuncs NAME(GCFuncs)
|
|
||||||
#define iplGetImage NAME(GetImage)
|
|
||||||
#define iplGetScreenPixmap NAME(GetScreenPixmap)
|
|
||||||
#define iplGetSpans NAME(GetSpans)
|
|
||||||
#define iplHorzS NAME(HorzS)
|
|
||||||
#define iplImageGlyphBlt8 NAME(ImageGlyphBlt8)
|
|
||||||
#define iplLineSD NAME(LineSD)
|
|
||||||
#define iplLineSS NAME(LineSS)
|
|
||||||
#define iplMapWindow NAME(MapWindow)
|
|
||||||
#define iplMatchCommon NAME(MatchCommon)
|
|
||||||
#define iplNonTEOps NAME(NonTEOps)
|
|
||||||
#define iplNonTEOps1Rect NAME(NonTEOps1Rect)
|
|
||||||
#define iplPadPixmap NAME(PadPixmap)
|
|
||||||
#define iplPaintWindow NAME(PaintWindow)
|
|
||||||
#define iplPolyGlyphBlt8 NAME(PolyGlyphBlt8)
|
|
||||||
#define iplPolyGlyphRop8 NAME(PolyGlyphRop8)
|
|
||||||
#define iplPolyFillArcSolidCopy NAME(PolyFillArcSolidCopy)
|
|
||||||
#define iplPolyFillArcSolidGeneral NAME(PolyFillArcSolidGeneral)
|
|
||||||
#define iplPolyFillRect NAME(PolyFillRect)
|
|
||||||
#define iplPolyPoint NAME(PolyPoint)
|
|
||||||
#define iplPositionWindow NAME(PositionWindow)
|
|
||||||
#define iplPutImage NAME(PutImage)
|
|
||||||
#define iplReduceRasterOp NAME(ReduceRasterOp)
|
|
||||||
#define iplRestoreAreas NAME(RestoreAreas)
|
|
||||||
#define iplSaveAreas NAME(SaveAreas)
|
|
||||||
#define iplScreenInit NAME(ScreenInit)
|
|
||||||
#define iplSegmentSD NAME(SegmentSD)
|
|
||||||
#define iplSegmentSS NAME(SegmentSS)
|
|
||||||
#define iplSetScanline NAME(SetScanline)
|
|
||||||
#define iplSetScreenPixmap NAME(SetScreenPixmap)
|
|
||||||
#define iplSetSpans NAME(SetSpans)
|
|
||||||
#define iplSetupScreen NAME(SetupScreen)
|
|
||||||
#define iplSolidSpansCopy NAME(SolidSpansCopy)
|
|
||||||
#define iplSolidSpansGeneral NAME(SolidSpansGeneral)
|
|
||||||
#define iplSolidSpansXor NAME(SolidSpansXor)
|
|
||||||
#define iplStippleStack NAME(StippleStack)
|
|
||||||
#define iplStippleStackTE NAME(StippleStackTE)
|
|
||||||
#define iplTEGlyphBlt NAME(TEGlyphBlt)
|
|
||||||
#define iplTEOps NAME(TEOps)
|
|
||||||
#define iplTEOps1Rect NAME(TEOps1Rect)
|
|
||||||
#define iplTile32FSCopy NAME(Tile32FSCopy)
|
|
||||||
#define iplTile32FSGeneral NAME(Tile32FSGeneral)
|
|
||||||
#define iplUnmapWindow NAME(UnmapWindow)
|
|
||||||
#define iplUnnaturalStippleFS NAME(UnnaturalStippleFS)
|
|
||||||
#define iplUnnaturalTileFS NAME(UnnaturalTileFS)
|
|
||||||
#define iplValidateGC NAME(ValidateGC)
|
|
||||||
#define iplVertS NAME(VertS)
|
|
||||||
#define iplXRotatePixmap NAME(XRotatePixmap)
|
|
||||||
#define iplYRotatePixmap NAME(YRotatePixmap)
|
|
||||||
#define iplendpartial NAME(endpartial)
|
|
||||||
#define iplendtab NAME(endtab)
|
|
||||||
#define iplmask NAME(mask)
|
|
||||||
#define iplrmask NAME(rmask)
|
|
||||||
#define iplstartpartial NAME(startpartial)
|
|
||||||
#define iplstarttab NAME(starttab)
|
|
||||||
#define ipl8LineSS1Rect NAME(LineSS1Rect)
|
|
||||||
#define ipl8SegmentSS1Rect NAME(SegmentSS1Rect)
|
|
||||||
#define ipl8ClippedLineCopy NAME(ClippedLineCopy)
|
|
||||||
#define ipl8ClippedLineXor NAME(ClippedLineXor)
|
|
||||||
#define ipl8ClippedLineGeneral NAME(ClippedLineGeneral )
|
|
||||||
#define ipl8SegmentSS1RectCopy NAME(SegmentSS1RectCopy)
|
|
||||||
#define ipl8SegmentSS1RectXor NAME(SegmentSS1RectXor)
|
|
||||||
#define ipl8SegmentSS1RectGeneral NAME(SegmentSS1RectGeneral )
|
|
||||||
#define ipl8SegmentSS1RectShiftCopy NAME(SegmentSS1RectShiftCopy)
|
|
||||||
#define ipl8LineSS1RectCopy NAME(LineSS1RectCopy)
|
|
||||||
#define ipl8LineSS1RectXor NAME(LineSS1RectXor)
|
|
||||||
#define ipl8LineSS1RectGeneral NAME(LineSS1RectGeneral )
|
|
||||||
#define ipl8LineSS1RectPreviousCopy NAME(LineSS1RectPreviousCopy)
|
|
||||||
#define iplZeroPolyArcSS8Copy NAME(ZeroPolyArcSSCopy)
|
|
||||||
#define iplZeroPolyArcSS8Xor NAME(ZeroPolyArcSSXor)
|
|
||||||
#define iplZeroPolyArcSS8General NAME(ZeroPolyArcSSGeneral)
|
|
||||||
@@ -1,146 +0,0 @@
|
|||||||
/* $XFree86: xc/programs/Xserver/iplan2p4/iplmergerop.h,v 3.0 1996/08/18 01:54:53 dawes Exp $ */
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _IPLANMERGEROP_H_
|
|
||||||
#define _IPLANMERGEROP_H_
|
|
||||||
|
|
||||||
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
|
|
||||||
interleaved planes */
|
|
||||||
|
|
||||||
/* defines:
|
|
||||||
INTER_MROP_NAME
|
|
||||||
INTER_MROP_DECLARE_REG()
|
|
||||||
INTER_MROP_INITIALIZE(alu, pm)
|
|
||||||
INTER_MROP_SOLID(src1, src2, dst)
|
|
||||||
INTER_MROP_MASK(src1, src2, mask, dst)
|
|
||||||
INTER_MROP_PREBUILD(src)
|
|
||||||
INTER_MROP_PREBUILT_DECLARE()
|
|
||||||
INTER_MROP_PREBUILT_SOLID(src,dst)
|
|
||||||
INTER_MROP_PREBUILT_MASK(src,dst,mask)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef GXcopy
|
|
||||||
#include <X11/X.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct _mergeRopBits {
|
|
||||||
unsigned long ca1, cx1, ca2, cx2;
|
|
||||||
} mergeRopRec, *mergeRopPtr;
|
|
||||||
|
|
||||||
extern mergeRopRec mergeRopBits[16];
|
|
||||||
|
|
||||||
#define INTER_DeclareMergeRop() \
|
|
||||||
INTER_DECLAREGP(_ca1); \
|
|
||||||
INTER_DECLAREGP(_cx1); \
|
|
||||||
INTER_DECLAREGP(_ca2); \
|
|
||||||
INTER_DECLAREGP(_cx2);
|
|
||||||
|
|
||||||
#define INTER_DeclarePrebuiltMergeRop() \
|
|
||||||
INTER_DECLAREGP(_cca); \
|
|
||||||
INTER_DECLAREGP(_ccx);
|
|
||||||
|
|
||||||
#define INTER_InitializeMergeRop(alu,pm) { \
|
|
||||||
INTER_DECLAREGP(_pm); \
|
|
||||||
mergeRopPtr _bits; \
|
|
||||||
INTER_PFILL(pm, _pm); \
|
|
||||||
_bits = &mergeRopBits[alu]; \
|
|
||||||
INTER_ANDMSK(_pm, _bits->ca1, _ca1); \
|
|
||||||
INTER_ANDMSK(_pm, _bits->ca2, _ca2); \
|
|
||||||
INTER_ANDMSK(_pm, _bits->cx2, _cx2); \
|
|
||||||
INTER_NOT(_pm, _pm); \
|
|
||||||
INTER_ORMSK(_pm, _bits->cx1, _cx1); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define INTER_DoMergeRop(src1, src2, dst) \
|
|
||||||
INTER_CPLX(src1, src2, _ca1, _cx1, _ca2, _cx2, dst)
|
|
||||||
|
|
||||||
#define INTER_DoMaskMergeRop(src1, src2, mask, dst) \
|
|
||||||
INTER_CPLXM(src1, src2, _ca1, _cx1, _ca2, _cx2, mask, dst)
|
|
||||||
|
|
||||||
#define INTER_DoPrebuiltMergeRop(src, dst) \
|
|
||||||
INTER_DoRRop(src, _cca, _ccx, dst)
|
|
||||||
|
|
||||||
#define INTER_DoMaskPrebuiltMergeRop(src, mask, dst) \
|
|
||||||
INTER_DoMaskRRop(src, _cca, _ccx, mask, dst)
|
|
||||||
|
|
||||||
#define INTER_PrebuildMergeRop(src) \
|
|
||||||
INTER_DoRRop(src, _ca1, _cx1, _cca); \
|
|
||||||
INTER_DoRRop(src, _ca2, _cx2, _ccx);
|
|
||||||
|
|
||||||
#ifndef MROP
|
|
||||||
#define MROP 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define Mclear (1<<GXclear)
|
|
||||||
#define Mand (1<<GXand)
|
|
||||||
#define MandReverse (1<<GXandReverse)
|
|
||||||
#define Mcopy (1<<GXcopy)
|
|
||||||
#define MandInverted (1<<GXandInverted)
|
|
||||||
#define Mnoop (1<<GXnoop)
|
|
||||||
#define Mxor (1<<GXxor)
|
|
||||||
#define Mor (1<<GXor)
|
|
||||||
#define Mnor (1<<GXnor)
|
|
||||||
#define Mequiv (1<<GXequiv)
|
|
||||||
#define Minvert (1<<GXinvert)
|
|
||||||
#define MorReverse (1<<GXorReverse)
|
|
||||||
#define McopyInverted (1<<GXcopyInverted)
|
|
||||||
#define MorInverted (1<<GXorInverted)
|
|
||||||
#define Mnand (1<<GXnand)
|
|
||||||
#define Mset (1<<GXset)
|
|
||||||
|
|
||||||
#if (MROP) == Mcopy
|
|
||||||
#define INTER_MROP_NAME(prefix) INTER_MROP_NAME_CAT(prefix,Copy)
|
|
||||||
#define INTER_MROP_DECLARE_REG()
|
|
||||||
#define INTER_MROP_INITIALIZE(alu,pm)
|
|
||||||
#define INTER_MROP_SOLID(src,dst,dst2) INTER_COPY(src, dst2)
|
|
||||||
#define INTER_MROP_MASK(src,dst,mask, dst2) INTER_COPYM(src,dst,mask,dst2)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (MROP) == Mxor
|
|
||||||
#define INTER_MROP_NAME(prefix) INTER_MROP_NAME_CAT(prefix,Xor)
|
|
||||||
#define INTER_MROP_DECLARE_REG()
|
|
||||||
#define INTER_MROP_INITIALIZE(alu,pm)
|
|
||||||
#define INTER_MROP_SOLID(src,dst,dst2) INTER_XOR(src,dst,dst2)
|
|
||||||
#define INTER_MROP_MASK(src,dst,mask,dst2) INTER_XORM(src,dst,mask,dst2)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (MROP) == Mor
|
|
||||||
#define INTER_MROP_NAME(prefix) INTER_MROP_NAME_CAT(prefix,Or)
|
|
||||||
#define INTER_MROP_DECLARE_REG()
|
|
||||||
#define INTER_MROP_INITIALIZE(alu,pm)
|
|
||||||
#define INTER_MROP_SOLID(src,dst,dst2) INTER_OR(src,dst,dst2)
|
|
||||||
#define INTER_MROP_MASK(src,dst,mask,dst2) INTER_ORM(src,dst,mask,dst2)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (MROP) == 0
|
|
||||||
#define INTER_MROP_NAME(prefix) INTER_MROP_NAME_CAT(prefix,General)
|
|
||||||
#define INTER_MROP_DECLARE_REG() INTER_DeclareMergeRop()
|
|
||||||
#define INTER_MROP_INITIALIZE(alu,pm) INTER_InitializeMergeRop(alu,pm)
|
|
||||||
#define INTER_MROP_SOLID(src,dst,dst2) INTER_DoMergeRop(src, dst, dst2)
|
|
||||||
#define INTER_MROP_MASK(src,dst,mask,dst2) \
|
|
||||||
INTER_DoMaskMergeRop(src, dst, mask, dst2)
|
|
||||||
#define INTER_MROP_PREBUILD(src) INTER_PrebuildMergeRop(src)
|
|
||||||
#define INTER_MROP_PREBUILT_DECLARE() INTER_DeclarePrebuiltMergeRop()
|
|
||||||
#define INTER_MROP_PREBUILT_SOLID(src,dst, dst2) \
|
|
||||||
INTER_DoPrebuiltMergeRop(dst,dst2)
|
|
||||||
#define INTER_MROP_PREBUILT_MASK(src,dst,mask,dst2) \
|
|
||||||
INTER_DoMaskPrebuiltMergeRop(dst,mask, dst2)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef INTER_MROP_PREBUILD
|
|
||||||
#define INTER_MROP_PREBUILD(src)
|
|
||||||
#define INTER_MROP_PREBUILT_DECLARE()
|
|
||||||
#define INTER_MROP_PREBUILT_SOLID(src,dst,dst2) INTER_MROP_SOLID(src,dst,dst2)
|
|
||||||
#define INTER_MROP_PREBUILT_MASK(src,dst,mask,dst2) \
|
|
||||||
INTER_MROP_MASK(src,dst,mask,dst2)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(UNIXCPP) || defined(ANSICPP)
|
|
||||||
#define INTER_MROP_NAME_CAT(prefix,suffix) prefix##suffix
|
|
||||||
#else
|
|
||||||
#define INTER_MROP_NAME_CAT(prefix,suffix) prefix/**/suffix
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _IPLANMERGEROP_H_ */
|
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
/* $XFree86$ */
|
|
||||||
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
|
|
||||||
interleaved planes */
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "iplmap.h"
|
|
||||||
|
|
||||||
unsigned short iplmask[] =
|
|
||||||
{ 0x8000,
|
|
||||||
0x4000,
|
|
||||||
0x2000,
|
|
||||||
0x1000,
|
|
||||||
0x0800,
|
|
||||||
0x0400,
|
|
||||||
0x0200,
|
|
||||||
0x0100,
|
|
||||||
0x0080,
|
|
||||||
0x0040,
|
|
||||||
0x0020,
|
|
||||||
0x0010,
|
|
||||||
0x0008,
|
|
||||||
0x0004,
|
|
||||||
0x0002,
|
|
||||||
0x0001
|
|
||||||
};
|
|
||||||
|
|
||||||
unsigned short iplstarttab[] =
|
|
||||||
{
|
|
||||||
0x0000,
|
|
||||||
0x7fff,
|
|
||||||
0x3fff,
|
|
||||||
0x1fff,
|
|
||||||
0x0fff,
|
|
||||||
0x07ff,
|
|
||||||
0x03ff,
|
|
||||||
0x01ff,
|
|
||||||
0x00ff,
|
|
||||||
0x007f,
|
|
||||||
0x003f,
|
|
||||||
0x001f,
|
|
||||||
0x000f,
|
|
||||||
0x0007,
|
|
||||||
0x0003,
|
|
||||||
0x0001
|
|
||||||
};
|
|
||||||
|
|
||||||
unsigned short iplendtab[] =
|
|
||||||
{
|
|
||||||
0x0000,
|
|
||||||
0x8000,
|
|
||||||
0xc000,
|
|
||||||
0xe000,
|
|
||||||
0xf000,
|
|
||||||
0xf800,
|
|
||||||
0xfc00,
|
|
||||||
0xfe00,
|
|
||||||
0xff00,
|
|
||||||
0xff80,
|
|
||||||
0xffc0,
|
|
||||||
0xffe0,
|
|
||||||
0xfff0,
|
|
||||||
0xfff8,
|
|
||||||
0xfffc,
|
|
||||||
0xfffe
|
|
||||||
};
|
|
||||||
|
|
||||||
unsigned short iplstartpartial[] =
|
|
||||||
{
|
|
||||||
0xffff,
|
|
||||||
0x7fff,
|
|
||||||
0x3fff,
|
|
||||||
0x1fff,
|
|
||||||
0x0fff,
|
|
||||||
0x07ff,
|
|
||||||
0x03ff,
|
|
||||||
0x01ff,
|
|
||||||
0x00ff,
|
|
||||||
0x007f,
|
|
||||||
0x003f,
|
|
||||||
0x001f,
|
|
||||||
0x000f,
|
|
||||||
0x0007,
|
|
||||||
0x0003,
|
|
||||||
0x0001
|
|
||||||
};
|
|
||||||
|
|
||||||
unsigned short iplendpartial[] =
|
|
||||||
{
|
|
||||||
0xffff,
|
|
||||||
0x8000,
|
|
||||||
0xc000,
|
|
||||||
0xe000,
|
|
||||||
0xf000,
|
|
||||||
0xf800,
|
|
||||||
0xfc00,
|
|
||||||
0xfe00,
|
|
||||||
0xff00,
|
|
||||||
0xff80,
|
|
||||||
0xffc0,
|
|
||||||
0xffe0,
|
|
||||||
0xfff0,
|
|
||||||
0xfff8,
|
|
||||||
0xfffc,
|
|
||||||
0xfffe
|
|
||||||
};
|
|
||||||
|
|
||||||
@@ -1,500 +0,0 @@
|
|||||||
/* $XFree86$ */
|
|
||||||
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
|
|
||||||
interleaved planes */
|
|
||||||
|
|
||||||
#define INTER_PIXGRP unsigned short
|
|
||||||
|
|
||||||
#define INTER_PGSZ 16
|
|
||||||
#define INTER_PGSZB 2
|
|
||||||
#define INTER_PPG 16
|
|
||||||
#define INTER_PPGMSK 0xffff
|
|
||||||
#define INTER_PLST 15
|
|
||||||
#define INTER_PIM 15
|
|
||||||
#define INTER_PGSH 4
|
|
||||||
#define INTER_PMSK ((1 << (INTER_PLANES)) - 1)
|
|
||||||
|
|
||||||
extern INTER_PIXGRP iplmask[];
|
|
||||||
extern INTER_PIXGRP iplstarttab[];
|
|
||||||
extern INTER_PIXGRP iplendtab[];
|
|
||||||
extern INTER_PIXGRP iplstartpartial[];
|
|
||||||
extern INTER_PIXGRP iplendpartial[];
|
|
||||||
|
|
||||||
#define MFB_PSZ 1
|
|
||||||
|
|
||||||
#define INTER_NEXT(x) ((x) + INTER_PLANES)
|
|
||||||
#define INTER_NEXT_GROUP(x) (x) += INTER_PLANES
|
|
||||||
#define INTER_PREV_GROUP(x) (x) -= INTER_PLANES
|
|
||||||
|
|
||||||
#define _I(x) (((unsigned long *) (x))[_INDEX])
|
|
||||||
#define _IG(x) ((x)[_INDEX])
|
|
||||||
|
|
||||||
#define INTER_DECLAREG(x) INTER_PIXGRP x
|
|
||||||
#define INTER_DECLAREGP(x) INTER_PIXGRP x[INTER_PLANES]
|
|
||||||
|
|
||||||
#define INTER_DECLARERRAX(x) INTER_PIXGRP *(x)
|
|
||||||
#define INTER_DECLARERRAXP(x) INTER_PIXGRP x[INTER_PLANES]
|
|
||||||
|
|
||||||
/* and |= PLANE_FILL(~fg), or &= PLANE_FILL(fg) */
|
|
||||||
#define INTER_ANDXOR_PM(pm, and, xor) \
|
|
||||||
PLANE_TIMESG( \
|
|
||||||
if (!(pm & INTER_PLANE(_INDEX))) { \
|
|
||||||
_IG(and) = INTER_PPGMSK; \
|
|
||||||
_IG(xor) = 0; \
|
|
||||||
})
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if INTER_PLANES == 2
|
|
||||||
|
|
||||||
#define PLANE_TIMESCONDG(x) \
|
|
||||||
({ int _INDEX; \
|
|
||||||
int _ret; \
|
|
||||||
_ret=(_INDEX=0, (x)) && \
|
|
||||||
(_INDEX=1, (x)) && \
|
|
||||||
_ret; \
|
|
||||||
})
|
|
||||||
|
|
||||||
#define PLANE_TIMESCOND(x) \
|
|
||||||
({ int _INDEX; \
|
|
||||||
(_INDEX=0, x) \
|
|
||||||
})
|
|
||||||
|
|
||||||
#define PLANE_TIMESG(x) \
|
|
||||||
{ int _INDEX; \
|
|
||||||
_INDEX=0; x; \
|
|
||||||
_INDEX=1; x; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define PLANE_TIMES(x) \
|
|
||||||
{ int _INDEX; \
|
|
||||||
_INDEX=0; x; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#elif INTER_PLANES == 4
|
|
||||||
|
|
||||||
#define PLANE_TIMESCONDG(x) \
|
|
||||||
({ int _INDEX; \
|
|
||||||
int _ret; \
|
|
||||||
_ret=(_INDEX=0, (x)) && \
|
|
||||||
(_INDEX=1, (x)) && \
|
|
||||||
(_INDEX=2, (x)) && \
|
|
||||||
(_INDEX=3, (x)); \
|
|
||||||
_ret; \
|
|
||||||
})
|
|
||||||
|
|
||||||
#define PLANE_TIMESCOND(x) \
|
|
||||||
({ int _INDEX; \
|
|
||||||
((_INDEX=0, x) && \
|
|
||||||
(_INDEX=1, x)) \
|
|
||||||
})
|
|
||||||
|
|
||||||
#define PLANE_TIMESG(x) \
|
|
||||||
{ int _INDEX; \
|
|
||||||
_INDEX=0; x; \
|
|
||||||
_INDEX=1; x; \
|
|
||||||
_INDEX=2; x; \
|
|
||||||
_INDEX=3; x; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define PLANE_TIMES(x) \
|
|
||||||
{ int _INDEX; \
|
|
||||||
_INDEX=0; x; \
|
|
||||||
_INDEX=1; x; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#elif INTER_PLANES == 8
|
|
||||||
|
|
||||||
#define PLANE_TIMESCONDG(x) \
|
|
||||||
({ int _INDEX; \
|
|
||||||
int _ret; \
|
|
||||||
_ret=((_INDEX=0, (x)) && \
|
|
||||||
(_INDEX=1, (x)) && \
|
|
||||||
(_INDEX=2, (x)) && \
|
|
||||||
(_INDEX=3, (x)) && \
|
|
||||||
(_INDEX=4, (x)) && \
|
|
||||||
(_INDEX=5, (x)) && \
|
|
||||||
(_INDEX=6, (x)) && \
|
|
||||||
(_INDEX=7, (x))); \
|
|
||||||
_ret; \
|
|
||||||
})
|
|
||||||
|
|
||||||
#define PLANE_TIMESCOND(x) \
|
|
||||||
({ int _INDEX; \
|
|
||||||
((_INDEX=0, x) && \
|
|
||||||
(_INDEX=1, x) && \
|
|
||||||
(_INDEX=2, x) && \
|
|
||||||
(_INDEX=3, x)) \
|
|
||||||
})
|
|
||||||
|
|
||||||
#define PLANE_TIMESG(x) \
|
|
||||||
{ int _INDEX; \
|
|
||||||
_INDEX=0; x; \
|
|
||||||
_INDEX=1; x; \
|
|
||||||
_INDEX=2; x; \
|
|
||||||
_INDEX=3; x; \
|
|
||||||
_INDEX=4; x; \
|
|
||||||
_INDEX=5; x; \
|
|
||||||
_INDEX=6; x; \
|
|
||||||
_INDEX=7; x; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define PLANE_TIMES(x) \
|
|
||||||
{ int _INDEX; \
|
|
||||||
_INDEX=0; x; \
|
|
||||||
_INDEX=1; x; \
|
|
||||||
_INDEX=2; x; \
|
|
||||||
_INDEX=3; x; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* src = 0 */
|
|
||||||
#define INTER_IS_CLR(src) \
|
|
||||||
PLANE_TIMESCONDG(_IG(src) == 0)
|
|
||||||
|
|
||||||
/* src = PPGMSK ? */
|
|
||||||
#define INTER_IS_SET(src) \
|
|
||||||
PLANE_TIMESCONDG(_IG(src) == INTER_PPGMSK)
|
|
||||||
|
|
||||||
/* (src1 ^ scr2) = PPGMSK ? */
|
|
||||||
#define INTER_IS_XOR_SET(src1, src2) \
|
|
||||||
PLANE_TIMESCONDG((_IG(src1) ^ _IG(src2)) == INTER_PPGMSK)
|
|
||||||
|
|
||||||
/* dst = ~src */
|
|
||||||
#define INTER_NOT(src, dst) \
|
|
||||||
PLANE_TIMES(_I(dst) = ~_I(src))
|
|
||||||
|
|
||||||
/* dst = 0 */
|
|
||||||
#define INTER_CLR(dst) \
|
|
||||||
PLANE_TIMES(_I(dst) = 0)
|
|
||||||
|
|
||||||
/* dst = PPGMSK */
|
|
||||||
#define INTER_SET(dst) \
|
|
||||||
PLANE_TIMESG(_IG(dst) = INTER_PPGMSK)
|
|
||||||
|
|
||||||
/* dst = src */
|
|
||||||
#define INTER_COPY(src,dst) \
|
|
||||||
PLANE_TIMES(_I(dst) = _I(src))
|
|
||||||
|
|
||||||
/* dst2 = (dst & ~mask) | (src & mask) */
|
|
||||||
#define INTER_COPYM(src,dst,mask,dst2) \
|
|
||||||
PLANE_TIMESG( \
|
|
||||||
_IG(dst2) = (_IG(dst) & ~mask) | (_IG(src) & mask) \
|
|
||||||
)
|
|
||||||
|
|
||||||
/* dst2 = dst ^ src */
|
|
||||||
#define INTER_XOR(src,dst,dst2) \
|
|
||||||
PLANE_TIMES(_I(dst2) = _I(dst) ^ _I(src))
|
|
||||||
|
|
||||||
/* dst2 = dst ^ (src & mask) */
|
|
||||||
#define INTER_XORM(src,dst,mask,dst2) \
|
|
||||||
PLANE_TIMESG(_IG(dst2) = _IG(dst) ^ (_IG(src) & (mask)))
|
|
||||||
|
|
||||||
/* dst2 = dst & src */
|
|
||||||
#define INTER_AND(src,dst,dst2) \
|
|
||||||
PLANE_TIMES(_I(dst2) = _I(dst) & _I(src))
|
|
||||||
|
|
||||||
/* dst2 = dst & (src | ~mask) */
|
|
||||||
#define INTER_ANDM(mask,src,dst,dst2) \
|
|
||||||
PLANE_TIMESG(_IG(dst2) = _IG(dst) & (_IG(src) | ~(mask)))
|
|
||||||
|
|
||||||
/* dst2 = dst | src */
|
|
||||||
#define INTER_OR(src,dst,dst2) \
|
|
||||||
PLANE_TIMES(_I(dst2) = _I(dst) | _I(src))
|
|
||||||
|
|
||||||
/* dst2 = dst | (src & mask) */
|
|
||||||
#define INTER_ORM(src,dst,mask,dst2) \
|
|
||||||
PLANE_TIMESG(_IG(dst2) = _IG(dst) | (_IG(src) & (mask)))
|
|
||||||
|
|
||||||
/* dst = src | msk */
|
|
||||||
#define INTER_ORMSK(src,msk,dst) \
|
|
||||||
PLANE_TIMESG(_IG(dst) = _IG(src) | (msk))
|
|
||||||
|
|
||||||
/* dst = src & msk */
|
|
||||||
#define INTER_ANDMSK(src,msk,dst) \
|
|
||||||
PLANE_TIMESG(_IG(dst) = _IG(src) & (msk))
|
|
||||||
|
|
||||||
/* dst = (src1 & msk1) | (src2 & msk2) */
|
|
||||||
#define INTER_ANDMSK2(src1,msk1,src2,msk2,dst) \
|
|
||||||
PLANE_TIMESG(_IG(dst) = (_IG(src1) & (msk1)) | (_IG(src2) & (msk2)))
|
|
||||||
|
|
||||||
#define INTER_PLANE(x) (1<<(x))
|
|
||||||
|
|
||||||
#define INTER_PFILL(col, fill) \
|
|
||||||
PLANE_TIMESG(_IG(fill) = \
|
|
||||||
((col) & INTER_PLANE(_INDEX)) ? INTER_PPGMSK : 0)
|
|
||||||
|
|
||||||
/* dst = src >> cnt */
|
|
||||||
#define INTER_SCRRIGHT(cnt, src, dst) \
|
|
||||||
PLANE_TIMESG(_IG(dst) = _IG(src) >> (cnt))
|
|
||||||
|
|
||||||
/* dst = src << cnt */
|
|
||||||
#define INTER_SCRLEFT(cnt, src, dst) \
|
|
||||||
PLANE_TIMESG(_IG(dst) = _IG(src) << (cnt))
|
|
||||||
|
|
||||||
/* bits1=(bits >> right) | (bits=psrc) << left) */
|
|
||||||
#define INTER_GETRLC(right, left, psrc, bits, bits1) \
|
|
||||||
PLANE_TIMESG( _IG(bits1)=(_IG(bits) >> (right)) | \
|
|
||||||
((_IG(bits) = _IG(psrc)) << (left)))
|
|
||||||
|
|
||||||
/* bits1=(bits << left) | (bits=psrc) >> right) */
|
|
||||||
#define INTER_GETLRC(left, right, psrc, bits, bits1) \
|
|
||||||
PLANE_TIMESG( _IG(bits1)=(_IG(bits) << (left)) | \
|
|
||||||
((_IG(bits) = _IG(psrc)) >> (right)))
|
|
||||||
|
|
||||||
/* dst=src2 & (src1 & a1 ^ x1) ^ (src1 & a2 ^ x2) */
|
|
||||||
#define INTER_CPLX(src1, src2, a1, x1, a2, x2, dst) \
|
|
||||||
PLANE_TIMES( _I(dst) = (_I(src2) \
|
|
||||||
& (_I(src1) & _I(a1) ^ _I(x1)) \
|
|
||||||
^ (_I(src1) & _I(a2) ^ _I(x2)))) \
|
|
||||||
|
|
||||||
/* dst=src2 & ((src1 & a1 ^ x1) | ~mask) ^ ((src1 & a2 ^ x2) & mask) */
|
|
||||||
#define INTER_CPLXM(src1, src2, a1, x1, a2, x2, mask, dst) \
|
|
||||||
PLANE_TIMESG( _IG(dst) = (_IG(src2) \
|
|
||||||
& ((_IG(src1) & _IG(a1) ^ _IG(x1)) | ~mask) \
|
|
||||||
^ ((_IG(src1) & _IG(a2) ^ _IG(x2)) & mask)))
|
|
||||||
|
|
||||||
/* dst = (src & ~(bitmask | planemask)) | (insert | (bitmask | planemask)) */
|
|
||||||
#define INTER_PMSKINS(bitmask, planemask, insert, src, dst) \
|
|
||||||
PLANE_TIMESG( \
|
|
||||||
if (planemask & INTER_PLANE(_INDEX)) \
|
|
||||||
_IG(dst) = (_IG(src) & ~bitmask) | (_IG(insert) & bitmask) \
|
|
||||||
)
|
|
||||||
|
|
||||||
/* dst = (src & ~bitmask) | ((insert >> shift) & bitmask) */
|
|
||||||
#define INTER_SCRRMSKINS(bitmask, planemask, insert, shift, src, dst) \
|
|
||||||
PLANE_TIMESG( \
|
|
||||||
if (planemask & INTER_PLANE(_INDEX)) \
|
|
||||||
_IG(dst) = (_IG(src) & ~(bitmask)) | \
|
|
||||||
((_IG(insert) >> shift) & (bitmask)) \
|
|
||||||
)
|
|
||||||
|
|
||||||
/* dst = (src & ~bitmask) | ((insert << shift) & bitmask) */
|
|
||||||
#define INTER_SCRLMSKINS(bitmask, planemask, insert, shift, src, dst) \
|
|
||||||
PLANE_TIMESG( \
|
|
||||||
if (planemask & INTER_PLANE(_INDEX)) \
|
|
||||||
_IG(dst) = (_IG(src) & ~bitmask) | \
|
|
||||||
((_IG(insert) << shift) & bitmask) \
|
|
||||||
)
|
|
||||||
|
|
||||||
/* dst = ((src1 << sl1) & bitmask1) | ((src2 >> sr2) & bitmask2) */
|
|
||||||
#define INTER_MSKINSM(bitmask1, sl1, src1, bitmask2, sr2, src2, dst) \
|
|
||||||
PLANE_TIMESG( \
|
|
||||||
_IG(dst) = ((_IG(src1) << sl1) & (bitmask1)) | \
|
|
||||||
((_IG(src2) >> sr2) & (bitmask2)) \
|
|
||||||
)
|
|
||||||
|
|
||||||
/* dst = src & and ^ xor */
|
|
||||||
#define INTER_DoRRop(src, and, xor, dst) \
|
|
||||||
PLANE_TIMES(_I(dst) = (_I(src) & _I(and) ^ _I(xor))) \
|
|
||||||
|
|
||||||
#define INTER_DoMaskRRop(src, and, xor, mask, dst) \
|
|
||||||
PLANE_TIMESG( \
|
|
||||||
_IG(dst) = (_IG(src) & ((_IG(and) | ~(mask))) \
|
|
||||||
^ (_IG(xor) & mask)))
|
|
||||||
|
|
||||||
#define INTER_DoRop(result, alu, src, dst) \
|
|
||||||
{ \
|
|
||||||
if (alu == GXcopy) { \
|
|
||||||
PLANE_TIMES( \
|
|
||||||
_I(result) = fnCOPY (_I(src), _I(dst))); \
|
|
||||||
} else if (alu == GXxor) { \
|
|
||||||
PLANE_TIMES( \
|
|
||||||
_I(result) = fnXOR (_I(src), _I(dst))); \
|
|
||||||
} \
|
|
||||||
else { \
|
|
||||||
switch (alu) \
|
|
||||||
{ \
|
|
||||||
case GXclear: \
|
|
||||||
PLANE_TIMES( \
|
|
||||||
_I(result) = fnCLEAR (_I(src), _I(dst))); \
|
|
||||||
break; \
|
|
||||||
case GXand: \
|
|
||||||
PLANE_TIMES( \
|
|
||||||
_I(result) = fnAND (_I(src), _I(dst))); \
|
|
||||||
break; \
|
|
||||||
case GXandReverse: \
|
|
||||||
PLANE_TIMES( \
|
|
||||||
_I(result) = fnANDREVERSE (_I(src), _I(dst))); \
|
|
||||||
break; \
|
|
||||||
case GXandInverted: \
|
|
||||||
PLANE_TIMES( \
|
|
||||||
_I(result) = fnANDINVERTED (_I(src), _I(dst))); \
|
|
||||||
break; \
|
|
||||||
case GXnoop: \
|
|
||||||
PLANE_TIMES( \
|
|
||||||
_I(result) = fnNOOP (_I(src), _I(dst))); \
|
|
||||||
break; \
|
|
||||||
case GXor: \
|
|
||||||
PLANE_TIMES( \
|
|
||||||
_I(result) = fnOR (_I(src), _I(dst))); \
|
|
||||||
break; \
|
|
||||||
case GXnor: \
|
|
||||||
PLANE_TIMES( \
|
|
||||||
_I(result) = fnNOR (_I(src), _I(dst))); \
|
|
||||||
break; \
|
|
||||||
case GXequiv: \
|
|
||||||
PLANE_TIMES( \
|
|
||||||
_I(result) = fnEQUIV (_I(src), _I(dst))); \
|
|
||||||
break; \
|
|
||||||
case GXinvert: \
|
|
||||||
PLANE_TIMES( \
|
|
||||||
_I(result) = fnINVERT (_I(src), _I(dst))); \
|
|
||||||
break; \
|
|
||||||
case GXorReverse: \
|
|
||||||
PLANE_TIMES( \
|
|
||||||
_I(result) = fnORREVERSE (_I(src), _I(dst))); \
|
|
||||||
break; \
|
|
||||||
case GXcopyInverted: \
|
|
||||||
PLANE_TIMES( \
|
|
||||||
_I(result) = fnCOPYINVERTED (_I(src), _I(dst))); \
|
|
||||||
break; \
|
|
||||||
case GXorInverted: \
|
|
||||||
PLANE_TIMES( \
|
|
||||||
_I(result) = fnORINVERTED (_I(src), _I(dst))); \
|
|
||||||
break; \
|
|
||||||
case GXnand: \
|
|
||||||
PLANE_TIMES( \
|
|
||||||
_I(result) = fnNAND (_I(src), _I(dst))); \
|
|
||||||
break; \
|
|
||||||
case GXset: \
|
|
||||||
PLANE_TIMES( \
|
|
||||||
_I(result) = fnSET (_I(src), _I(dst))); \
|
|
||||||
break; \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define iplGetGroupWidthAndPointer(pDrawable, width, pointer) \
|
|
||||||
iplGetTypedWidthAndPointer(pDrawable, width, pointer, INTER_PIXGRP, INTER_PIXGRP)
|
|
||||||
|
|
||||||
#define INTER_getstipplepixels(psrcstip, x, w, ones, psrcpix, pdstpix) \
|
|
||||||
{ \
|
|
||||||
unsigned long q; \
|
|
||||||
int m; \
|
|
||||||
if (ones) { \
|
|
||||||
if ((m = ((x) - ((MFB_PPW*MFB_PSZ)-MFB_PPW))) > 0) { \
|
|
||||||
q = (*(psrcstip)) << m; \
|
|
||||||
if ( (x)+(w) > (MFB_PPW*MFB_PSZ) ) \
|
|
||||||
q |= *((psrcstip)+1) >> ((MFB_PPW*MFB_PSZ)-m); \
|
|
||||||
} \
|
|
||||||
else \
|
|
||||||
q = (*(psrcstip)) >> -m; \
|
|
||||||
} \
|
|
||||||
else { \
|
|
||||||
if ((m = ((x) - ((MFB_PPW*MFB_PSZ)-MFB_PPW))) > 0) { \
|
|
||||||
q = (~ *(psrcstip)) << m; \
|
|
||||||
if ( (x)+(w) > (MFB_PPW*MFB_PSZ) ) \
|
|
||||||
q |= (~*((psrcstip)+1)) >> ((MFB_PPW*MFB_PSZ)-m); \
|
|
||||||
} \
|
|
||||||
else \
|
|
||||||
q = (~ *(psrcstip)) >> -m; \
|
|
||||||
} \
|
|
||||||
q >>=16; \
|
|
||||||
INTER_ANDMSK(psrcpix,q,pdstpix); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define INTER_getstipplepixelsb(psrcstip, x, w, psrcpix0, psrcpix1, pdstpix) \
|
|
||||||
{ \
|
|
||||||
unsigned long q,qn; \
|
|
||||||
int m; \
|
|
||||||
if ((m = ((x) - ((MFB_PPW*MFB_PSZ)-MFB_PPW))) > 0) { \
|
|
||||||
q = (*(psrcstip)) << m; \
|
|
||||||
qn = (~ *(psrcstip)) << m; \
|
|
||||||
if ( (x)+(w) > (MFB_PPW*MFB_PSZ) ) { \
|
|
||||||
q |= *((psrcstip)+1) >> ((MFB_PPW*MFB_PSZ)-m); \
|
|
||||||
qn |= (~ *((psrcstip)+1)) >> ((MFB_PPW*MFB_PSZ)-m); \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
else { \
|
|
||||||
q = (*(psrcstip)) >> -m; \
|
|
||||||
qn = (~ *(psrcstip)) >> -m; \
|
|
||||||
} \
|
|
||||||
q >>=16; \
|
|
||||||
qn >>=16; \
|
|
||||||
INTER_ANDMSK2(psrcpix0,qn,psrcpix1,q,pdstpix); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define INTER_maskbits(x, w, startmask, endmask, nlg) \
|
|
||||||
startmask = iplstarttab[(x) & INTER_PIM]; \
|
|
||||||
endmask = iplendtab[((x)+(w)) & INTER_PIM]; \
|
|
||||||
if (startmask) \
|
|
||||||
nlg = (((w) - (INTER_PPG - ((x) & INTER_PIM))) >> INTER_PGSH); \
|
|
||||||
else \
|
|
||||||
nlg = (w) >> INTER_PGSH;
|
|
||||||
|
|
||||||
#define INTER_maskpartialbits(x, w, mask) \
|
|
||||||
mask = iplstartpartial[(x) & INTER_PIM] & \
|
|
||||||
iplendpartial[((x) + (w)) & INTER_PIM];
|
|
||||||
|
|
||||||
#define INTER_mask32bits(x, w, startmask, endmask, nlw) \
|
|
||||||
startmask = iplstarttab[(x) & INTER_PIM]; \
|
|
||||||
endmask = iplendtab[((x)+(w)) & INTER_PIM];
|
|
||||||
|
|
||||||
#define INTER_getbits(psrc, x, w, pdst) \
|
|
||||||
if ( ((x) + (w)) <= INTER_PPG) \
|
|
||||||
{ \
|
|
||||||
INTER_SCRLEFT((x), psrc, pdst); \
|
|
||||||
} \
|
|
||||||
else \
|
|
||||||
{ \
|
|
||||||
int m; \
|
|
||||||
m = INTER_PPG-(x); \
|
|
||||||
INTER_MSKINSM(iplendtab[m], x, psrc, \
|
|
||||||
iplstarttab[m], m, INTER_NEXT(psrc), pdst); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define INTER_putbits(psrc, x, w, pdst, planemask) \
|
|
||||||
if ( ((x)+(w)) <= INTER_PPG) \
|
|
||||||
{ \
|
|
||||||
INTER_DECLAREG(tmpmask); \
|
|
||||||
INTER_maskpartialbits((x), (w), tmpmask); \
|
|
||||||
INTER_SCRRMSKINS(tmpmask, planemask, psrc, x, pdst, pdst); \
|
|
||||||
} \
|
|
||||||
else \
|
|
||||||
{ \
|
|
||||||
unsigned long m; \
|
|
||||||
unsigned long n; \
|
|
||||||
m = INTER_PPG-(x); \
|
|
||||||
n = (w) - m; \
|
|
||||||
INTER_SCRRMSKINS(iplstarttab[x], planemask, psrc, x, \
|
|
||||||
pdst, pdst); \
|
|
||||||
INTER_SCRLMSKINS(iplendtab[n], planemask, psrc, m, \
|
|
||||||
INTER_NEXT(pdst), INTER_NEXT(pdst)); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define INTER_putbitsrop(psrc, x, w, pdst, planemask, rop) \
|
|
||||||
if ( ((x)+(w)) <= INTER_PPG) \
|
|
||||||
{ \
|
|
||||||
INTER_DECLAREG(tmpmask); \
|
|
||||||
INTER_DECLAREGP(t1); INTER_DECLAREGP(t2); \
|
|
||||||
INTER_maskpartialbits((x), (w), tmpmask); \
|
|
||||||
INTER_SCRRIGHT((x), (psrc), (t1)); \
|
|
||||||
INTER_DoRop(t2, rop, t1, pdst); \
|
|
||||||
INTER_PMSKINS(tmpmask, planemask, t2, pdst, pdst); \
|
|
||||||
} \
|
|
||||||
else \
|
|
||||||
{ \
|
|
||||||
unsigned long m; \
|
|
||||||
unsigned long n; \
|
|
||||||
INTER_DECLAREGP(t1); INTER_DECLAREGP(t2); \
|
|
||||||
m = INTER_PPG-(x); \
|
|
||||||
n = (w) - m; \
|
|
||||||
INTER_SCRRIGHT((x), (psrc), (t1)); \
|
|
||||||
INTER_DoRop(t2, rop, t1, pdst); \
|
|
||||||
INTER_PMSKINS(iplstarttab[x], planemask, t2, pdst, pdst); \
|
|
||||||
INTER_SCRLEFT(m, (psrc), (t1)); \
|
|
||||||
INTER_DoRop(t2, rop, t1, pdst+1); \
|
|
||||||
INTER_PMSKINS(iplendtab[n], planemask, t2, pdst, pdst); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define INTER_putbitsmropshort(src, x, w, pdst) { \
|
|
||||||
INTER_DECLAREG(_tmpmask); \
|
|
||||||
INTER_DECLAREGP(_t1); \
|
|
||||||
INTER_maskpartialbits((x), (w), _tmpmask); \
|
|
||||||
INTER_SCRRIGHT((x), (src), _t1); \
|
|
||||||
INTER_DoMaskMergeRop(_t1, pdst, _tmpmask, pdst); \
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,316 +0,0 @@
|
|||||||
/* $XFree86$ */
|
|
||||||
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
|
|
||||||
interleaved planes */
|
|
||||||
|
|
||||||
/* abcd abcd abcd abcd abcd abcd abcd abcd */
|
|
||||||
/* aaaa aaaa bbbb bbbb cccc cccc dddd dddd */
|
|
||||||
|
|
||||||
unsigned long tabi[256] = {
|
|
||||||
0x00000000,0x00001000,0x10000000,0x10001000,
|
|
||||||
0x00002000,0x00003000,0x10002000,0x10003000,
|
|
||||||
0x20000000,0x20001000,0x30000000,0x30001000,
|
|
||||||
0x20002000,0x20003000,0x30002000,0x30003000,
|
|
||||||
0x00004000,0x00005000,0x10004000,0x10005000,
|
|
||||||
0x00006000,0x00007000,0x10006000,0x10007000,
|
|
||||||
0x20004000,0x20005000,0x30004000,0x30005000,
|
|
||||||
0x20006000,0x20007000,0x30006000,0x30007000,
|
|
||||||
0x40000000,0x40001000,0x50000000,0x50001000,
|
|
||||||
0x40002000,0x40003000,0x50002000,0x50003000,
|
|
||||||
0x60000000,0x60001000,0x70000000,0x70001000,
|
|
||||||
0x60002000,0x60003000,0x70002000,0x70003000,
|
|
||||||
0x40004000,0x40005000,0x50004000,0x50005000,
|
|
||||||
0x40006000,0x40007000,0x50006000,0x50007000,
|
|
||||||
0x60004000,0x60005000,0x70004000,0x70005000,
|
|
||||||
0x60006000,0x60007000,0x70006000,0x70007000,
|
|
||||||
0x00008000,0x00009000,0x10008000,0x10009000,
|
|
||||||
0x0000a000,0x0000b000,0x1000a000,0x1000b000,
|
|
||||||
0x20008000,0x20009000,0x30008000,0x30009000,
|
|
||||||
0x2000a000,0x2000b000,0x3000a000,0x3000b000,
|
|
||||||
0x0000c000,0x0000d000,0x1000c000,0x1000d000,
|
|
||||||
0x0000e000,0x0000f000,0x1000e000,0x1000f000,
|
|
||||||
0x2000c000,0x2000d000,0x3000c000,0x3000d000,
|
|
||||||
0x2000e000,0x2000f000,0x3000e000,0x3000f000,
|
|
||||||
0x40008000,0x40009000,0x50008000,0x50009000,
|
|
||||||
0x4000a000,0x4000b000,0x5000a000,0x5000b000,
|
|
||||||
0x60008000,0x60009000,0x70008000,0x70009000,
|
|
||||||
0x6000a000,0x6000b000,0x7000a000,0x7000b000,
|
|
||||||
0x4000c000,0x4000d000,0x5000c000,0x5000d000,
|
|
||||||
0x4000e000,0x4000f000,0x5000e000,0x5000f000,
|
|
||||||
0x6000c000,0x6000d000,0x7000c000,0x7000d000,
|
|
||||||
0x6000e000,0x6000f000,0x7000e000,0x7000f000,
|
|
||||||
0x80000000,0x80001000,0x90000000,0x90001000,
|
|
||||||
0x80002000,0x80003000,0x90002000,0x90003000,
|
|
||||||
0xa0000000,0xa0001000,0xb0000000,0xb0001000,
|
|
||||||
0xa0002000,0xa0003000,0xb0002000,0xb0003000,
|
|
||||||
0x80004000,0x80005000,0x90004000,0x90005000,
|
|
||||||
0x80006000,0x80007000,0x90006000,0x90007000,
|
|
||||||
0xa0004000,0xa0005000,0xb0004000,0xb0005000,
|
|
||||||
0xa0006000,0xa0007000,0xb0006000,0xb0007000,
|
|
||||||
0xc0000000,0xc0001000,0xd0000000,0xd0001000,
|
|
||||||
0xc0002000,0xc0003000,0xd0002000,0xd0003000,
|
|
||||||
0xe0000000,0xe0001000,0xf0000000,0xf0001000,
|
|
||||||
0xe0002000,0xe0003000,0xf0002000,0xf0003000,
|
|
||||||
0xc0004000,0xc0005000,0xd0004000,0xd0005000,
|
|
||||||
0xc0006000,0xc0007000,0xd0006000,0xd0007000,
|
|
||||||
0xe0004000,0xe0005000,0xf0004000,0xf0005000,
|
|
||||||
0xe0006000,0xe0007000,0xf0006000,0xf0007000,
|
|
||||||
0x80008000,0x80009000,0x90008000,0x90009000,
|
|
||||||
0x8000a000,0x8000b000,0x9000a000,0x9000b000,
|
|
||||||
0xa0008000,0xa0009000,0xb0008000,0xb0009000,
|
|
||||||
0xa000a000,0xa000b000,0xb000a000,0xb000b000,
|
|
||||||
0x8000c000,0x8000d000,0x9000c000,0x9000d000,
|
|
||||||
0x8000e000,0x8000f000,0x9000e000,0x9000f000,
|
|
||||||
0xa000c000,0xa000d000,0xb000c000,0xb000d000,
|
|
||||||
0xa000e000,0xa000f000,0xb000e000,0xb000f000,
|
|
||||||
0xc0008000,0xc0009000,0xd0008000,0xd0009000,
|
|
||||||
0xc000a000,0xc000b000,0xd000a000,0xd000b000,
|
|
||||||
0xe0008000,0xe0009000,0xf0008000,0xf0009000,
|
|
||||||
0xe000a000,0xe000b000,0xf000a000,0xf000b000,
|
|
||||||
0xc000c000,0xc000d000,0xd000c000,0xd000d000,
|
|
||||||
0xc000e000,0xc000f000,0xd000e000,0xd000f000,
|
|
||||||
0xe000c000,0xe000d000,0xf000c000,0xf000d000,
|
|
||||||
0xe000e000,0xe000f000,0xf000e000,0xf000f000,
|
|
||||||
};
|
|
||||||
static unsigned long tabp[256] = {
|
|
||||||
0x00000000,0x00020000,0x00080000,0x000a0000,
|
|
||||||
0x00200000,0x00220000,0x00280000,0x002a0000,
|
|
||||||
0x00800000,0x00820000,0x00880000,0x008a0000,
|
|
||||||
0x00a00000,0x00a20000,0x00a80000,0x00aa0000,
|
|
||||||
0x02000000,0x02020000,0x02080000,0x020a0000,
|
|
||||||
0x02200000,0x02220000,0x02280000,0x022a0000,
|
|
||||||
0x02800000,0x02820000,0x02880000,0x028a0000,
|
|
||||||
0x02a00000,0x02a20000,0x02a80000,0x02aa0000,
|
|
||||||
0x08000000,0x08020000,0x08080000,0x080a0000,
|
|
||||||
0x08200000,0x08220000,0x08280000,0x082a0000,
|
|
||||||
0x08800000,0x08820000,0x08880000,0x088a0000,
|
|
||||||
0x08a00000,0x08a20000,0x08a80000,0x08aa0000,
|
|
||||||
0x0a000000,0x0a020000,0x0a080000,0x0a0a0000,
|
|
||||||
0x0a200000,0x0a220000,0x0a280000,0x0a2a0000,
|
|
||||||
0x0a800000,0x0a820000,0x0a880000,0x0a8a0000,
|
|
||||||
0x0aa00000,0x0aa20000,0x0aa80000,0x0aaa0000,
|
|
||||||
0x20000000,0x20020000,0x20080000,0x200a0000,
|
|
||||||
0x20200000,0x20220000,0x20280000,0x202a0000,
|
|
||||||
0x20800000,0x20820000,0x20880000,0x208a0000,
|
|
||||||
0x20a00000,0x20a20000,0x20a80000,0x20aa0000,
|
|
||||||
0x22000000,0x22020000,0x22080000,0x220a0000,
|
|
||||||
0x22200000,0x22220000,0x22280000,0x222a0000,
|
|
||||||
0x22800000,0x22820000,0x22880000,0x228a0000,
|
|
||||||
0x22a00000,0x22a20000,0x22a80000,0x22aa0000,
|
|
||||||
0x28000000,0x28020000,0x28080000,0x280a0000,
|
|
||||||
0x28200000,0x28220000,0x28280000,0x282a0000,
|
|
||||||
0x28800000,0x28820000,0x28880000,0x288a0000,
|
|
||||||
0x28a00000,0x28a20000,0x28a80000,0x28aa0000,
|
|
||||||
0x2a000000,0x2a020000,0x2a080000,0x2a0a0000,
|
|
||||||
0x2a200000,0x2a220000,0x2a280000,0x2a2a0000,
|
|
||||||
0x2a800000,0x2a820000,0x2a880000,0x2a8a0000,
|
|
||||||
0x2aa00000,0x2aa20000,0x2aa80000,0x2aaa0000,
|
|
||||||
0x80000000,0x80020000,0x80080000,0x800a0000,
|
|
||||||
0x80200000,0x80220000,0x80280000,0x802a0000,
|
|
||||||
0x80800000,0x80820000,0x80880000,0x808a0000,
|
|
||||||
0x80a00000,0x80a20000,0x80a80000,0x80aa0000,
|
|
||||||
0x82000000,0x82020000,0x82080000,0x820a0000,
|
|
||||||
0x82200000,0x82220000,0x82280000,0x822a0000,
|
|
||||||
0x82800000,0x82820000,0x82880000,0x828a0000,
|
|
||||||
0x82a00000,0x82a20000,0x82a80000,0x82aa0000,
|
|
||||||
0x88000000,0x88020000,0x88080000,0x880a0000,
|
|
||||||
0x88200000,0x88220000,0x88280000,0x882a0000,
|
|
||||||
0x88800000,0x88820000,0x88880000,0x888a0000,
|
|
||||||
0x88a00000,0x88a20000,0x88a80000,0x88aa0000,
|
|
||||||
0x8a000000,0x8a020000,0x8a080000,0x8a0a0000,
|
|
||||||
0x8a200000,0x8a220000,0x8a280000,0x8a2a0000,
|
|
||||||
0x8a800000,0x8a820000,0x8a880000,0x8a8a0000,
|
|
||||||
0x8aa00000,0x8aa20000,0x8aa80000,0x8aaa0000,
|
|
||||||
0xa0000000,0xa0020000,0xa0080000,0xa00a0000,
|
|
||||||
0xa0200000,0xa0220000,0xa0280000,0xa02a0000,
|
|
||||||
0xa0800000,0xa0820000,0xa0880000,0xa08a0000,
|
|
||||||
0xa0a00000,0xa0a20000,0xa0a80000,0xa0aa0000,
|
|
||||||
0xa2000000,0xa2020000,0xa2080000,0xa20a0000,
|
|
||||||
0xa2200000,0xa2220000,0xa2280000,0xa22a0000,
|
|
||||||
0xa2800000,0xa2820000,0xa2880000,0xa28a0000,
|
|
||||||
0xa2a00000,0xa2a20000,0xa2a80000,0xa2aa0000,
|
|
||||||
0xa8000000,0xa8020000,0xa8080000,0xa80a0000,
|
|
||||||
0xa8200000,0xa8220000,0xa8280000,0xa82a0000,
|
|
||||||
0xa8800000,0xa8820000,0xa8880000,0xa88a0000,
|
|
||||||
0xa8a00000,0xa8a20000,0xa8a80000,0xa8aa0000,
|
|
||||||
0xaa000000,0xaa020000,0xaa080000,0xaa0a0000,
|
|
||||||
0xaa200000,0xaa220000,0xaa280000,0xaa2a0000,
|
|
||||||
0xaa800000,0xaa820000,0xaa880000,0xaa8a0000,
|
|
||||||
0xaaa00000,0xaaa20000,0xaaa80000,0xaaaa0000,
|
|
||||||
};
|
|
||||||
|
|
||||||
void
|
|
||||||
iplUnpackLine(int planes, int longs, unsigned int *psrc, unsigned short *ipsrc)
|
|
||||||
{
|
|
||||||
unsigned long temp,m;
|
|
||||||
unsigned char *t=(unsigned char *) &temp;
|
|
||||||
unsigned char *i=(unsigned char *) ipsrc;
|
|
||||||
unsigned char *s=(unsigned char *) psrc;
|
|
||||||
int j,off;
|
|
||||||
switch (planes) {
|
|
||||||
case 2:
|
|
||||||
for (j = 0 ; j < longs ; j++)
|
|
||||||
{
|
|
||||||
*((long *) ipsrc)++=(tabi[s[0]] >> 0) |
|
|
||||||
(tabi[s[1]] >> 4) |
|
|
||||||
(tabi[s[2]] >> 8) |
|
|
||||||
(tabi[s[3]] >> 12);
|
|
||||||
s+=4;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
for (j = 0 ; j < longs ; j++)
|
|
||||||
{
|
|
||||||
temp= (tabi[s[0]] >> 0) |
|
|
||||||
(tabi[s[1]] >> 4) |
|
|
||||||
(tabi[s[2]] >> 8) |
|
|
||||||
(tabi[s[3]] >> 12);
|
|
||||||
temp= (tabi[t[0]] >> 0) |
|
|
||||||
(tabi[t[1]] >> 4) |
|
|
||||||
(tabi[t[2]] >> 8) |
|
|
||||||
(tabi[t[3]] >> 12);
|
|
||||||
s+=4;
|
|
||||||
if (j & 1) {
|
|
||||||
i[7]=t[0];
|
|
||||||
i[5]=t[1];
|
|
||||||
i[3]=t[2];
|
|
||||||
i[1]=t[3];
|
|
||||||
i += 8;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
i[6]=t[0];
|
|
||||||
i[4]=t[1];
|
|
||||||
i[2]=t[2];
|
|
||||||
i[0]=t[3];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
for (j = 0 ; j < longs ; j++)
|
|
||||||
{
|
|
||||||
temp= (tabi[s[0]] >> 0) |
|
|
||||||
(tabi[s[1]] >> 4) |
|
|
||||||
(tabi[s[2]] >> 8) |
|
|
||||||
(tabi[s[3]] >> 12);
|
|
||||||
|
|
||||||
temp= (tabi[t[0]] >> 0) |
|
|
||||||
(tabi[t[1]] >> 4) |
|
|
||||||
(tabi[t[2]] >> 8) |
|
|
||||||
(tabi[t[3]] >> 12);
|
|
||||||
|
|
||||||
temp= (tabi[t[0]] >> 0) |
|
|
||||||
(tabi[t[1]] >> 4) |
|
|
||||||
(tabi[t[2]] >> 8) |
|
|
||||||
(tabi[t[3]] >> 12);
|
|
||||||
|
|
||||||
off=12-(j & 3)*4;
|
|
||||||
m=0xf << off;
|
|
||||||
ipsrc[7]=(ipsrc[7] & ~m) | (((temp >> 28) << off) & m);
|
|
||||||
ipsrc[6]=(ipsrc[6] & ~m) | (((temp >> 24) << off) & m);
|
|
||||||
ipsrc[5]=(ipsrc[5] & ~m) | (((temp >> 20) << off) & m);
|
|
||||||
ipsrc[4]=(ipsrc[4] & ~m) | (((temp >> 16) << off) & m);
|
|
||||||
ipsrc[3]=(ipsrc[3] & ~m) | (((temp >> 12) << off) & m);
|
|
||||||
ipsrc[2]=(ipsrc[2] & ~m) | (((temp >> 8) << off) & m);
|
|
||||||
ipsrc[1]=(ipsrc[1] & ~m) | (((temp >> 4) << off) & m);
|
|
||||||
ipsrc[0]=(ipsrc[0] & ~m) | (((temp >> 0) << off) & m);
|
|
||||||
if (! off)
|
|
||||||
ipsrc +=8;
|
|
||||||
s+=4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
iplPackLine(int planes, int longs, unsigned short *ipdst, unsigned int *pdst)
|
|
||||||
{
|
|
||||||
unsigned long temp,m;
|
|
||||||
unsigned char *t=(unsigned char *) &temp;
|
|
||||||
unsigned char *i=(unsigned char *) ipdst;
|
|
||||||
int j,off;
|
|
||||||
switch (planes) {
|
|
||||||
case 2:
|
|
||||||
for (j = 0 ; j < longs ; j++)
|
|
||||||
{
|
|
||||||
*pdst++=(tabp[i[2]] >> 0) |
|
|
||||||
(tabp[i[0]] >> 1) |
|
|
||||||
(tabp[i[3]] >> 16) |
|
|
||||||
(tabp[i[1]] >> 17);
|
|
||||||
i+=4;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
for (j = 0 ; j < longs ; j++)
|
|
||||||
{
|
|
||||||
if (j & 1) {
|
|
||||||
temp= (tabp[i[7]] >> 0) |
|
|
||||||
(tabp[i[3]] >> 1) |
|
|
||||||
(tabp[i[5]] >> 16) |
|
|
||||||
(tabp[i[1]] >> 17);
|
|
||||||
i += 8;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
temp= (tabp[i[6]] >> 0) |
|
|
||||||
(tabp[i[2]] >> 1) |
|
|
||||||
(tabp[i[4]] >> 16) |
|
|
||||||
(tabp[i[0]] >> 17);
|
|
||||||
}
|
|
||||||
*pdst++=(tabp[t[0]] >> 0) |
|
|
||||||
(tabp[t[2]] >> 1) |
|
|
||||||
(tabp[t[1]] >> 16) |
|
|
||||||
(tabp[t[3]] >> 17);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
for (j = 0 ; j < longs ; j++)
|
|
||||||
{
|
|
||||||
off=12-(j & 3)*4;
|
|
||||||
m=0xf;
|
|
||||||
temp=(((ipdst[7] >> off) & m) << 28) |
|
|
||||||
(((ipdst[6] >> off) & m) << 24) |
|
|
||||||
(((ipdst[5] >> off) & m) << 20) |
|
|
||||||
(((ipdst[4] >> off) & m) << 16) |
|
|
||||||
(((ipdst[3] >> off) & m) << 12) |
|
|
||||||
(((ipdst[2] >> off) & m) << 8) |
|
|
||||||
(((ipdst[1] >> off) & m) << 4) |
|
|
||||||
(((ipdst[0] >> off) & m) << 0);
|
|
||||||
|
|
||||||
if (! off)
|
|
||||||
ipdst +=8;
|
|
||||||
|
|
||||||
temp= (tabp[t[0]] >> 0) |
|
|
||||||
(tabp[t[2]] >> 1) |
|
|
||||||
(tabp[t[1]] >> 16) |
|
|
||||||
(tabp[t[3]] >> 17);
|
|
||||||
|
|
||||||
temp= (tabp[t[0]] >> 0) |
|
|
||||||
(tabp[t[2]] >> 1) |
|
|
||||||
(tabp[t[1]] >> 16) |
|
|
||||||
(tabp[t[3]] >> 17);
|
|
||||||
|
|
||||||
*pdst++=(tabp[t[0]] >> 0) |
|
|
||||||
(tabp[t[2]] >> 1) |
|
|
||||||
(tabp[t[1]] >> 16) |
|
|
||||||
(tabp[t[3]] >> 17);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned long
|
|
||||||
iplpack(unsigned long ipl)
|
|
||||||
{
|
|
||||||
unsigned char *ic=(unsigned char *) &ipl;
|
|
||||||
return (tabp[ic[0]]) | /* a0a0a0a0a0a0a0a00000000000000000 */
|
|
||||||
(tabp[ic[2]] >> 1) | /* abababababababab0000000000000000 */
|
|
||||||
(tabp[ic[1]] >> 16) | /* ababababababababa0a0a0a0a0a0a0a0 */
|
|
||||||
(tabp[ic[3]] >> 17); /* abababababababababababababababab */
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned long
|
|
||||||
iplunpack(unsigned long pack)
|
|
||||||
{
|
|
||||||
unsigned char *ip=(unsigned char *) &pack;
|
|
||||||
return (tabi[ip[0]]) | /* aaaa000000000000bbbb000000000000 */
|
|
||||||
(tabi[ip[1]] >> 4) | /* aaaaaaaa00000000bbbbbbbb00000000 */
|
|
||||||
(tabi[ip[2]] >> 8) | /* aaaaaaaaaaaa0000bbbbbbbbbbbb0000 */
|
|
||||||
(tabi[ip[3]] >> 12); /* aaaaaaaaaaaaaaaabbbbbbbbbbbbbbbb */
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
/* $XFree86$ */
|
|
||||||
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
|
|
||||||
interleaved planes */
|
|
||||||
|
|
||||||
#define NUM_LONGS(planes, xs, xe) \
|
|
||||||
(((((xe) * (planes) + 31) & ~31) - \
|
|
||||||
(((xs) * (planes)) & ~31))/32)
|
|
||||||
|
|
||||||
#define NUM_TEMP_BYTES(planes, longs) \
|
|
||||||
(((2 * (longs) + (planes) - 1) / planes + 1) * planes * 2)
|
|
||||||
@@ -1,386 +0,0 @@
|
|||||||
/* $XFree86: xc/programs/Xserver/iplan2p4/iplpixmap.c,v 3.0 1996/08/18 01:54:59 dawes Exp $ */
|
|
||||||
/* $XConsortium: iplpixmap.c,v 5.14 94/04/17 20:28:56 dpw Exp $ */
|
|
||||||
/***********************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
|
|
||||||
interleaved planes */
|
|
||||||
|
|
||||||
#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 "ipl.h"
|
|
||||||
#include "iplmskbits.h"
|
|
||||||
|
|
||||||
extern unsigned long endtab[];
|
|
||||||
|
|
||||||
PixmapPtr
|
|
||||||
iplCreatePixmap (pScreen, width, height, depth)
|
|
||||||
ScreenPtr pScreen;
|
|
||||||
int width;
|
|
||||||
int height;
|
|
||||||
int depth;
|
|
||||||
{
|
|
||||||
PixmapPtr pPixmap;
|
|
||||||
size_t datasize;
|
|
||||||
size_t paddedWidth;
|
|
||||||
int ipad=INTER_PLANES*2 - 1;
|
|
||||||
|
|
||||||
paddedWidth = PixmapBytePad(width, depth);
|
|
||||||
paddedWidth = (paddedWidth + ipad) & ~ipad;
|
|
||||||
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;
|
|
||||||
#ifdef PIXPRIV
|
|
||||||
pPixmap->devPrivate.ptr = datasize ?
|
|
||||||
(pointer)((char *)pPixmap + pScreen->totalPixmapSize) : NULL;
|
|
||||||
#else
|
|
||||||
pPixmap->devPrivate.ptr = (pointer)((long)(pPixmap + 1));
|
|
||||||
#endif
|
|
||||||
return pPixmap;
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool
|
|
||||||
iplDestroyPixmap(pPixmap)
|
|
||||||
PixmapPtr pPixmap;
|
|
||||||
{
|
|
||||||
if(--pPixmap->refcnt)
|
|
||||||
return TRUE;
|
|
||||||
xfree(pPixmap);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
PixmapPtr
|
|
||||||
iplCopyPixmap(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);
|
|
||||||
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
|
|
||||||
iplXRotatePixmap code gets used if we rotate the pixmap later.
|
|
||||||
iplYRotatePixmap 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
|
|
||||||
iplPadPixmap(pPixmap)
|
|
||||||
PixmapPtr pPixmap;
|
|
||||||
{
|
|
||||||
register int width = pPixmap->drawable.width;
|
|
||||||
register int h;
|
|
||||||
register unsigned short mask;
|
|
||||||
register unsigned short *p;
|
|
||||||
register unsigned short bits; /* real pattern bits */
|
|
||||||
register int i;
|
|
||||||
int rep; /* repeat count for pattern */
|
|
||||||
|
|
||||||
if (width >= INTER_PGSZ)
|
|
||||||
return;
|
|
||||||
|
|
||||||
rep = INTER_PGSZ/width;
|
|
||||||
/* if (rep*width != INTER_PGSZ)
|
|
||||||
return; */
|
|
||||||
|
|
||||||
mask = iplendtab[width];
|
|
||||||
|
|
||||||
p = (unsigned short *)(pPixmap->devPrivate.ptr);
|
|
||||||
for (h=0; h < pPixmap->drawable.height * INTER_PLANES; 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 = rep*width; /* PGSZ/(pPixmap->drawable.bitsPerPixel); */
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef notdef
|
|
||||||
/*
|
|
||||||
* ipl debugging routine -- assumes pixmap is 1 byte deep
|
|
||||||
*/
|
|
||||||
static ipldumppixmap(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
|
|
||||||
iplXRotatePixmap(pPix, rw)
|
|
||||||
PixmapPtr pPix;
|
|
||||||
register int rw;
|
|
||||||
{
|
|
||||||
INTER_DECLAREG(*pw);
|
|
||||||
INTER_DECLAREG(*pwFinal);
|
|
||||||
INTER_DECLAREGP(t);
|
|
||||||
int rot;
|
|
||||||
|
|
||||||
if (pPix == NullPixmap)
|
|
||||||
return;
|
|
||||||
|
|
||||||
switch (((DrawablePtr) pPix)->bitsPerPixel) {
|
|
||||||
case INTER_PLANES:
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
mfbXRotatePixmap(pPix, rw);
|
|
||||||
return;
|
|
||||||
default:
|
|
||||||
ErrorF("iplXRotatePixmap: unsupported bitsPerPixel %d\n", ((DrawablePtr) pPix)->bitsPerPixel);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
pw = (unsigned short *)pPix->devPrivate.ptr;
|
|
||||||
modulus (rw, (int) pPix->drawable.width, rot);
|
|
||||||
if(pPix->drawable.width == 16)
|
|
||||||
{
|
|
||||||
pwFinal = pw + pPix->drawable.height * INTER_PLANES;
|
|
||||||
while(pw < pwFinal)
|
|
||||||
{
|
|
||||||
INTER_COPY(pw, t);
|
|
||||||
INTER_MSKINSM(iplendtab[rot], INTER_PPG-rot, t,
|
|
||||||
~0, rot, t, pw)
|
|
||||||
INTER_NEXT_GROUP(pw);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ErrorF("ipl internal error: trying to rotate odd-sized pixmap.\n");
|
|
||||||
#ifdef notdef
|
|
||||||
register unsigned long *pwTmp;
|
|
||||||
int size, tsize;
|
|
||||||
|
|
||||||
tsize = PixmapBytePad(pPix->drawable.width - rot, pPix->drawable.depth);
|
|
||||||
pwTmp = (unsigned long *) ALLOCATE_LOCAL(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);
|
|
||||||
iplQuickBlt((long *)pw, (long *)pwTmp,
|
|
||||||
0, 0, 0, 0,
|
|
||||||
(int)pPix->drawable.width - rot, (int)pPix->drawable.height,
|
|
||||||
size, tsize);
|
|
||||||
iplQuickBlt((long *)pw, (long *)pw,
|
|
||||||
(int)pPix->drawable.width - rot, 0, 0, 0,
|
|
||||||
rot, (int)pPix->drawable.height,
|
|
||||||
size, size);
|
|
||||||
iplQuickBlt((long *)pwTmp, (long *)pw,
|
|
||||||
0, 0, rot, 0,
|
|
||||||
(int)pPix->drawable.width - rot, (int)pPix->drawable.height,
|
|
||||||
tsize, size);
|
|
||||||
DEALLOCATE_LOCAL(pwTmp);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Rotates pixmap pPix by h lines. Assumes that h is always less than
|
|
||||||
pPix->drawable.height
|
|
||||||
works on any width.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
iplYRotatePixmap(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 INTER_PLANES:
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
mfbYRotatePixmap(pPix, rh);
|
|
||||||
return;
|
|
||||||
default:
|
|
||||||
ErrorF("iplYRotatePixmap: 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 *)ALLOCATE_LOCAL(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 */
|
|
||||||
DEALLOCATE_LOCAL(ptmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
iplCopyRotatePixmap(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 = iplCopyPixmap(psrcPix);
|
|
||||||
if (!pdstPix)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
iplPadPixmap(pdstPix);
|
|
||||||
if (xrot)
|
|
||||||
iplXRotatePixmap(pdstPix, xrot);
|
|
||||||
if (yrot)
|
|
||||||
iplYRotatePixmap(pdstPix, yrot);
|
|
||||||
}
|
|
||||||
@@ -1,310 +0,0 @@
|
|||||||
/* $XFree86: xc/programs/Xserver/iplan2p4/iplply1rct.c,v 3.0 1996/08/18 01:55:00 dawes Exp $ */
|
|
||||||
/*
|
|
||||||
* $XConsortium: iplply1rct.c,v 1.14 94/04/17 20:28:56 dpw Exp $
|
|
||||||
*
|
|
||||||
Copyright (c) 1990 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
*
|
|
||||||
* Author: Keith Packard, MIT X Consortium
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
|
|
||||||
interleaved planes */
|
|
||||||
|
|
||||||
#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 "mistruct.h"
|
|
||||||
|
|
||||||
#include "ipl.h"
|
|
||||||
#include "iplrrop.h"
|
|
||||||
|
|
||||||
#include "iplmskbits.h"
|
|
||||||
|
|
||||||
void
|
|
||||||
INTER_RROP_NAME(iplFillPoly1Rect) (pDrawable, pGC, shape, mode, count, ptsIn)
|
|
||||||
DrawablePtr pDrawable;
|
|
||||||
GCPtr pGC;
|
|
||||||
int count;
|
|
||||||
DDXPointPtr ptsIn;
|
|
||||||
{
|
|
||||||
iplPrivGCPtr devPriv;
|
|
||||||
int ngwidth;
|
|
||||||
unsigned short *addrl, *addr;
|
|
||||||
int maxy;
|
|
||||||
int origin;
|
|
||||||
register int vertex1, vertex2;
|
|
||||||
int c;
|
|
||||||
BoxPtr extents;
|
|
||||||
int clip;
|
|
||||||
int y;
|
|
||||||
int *vertex1p, *vertex2p;
|
|
||||||
int *endp;
|
|
||||||
int x1, x2;
|
|
||||||
int dx1, dx2;
|
|
||||||
int dy1, dy2;
|
|
||||||
int e1, e2;
|
|
||||||
int step1, step2;
|
|
||||||
int sign1, sign2;
|
|
||||||
int h;
|
|
||||||
int l, r;
|
|
||||||
INTER_DECLAREG(mask);
|
|
||||||
INTER_DECLAREG(bits);
|
|
||||||
int nmiddle;
|
|
||||||
INTER_RROP_DECLARE
|
|
||||||
bits=~0;
|
|
||||||
|
|
||||||
if (mode == CoordModePrevious)
|
|
||||||
{
|
|
||||||
miFillPolygon (pDrawable, pGC, shape, mode, count, ptsIn);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
devPriv = iplGetGCPrivate(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);
|
|
||||||
origin -= (origin & 0x8000) << 1;
|
|
||||||
extents = &pGC->pCompositeClip->extents;
|
|
||||||
INTER_RROP_FETCH_GCPRIV(devPriv);
|
|
||||||
vertex1 = *((int *) &extents->x1) - origin;
|
|
||||||
vertex2 = *((int *) &extents->x2) - origin - 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) ((a) + (y) * ngwidth)
|
|
||||||
|
|
||||||
iplGetGroupWidthAndPointer(pDrawable, ngwidth, addrl);
|
|
||||||
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;
|
|
||||||
r = x2;
|
|
||||||
nmiddle = x2 - x1;
|
|
||||||
if (nmiddle < 0)
|
|
||||||
{
|
|
||||||
nmiddle = -nmiddle;
|
|
||||||
l = x2;
|
|
||||||
r = x1;
|
|
||||||
}
|
|
||||||
c = l & INTER_PIM;
|
|
||||||
l -= c;
|
|
||||||
|
|
||||||
addr = addrl + (l >> INTER_PGSH) * INTER_PLANES;
|
|
||||||
if (c + nmiddle < INTER_PPG)
|
|
||||||
{
|
|
||||||
mask = (bits >> c) ^ (bits >> (c+nmiddle));
|
|
||||||
INTER_RROP_SOLID_MASK(addr,mask);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (c)
|
|
||||||
{
|
|
||||||
mask = bits >> c;
|
|
||||||
INTER_RROP_SOLID_MASK(addr,mask);
|
|
||||||
nmiddle += c - INTER_PPG;
|
|
||||||
INTER_NEXT_GROUP(addr);
|
|
||||||
}
|
|
||||||
nmiddle >>= INTER_PGSH;
|
|
||||||
while (--nmiddle >= 0) {
|
|
||||||
INTER_RROP_SOLID(addr); INTER_NEXT_GROUP(addr);
|
|
||||||
}
|
|
||||||
if (mask = ~(bits >> (r & INTER_PIM)))
|
|
||||||
INTER_RROP_SOLID_MASK(addr,mask);
|
|
||||||
}
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,341 +0,0 @@
|
|||||||
/* $XFree86$ */
|
|
||||||
/* $XConsortium: iplpntwin.c,v 5.18 94/04/17 20:28:57 dpw Exp $ */
|
|
||||||
/***********************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
******************************************************************/
|
|
||||||
|
|
||||||
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
|
|
||||||
interleaved planes */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
|
|
||||||
#include "windowstr.h"
|
|
||||||
#include "regionstr.h"
|
|
||||||
#include "pixmapstr.h"
|
|
||||||
#include "scrnintstr.h"
|
|
||||||
|
|
||||||
#include "ipl.h"
|
|
||||||
#include "mi.h"
|
|
||||||
|
|
||||||
void
|
|
||||||
iplPaintWindow(pWin, pRegion, what)
|
|
||||||
WindowPtr pWin;
|
|
||||||
RegionPtr pRegion;
|
|
||||||
int what;
|
|
||||||
{
|
|
||||||
register iplPrivWin *pPrivWin;
|
|
||||||
WindowPtr pBgWin;
|
|
||||||
|
|
||||||
pPrivWin = iplGetWindowPrivate(pWin);
|
|
||||||
|
|
||||||
switch (what) {
|
|
||||||
case PW_BACKGROUND:
|
|
||||||
switch (pWin->backgroundState) {
|
|
||||||
case None:
|
|
||||||
break;
|
|
||||||
case ParentRelative:
|
|
||||||
do {
|
|
||||||
pWin = pWin->parent;
|
|
||||||
} while (pWin->backgroundState == ParentRelative);
|
|
||||||
(*pWin->drawable.pScreen->PaintWindowBackground)(pWin, pRegion,
|
|
||||||
what);
|
|
||||||
break;
|
|
||||||
case BackgroundPixmap:
|
|
||||||
if (pPrivWin->fastBackground)
|
|
||||||
{
|
|
||||||
iplFillBoxTile32 ((DrawablePtr)pWin,
|
|
||||||
(int)REGION_NUM_RECTS(pRegion),
|
|
||||||
REGION_RECTS(pRegion),
|
|
||||||
pPrivWin->pRotatedBackground);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
iplFillBoxTileOdd ((DrawablePtr)pWin,
|
|
||||||
(int)REGION_NUM_RECTS(pRegion),
|
|
||||||
REGION_RECTS(pRegion),
|
|
||||||
pWin->background.pixmap,
|
|
||||||
(int) pWin->drawable.x, (int) pWin->drawable.y);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case BackgroundPixel:
|
|
||||||
iplFillBoxSolid ((DrawablePtr)pWin,
|
|
||||||
(int)REGION_NUM_RECTS(pRegion),
|
|
||||||
REGION_RECTS(pRegion),
|
|
||||||
pWin->background.pixel);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case PW_BORDER:
|
|
||||||
if (pWin->borderIsPixel)
|
|
||||||
{
|
|
||||||
iplFillBoxSolid ((DrawablePtr)pWin,
|
|
||||||
(int)REGION_NUM_RECTS(pRegion),
|
|
||||||
REGION_RECTS(pRegion),
|
|
||||||
pWin->border.pixel);
|
|
||||||
}
|
|
||||||
else if (pPrivWin->fastBorder)
|
|
||||||
{
|
|
||||||
iplFillBoxTile32 ((DrawablePtr)pWin,
|
|
||||||
(int)REGION_NUM_RECTS(pRegion),
|
|
||||||
REGION_RECTS(pRegion),
|
|
||||||
pPrivWin->pRotatedBorder);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (pBgWin = pWin;
|
|
||||||
pBgWin->backgroundState == ParentRelative;
|
|
||||||
pBgWin = pBgWin->parent);
|
|
||||||
|
|
||||||
iplFillBoxTileOdd ((DrawablePtr)pWin,
|
|
||||||
(int)REGION_NUM_RECTS(pRegion),
|
|
||||||
REGION_RECTS(pRegion),
|
|
||||||
pWin->border.pixmap,
|
|
||||||
(int) pBgWin->drawable.x,
|
|
||||||
(int) pBgWin->drawable.y);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Use the RROP macros in copy mode
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define RROP GXcopy
|
|
||||||
#include "iplrrop.h"
|
|
||||||
#include "iplmskbits.h"
|
|
||||||
|
|
||||||
|
|
||||||
# define Expand(left, right, leftAdjust) { \
|
|
||||||
int widthStep; \
|
|
||||||
widthStep = widthDst - (nmiddle + leftAdjust) * INTER_PLANES; \
|
|
||||||
while (h--) { \
|
|
||||||
left \
|
|
||||||
m = nmiddle; \
|
|
||||||
INTER_RROP_SPAN(pdst, m); \
|
|
||||||
right \
|
|
||||||
pdst += widthStep; \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
iplFillBoxSolid (pDrawable, nBox, pBox, pixel)
|
|
||||||
DrawablePtr pDrawable;
|
|
||||||
int nBox;
|
|
||||||
BoxPtr pBox;
|
|
||||||
unsigned long pixel;
|
|
||||||
{
|
|
||||||
INTER_DECLAREG(*pdstBase);
|
|
||||||
int widthDst;
|
|
||||||
register int h;
|
|
||||||
INTER_DECLAREGP(rrop_xor);
|
|
||||||
INTER_DECLAREG(*pdst);
|
|
||||||
INTER_DECLAREG(leftMask);
|
|
||||||
INTER_DECLAREG(rightMask);
|
|
||||||
int nmiddle;
|
|
||||||
register int m;
|
|
||||||
int w;
|
|
||||||
|
|
||||||
iplGetGroupWidthAndPointer(pDrawable, widthDst, pdstBase);
|
|
||||||
|
|
||||||
INTER_PFILL(pixel, rrop_xor);
|
|
||||||
for (; nBox; nBox--, pBox++)
|
|
||||||
{
|
|
||||||
pdst = pdstBase + pBox->y1 * widthDst;
|
|
||||||
h = pBox->y2 - pBox->y1;
|
|
||||||
w = pBox->x2 - pBox->x1;
|
|
||||||
pdst += (pBox->x1 >> INTER_PGSH) * INTER_PLANES;
|
|
||||||
if ((pBox->x1 & INTER_PIM) + w <= INTER_PPG)
|
|
||||||
{
|
|
||||||
INTER_maskpartialbits(pBox->x1, w, leftMask);
|
|
||||||
while (h--) {
|
|
||||||
INTER_COPYM(rrop_xor, pdst, leftMask, pdst);
|
|
||||||
pdst += widthDst;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
INTER_maskbits (pBox->x1, w, leftMask, rightMask, nmiddle);
|
|
||||||
if (leftMask)
|
|
||||||
{
|
|
||||||
if (rightMask)
|
|
||||||
{
|
|
||||||
Expand (INTER_RROP_SOLID_MASK (pdst, leftMask);
|
|
||||||
INTER_NEXT_GROUP(pdst);,
|
|
||||||
INTER_RROP_SOLID_MASK (pdst, rightMask); ,
|
|
||||||
1)
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Expand (INTER_RROP_SOLID_MASK (pdst, leftMask);
|
|
||||||
INTER_NEXT_GROUP(pdst);,
|
|
||||||
;,
|
|
||||||
1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (rightMask)
|
|
||||||
{
|
|
||||||
Expand (;,
|
|
||||||
INTER_RROP_SOLID_MASK (pdst, rightMask);,
|
|
||||||
0)
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Expand (;,
|
|
||||||
;,
|
|
||||||
0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
iplFillBoxTile32 (pDrawable, nBox, pBox, tile)
|
|
||||||
DrawablePtr pDrawable;
|
|
||||||
int nBox; /* number of boxes to fill */
|
|
||||||
BoxPtr pBox; /* pointer to list of boxes to fill */
|
|
||||||
PixmapPtr tile; /* rotated, expanded tile */
|
|
||||||
{
|
|
||||||
INTER_DECLAREGP(rrop_xor);
|
|
||||||
INTER_DECLAREG(*pdst);
|
|
||||||
register int m;
|
|
||||||
INTER_DECLAREG(*psrc);
|
|
||||||
int tileHeight;
|
|
||||||
|
|
||||||
int widthDst;
|
|
||||||
int w;
|
|
||||||
int h;
|
|
||||||
INTER_DECLAREG(leftMask);
|
|
||||||
INTER_DECLAREG(rightMask);
|
|
||||||
int nmiddle;
|
|
||||||
int y;
|
|
||||||
int srcy;
|
|
||||||
|
|
||||||
INTER_DECLAREG(*pdstBase);
|
|
||||||
|
|
||||||
tileHeight = tile->drawable.height;
|
|
||||||
psrc = (unsigned short *)tile->devPrivate.ptr;
|
|
||||||
|
|
||||||
|
|
||||||
iplGetGroupWidthAndPointer (pDrawable, widthDst, pdstBase);
|
|
||||||
|
|
||||||
while (nBox--)
|
|
||||||
{
|
|
||||||
w = pBox->x2 - pBox->x1;
|
|
||||||
h = pBox->y2 - pBox->y1;
|
|
||||||
y = pBox->y1;
|
|
||||||
pdst = pdstBase + (pBox->y1 * widthDst) +
|
|
||||||
(pBox->x1 >> INTER_PGSH) * INTER_PLANES;
|
|
||||||
srcy = y % tileHeight;
|
|
||||||
|
|
||||||
#define StepTile INTER_COPY(psrc + srcy * INTER_PLANES, rrop_xor); \
|
|
||||||
++srcy; \
|
|
||||||
if (srcy == tileHeight) \
|
|
||||||
srcy = 0;
|
|
||||||
|
|
||||||
if ( ((pBox->x1 & INTER_PIM) + w) < INTER_PPG)
|
|
||||||
{
|
|
||||||
INTER_maskpartialbits(pBox->x1, w, leftMask);
|
|
||||||
rightMask = ~leftMask;
|
|
||||||
while (h--)
|
|
||||||
{
|
|
||||||
StepTile
|
|
||||||
INTER_MSKINSM(rightMask, 0, pdst, leftMask, 0, rrop_xor, pdst);
|
|
||||||
pdst += widthDst;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
INTER_maskbits(pBox->x1, w, leftMask, rightMask, nmiddle);
|
|
||||||
|
|
||||||
if (leftMask)
|
|
||||||
{
|
|
||||||
if (rightMask)
|
|
||||||
{
|
|
||||||
Expand (StepTile
|
|
||||||
INTER_RROP_SOLID_MASK(pdst, leftMask);
|
|
||||||
INTER_NEXT_GROUP(pdst);,
|
|
||||||
INTER_RROP_SOLID_MASK(pdst, rightMask);,
|
|
||||||
1)
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Expand (StepTile
|
|
||||||
INTER_RROP_SOLID_MASK(pdst, leftMask);
|
|
||||||
INTER_NEXT_GROUP(pdst);,
|
|
||||||
;,
|
|
||||||
1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (rightMask)
|
|
||||||
{
|
|
||||||
Expand (StepTile
|
|
||||||
,
|
|
||||||
INTER_RROP_SOLID_MASK(pdst, rightMask);,
|
|
||||||
0)
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Expand (StepTile
|
|
||||||
,
|
|
||||||
;,
|
|
||||||
0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pBox++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,123 +0,0 @@
|
|||||||
/* $XFree86: xc/programs/Xserver/iplan2p4/iplpolypnt.c,v 3.0 1996/08/18 01:55:02 dawes Exp $ */
|
|
||||||
/************************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1989 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
********************************************************/
|
|
||||||
|
|
||||||
/* $XConsortium: iplpolypnt.c,v 5.17 94/04/17 20:28:57 dpw Exp $ */
|
|
||||||
|
|
||||||
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
|
|
||||||
interleaved planes */
|
|
||||||
|
|
||||||
#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 "ipl.h"
|
|
||||||
#include "iplmskbits.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 \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
iplPolyPoint(pDrawable, pGC, mode, npt, pptInit)
|
|
||||||
DrawablePtr pDrawable;
|
|
||||||
GCPtr pGC;
|
|
||||||
int mode;
|
|
||||||
int npt;
|
|
||||||
xPoint *pptInit;
|
|
||||||
{
|
|
||||||
register INT32 pt;
|
|
||||||
register INT32 c1, c2;
|
|
||||||
register unsigned long ClipMask = 0x80008000;
|
|
||||||
INTER_DECLAREG(*addrg);
|
|
||||||
register int ngwidth;
|
|
||||||
register int xoffset;
|
|
||||||
INTER_DECLAREG(*addrgt);
|
|
||||||
register INT32 *ppt;
|
|
||||||
RegionPtr cclip;
|
|
||||||
int nbox;
|
|
||||||
register int i;
|
|
||||||
register BoxPtr pbox;
|
|
||||||
INTER_DECLARERRAX(and);
|
|
||||||
INTER_DECLARERRAX(xor);
|
|
||||||
int rop = pGC->alu;
|
|
||||||
int off;
|
|
||||||
iplPrivGCPtr devPriv;
|
|
||||||
xPoint *pptPrev;
|
|
||||||
|
|
||||||
devPriv =iplGetGCPrivate(pGC);
|
|
||||||
rop = devPriv->rop;
|
|
||||||
if (rop == GXnoop)
|
|
||||||
return;
|
|
||||||
cclip = pGC->pCompositeClip;
|
|
||||||
xor = devPriv->xorg;
|
|
||||||
and = devPriv->andg;
|
|
||||||
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;
|
|
||||||
iplGetGroupWidthAndPointer(pDrawable, ngwidth, addrg);
|
|
||||||
addrg = addrg + pDrawable->y * ngwidth +
|
|
||||||
(pDrawable->x >> INTER_PGSH) * INTER_PLANES;
|
|
||||||
xoffset = pDrawable->x & INTER_PIM;
|
|
||||||
PointLoop( addrgt = addrg + intToY(pt) * ngwidth
|
|
||||||
+ ((intToX(pt) + xoffset) >> INTER_PGSH) * INTER_PLANES;
|
|
||||||
INTER_DoMaskRRop(addrgt, and, xor,
|
|
||||||
iplmask[(intToX(pt) + xoffset) & INTER_PIM], addrgt);
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,219 +0,0 @@
|
|||||||
/* $XFree86$ */
|
|
||||||
/*
|
|
||||||
* $XConsortium: iplrrop.c,v 1.8 94/04/17 20:28:59 dpw Exp $
|
|
||||||
*
|
|
||||||
Copyright (c) 1989 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
*
|
|
||||||
* Author: Keith Packard, MIT X Consortium
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
|
|
||||||
interleaved planes */
|
|
||||||
|
|
||||||
/* ipl 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 "ipl.h"
|
|
||||||
|
|
||||||
#include "iplmskbits.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)
|
|
||||||
*/
|
|
||||||
|
|
||||||
iplReduceRasterOp (rop, fg, pm, and, xor)
|
|
||||||
int rop;
|
|
||||||
unsigned long fg, pm;
|
|
||||||
unsigned short *and;
|
|
||||||
unsigned short *xor;
|
|
||||||
{
|
|
||||||
int rrop;
|
|
||||||
switch (rop)
|
|
||||||
{
|
|
||||||
case GXclear:
|
|
||||||
INTER_CLR(and);
|
|
||||||
INTER_CLR(xor);
|
|
||||||
break;
|
|
||||||
case GXand:
|
|
||||||
INTER_PFILL(fg, and);
|
|
||||||
INTER_CLR(xor);
|
|
||||||
break;
|
|
||||||
case GXandReverse:
|
|
||||||
INTER_PFILL(fg, and);
|
|
||||||
INTER_PFILL(fg, xor);
|
|
||||||
break;
|
|
||||||
case GXcopy:
|
|
||||||
INTER_CLR(and);
|
|
||||||
INTER_PFILL(fg, xor);
|
|
||||||
break;
|
|
||||||
case GXandInverted:
|
|
||||||
INTER_PFILL(~fg, xor);
|
|
||||||
INTER_CLR(xor);
|
|
||||||
break;
|
|
||||||
case GXnoop:
|
|
||||||
INTER_SET(and);
|
|
||||||
INTER_CLR(xor);
|
|
||||||
break;
|
|
||||||
case GXxor:
|
|
||||||
INTER_SET(and);
|
|
||||||
INTER_PFILL(fg, xor);
|
|
||||||
break;
|
|
||||||
case GXor:
|
|
||||||
INTER_PFILL(~fg, and);
|
|
||||||
INTER_PFILL(fg, xor);
|
|
||||||
break;
|
|
||||||
case GXnor:
|
|
||||||
INTER_PFILL(~fg, and);
|
|
||||||
INTER_PFILL(~fg, xor);
|
|
||||||
break;
|
|
||||||
case GXequiv:
|
|
||||||
INTER_SET(and);
|
|
||||||
INTER_PFILL(~fg, xor);
|
|
||||||
case GXinvert:
|
|
||||||
INTER_SET(and);
|
|
||||||
INTER_SET(xor);
|
|
||||||
break;
|
|
||||||
case GXorReverse:
|
|
||||||
INTER_PFILL(~fg, and);
|
|
||||||
INTER_SET(xor);
|
|
||||||
break;
|
|
||||||
case GXcopyInverted:
|
|
||||||
INTER_CLR(and);
|
|
||||||
INTER_PFILL(~fg, xor);
|
|
||||||
break;
|
|
||||||
case GXorInverted:
|
|
||||||
INTER_PFILL(fg, and);
|
|
||||||
INTER_PFILL(~fg, xor);
|
|
||||||
break;
|
|
||||||
case GXnand:
|
|
||||||
INTER_PFILL(fg, and);
|
|
||||||
INTER_SET(xor);
|
|
||||||
break;
|
|
||||||
case GXset:
|
|
||||||
INTER_CLR(and);
|
|
||||||
INTER_SET(xor);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
INTER_ANDXOR_PM(pm, and, xor);
|
|
||||||
if (INTER_IS_CLR(and))
|
|
||||||
rrop = GXcopy;
|
|
||||||
else if (INTER_IS_SET(and))
|
|
||||||
rrop = GXxor;
|
|
||||||
else if (INTER_IS_CLR(xor))
|
|
||||||
rrop = GXand;
|
|
||||||
else if (INTER_IS_XOR_SET(and, xor))
|
|
||||||
rrop = GXor;
|
|
||||||
else
|
|
||||||
rrop = GXset;
|
|
||||||
return rrop;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
/* $XFree86: xc/programs/Xserver/iplan2p4/iplrrop.h,v 3.0 1996/08/18 01:55:04 dawes Exp $ */
|
|
||||||
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
|
|
||||||
interleaved planes */
|
|
||||||
|
|
||||||
/* reduced raster ops */
|
|
||||||
/* INTER_RROP_DECLARE INTER_RROP_FETCH_GC,
|
|
||||||
INTER_RROP_SOLID_MASK, INTER_RROP_SPAN INTER_RROP_NAME */
|
|
||||||
|
|
||||||
#define INTER_RROP_FETCH_GC(gc) \
|
|
||||||
INTER_RROP_FETCH_GCPRIV(((iplPrivGCPtr)(gc)->devPrivates[iplGCPrivateIndex].ptr))
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if RROP == GXcopy
|
|
||||||
#define INTER_RROP_DECLARE register unsigned short *rrop_xor;
|
|
||||||
#define INTER_RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xorg;
|
|
||||||
#define INTER_RROP_SOLID(dst) INTER_COPY(rrop_xor, dst)
|
|
||||||
#define INTER_RROP_SOLID_MASK(dst,mask) INTER_COPYM(rrop_xor, dst, mask, dst)
|
|
||||||
#define INTER_RROP_NAME(prefix) INTER_RROP_NAME_CAT(prefix,Copy)
|
|
||||||
#endif /* GXcopy */
|
|
||||||
|
|
||||||
#if RROP == GXxor
|
|
||||||
#define INTER_RROP_DECLARE register unsigned short *rrop_xor;
|
|
||||||
#define INTER_RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xorg;
|
|
||||||
#define INTER_RROP_SOLID(dst) INTER_XOR(rrop_xor, dst, dst)
|
|
||||||
#define INTER_RROP_SOLID_MASK(dst,mask) INTER_XORM(rrop_xor, dst, mask, dst)
|
|
||||||
#define INTER_RROP_NAME(prefix) INTER_RROP_NAME_CAT(prefix,Xor)
|
|
||||||
#endif /* GXxor */
|
|
||||||
|
|
||||||
#if RROP == GXand
|
|
||||||
#define INTER_RROP_DECLARE register unsigned short *rrop_and;
|
|
||||||
#define INTER_RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->andg;
|
|
||||||
#define INTER_RROP_SOLID(dst) INTER_AND(rrop_and, dst, dst)
|
|
||||||
#define INTER_RROP_SOLID_MASK(dst,mask) INTER_ANDM(rrop_and, dst, mask, dst)
|
|
||||||
#define INTER_RROP_NAME(prefix) INTER_RROP_NAME_CAT(prefix,And)
|
|
||||||
#endif /* GXand */
|
|
||||||
|
|
||||||
#if RROP == GXor
|
|
||||||
#define INTER_RROP_DECLARE register unsigned short *rrop_or;
|
|
||||||
#define INTER_RROP_FETCH_GCPRIV(devPriv) rrop_or = (devPriv)->xorg;
|
|
||||||
#define INTER_RROP_SOLID(dst) INTER_OR(rrop_or, dst, dst)
|
|
||||||
#define INTER_RROP_SOLID_MASK(dst,mask) INTER_ORM(mask, rrop_or, dst, dst)
|
|
||||||
#define INTER_RROP_NAME(prefix) INTER_RROP_NAME_CAT(prefix,Or)
|
|
||||||
#endif /* GXor */
|
|
||||||
|
|
||||||
#if RROP == GXnoop
|
|
||||||
#define INTER_RROP_DECLARE
|
|
||||||
#define INTER_RROP_FETCH_GCPRIV(devPriv)
|
|
||||||
#define INTER_RROP_SOLID(dst)
|
|
||||||
#define INTER_RROP_SOLID_MASK(dst,mask)
|
|
||||||
#define INTER_RROP_NAME(prefix) INTER_RROP_NAME_CAT(prefix,Noop)
|
|
||||||
#endif /* GXnoop */
|
|
||||||
|
|
||||||
#if RROP == GXset
|
|
||||||
#define INTER_RROP_DECLARE register unsigned short *rrop_and, *rrop_xor;
|
|
||||||
#define INTER_RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->andg; \
|
|
||||||
rrop_xor = (devPriv)->xorg;
|
|
||||||
#define INTER_RROP_SOLID(dst) INTER_DoRRop(dst, rrop_and, rrop_xor, dst)
|
|
||||||
#define INTER_RROP_SOLID_MASK(dst,mask) \
|
|
||||||
INTER_DoMaskRRop(dst, rrop_and, rrop_xor, mask, dst)
|
|
||||||
#define INTER_RROP_NAME(prefix) INTER_RROP_NAME_CAT(prefix,General)
|
|
||||||
#endif /* GXset */
|
|
||||||
|
|
||||||
#ifndef INTER_RROP_SPAN
|
|
||||||
#define INTER_RROP_SPAN(pdst,nmiddle) \
|
|
||||||
while (--(nmiddle) >= 0) { \
|
|
||||||
INTER_RROP_SOLID(pdst); \
|
|
||||||
(pdst) = INTER_NEXT(pdst); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(UNIXCPP) || defined(ANSICPP)
|
|
||||||
#define INTER_RROP_NAME_CAT(prefix,suffix) prefix##suffix
|
|
||||||
#else
|
|
||||||
#define INTER_RROP_NAME_CAT(prefix,suffix) prefix/**/suffix
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@@ -1,233 +0,0 @@
|
|||||||
/* $XFree86: xc/programs/Xserver/iplan2p4/iplscrinit.c,v 3.2 1998/06/27 12:55:03 hohndel Exp $ */
|
|
||||||
/************************************************************
|
|
||||||
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 X Consortium
|
|
||||||
not be used in advertising or publicity pertaining to
|
|
||||||
distribution of the software without specific prior
|
|
||||||
written permission. Sun and X Consortium 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.
|
|
||||||
|
|
||||||
********************************************************/
|
|
||||||
/* $XConsortium: iplscrinit.c,v 5.32 94/04/17 20:29:00 dpw Exp $ */
|
|
||||||
|
|
||||||
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
|
|
||||||
interleaved planes */
|
|
||||||
|
|
||||||
#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 "ipl.h"
|
|
||||||
#include "mi.h"
|
|
||||||
#include "mistruct.h"
|
|
||||||
#include "dix.h"
|
|
||||||
#include "mibstore.h"
|
|
||||||
|
|
||||||
|
|
||||||
BSFuncRec iplBSFuncRec = {
|
|
||||||
iplSaveAreas,
|
|
||||||
iplRestoreAreas,
|
|
||||||
(BackingStoreSetClipmaskRgnProcPtr) 0,
|
|
||||||
(BackingStoreGetImagePixmapProcPtr) 0,
|
|
||||||
(BackingStoreGetSpansPixmapProcPtr) 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
Bool
|
|
||||||
iplCloseScreen (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 (pScreen->devPrivates[iplScreenPrivateIndex].ptr);
|
|
||||||
#else
|
|
||||||
xfree (pScreen->devPrivate);
|
|
||||||
#endif
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool
|
|
||||||
iplSetupScreen(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 */
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
extern RegionPtr (*iplPuntCopyPlane)();
|
|
||||||
|
|
||||||
if (!iplAllocatePrivates(pScreen, (int *) 0, (int *) 0))
|
|
||||||
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 = iplGetImage;
|
|
||||||
pScreen->GetSpans = iplGetSpans;
|
|
||||||
pScreen->CreateWindow = iplCreateWindow;
|
|
||||||
pScreen->DestroyWindow = iplDestroyWindow;
|
|
||||||
pScreen->PositionWindow = iplPositionWindow;
|
|
||||||
pScreen->ChangeWindowAttributes = iplChangeWindowAttributes;
|
|
||||||
pScreen->RealizeWindow = iplMapWindow;
|
|
||||||
pScreen->UnrealizeWindow = iplUnmapWindow;
|
|
||||||
pScreen->PaintWindowBackground = iplPaintWindow;
|
|
||||||
pScreen->PaintWindowBorder = iplPaintWindow;
|
|
||||||
pScreen->CopyWindow = iplCopyWindow;
|
|
||||||
pScreen->CreatePixmap = iplCreatePixmap;
|
|
||||||
pScreen->DestroyPixmap = iplDestroyPixmap;
|
|
||||||
pScreen->RealizeFont = mfbRealizeFont;
|
|
||||||
pScreen->UnrealizeFont = mfbUnrealizeFont;
|
|
||||||
pScreen->CreateGC = iplCreateGC;
|
|
||||||
pScreen->CreateColormap = iplInitializeColormap;
|
|
||||||
pScreen->DestroyColormap = (void (*)())NoopDDA;
|
|
||||||
pScreen->InstallColormap = iplInstallColormap;
|
|
||||||
pScreen->UninstallColormap = iplUninstallColormap;
|
|
||||||
pScreen->ListInstalledColormaps = iplListInstalledColormaps;
|
|
||||||
pScreen->StoreColors = (void (*)())NoopDDA;
|
|
||||||
pScreen->ResolveColor = iplResolveColor;
|
|
||||||
pScreen->BitmapToRegion = mfbPixmapToRegion;
|
|
||||||
|
|
||||||
mfbRegisterCopyPlaneProc (pScreen, iplCopyPlane);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CFB_NEED_SCREEN_PRIVATE
|
|
||||||
Bool
|
|
||||||
iplCreateScreenResources(pScreen)
|
|
||||||
ScreenPtr pScreen;
|
|
||||||
{
|
|
||||||
Bool retval;
|
|
||||||
|
|
||||||
pointer oldDevPrivate = pScreen->devPrivate;
|
|
||||||
pScreen->devPrivate = pScreen->devPrivates[iplScreenPrivateIndex].ptr;
|
|
||||||
retval = miCreateScreenResources(pScreen);
|
|
||||||
pScreen->devPrivates[iplScreenPrivateIndex].ptr = pScreen->devPrivate;
|
|
||||||
pScreen->devPrivate = oldDevPrivate;
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Bool
|
|
||||||
iplFinishScreenInit(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 */
|
|
||||||
{
|
|
||||||
int i, j;
|
|
||||||
#ifdef CFB_NEED_SCREEN_PRIVATE
|
|
||||||
pointer oldDevPrivate;
|
|
||||||
#endif
|
|
||||||
VisualPtr visuals;
|
|
||||||
DepthPtr depths;
|
|
||||||
int nvisuals;
|
|
||||||
int ndepths;
|
|
||||||
int rootdepth;
|
|
||||||
VisualID defaultVisual;
|
|
||||||
|
|
||||||
rootdepth = 0;
|
|
||||||
if (!iplInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootdepth,
|
|
||||||
&defaultVisual,((unsigned long)1<<(INTER_PLANES-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 = iplCloseScreen;
|
|
||||||
#ifdef CFB_NEED_SCREEN_PRIVATE
|
|
||||||
pScreen->CreateScreenResources = iplCreateScreenResources;
|
|
||||||
pScreen->devPrivates[iplScreenPrivateIndex].ptr = pScreen->devPrivate;
|
|
||||||
pScreen->devPrivate = oldDevPrivate;
|
|
||||||
#endif
|
|
||||||
pScreen->BackingStoreFuncs = iplBSFuncRec;
|
|
||||||
pScreen->GetScreenPixmap = iplGetScreenPixmap;
|
|
||||||
pScreen->SetScreenPixmap = iplSetScreenPixmap;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* dts * (inch/dot) * (25.4 mm / inch) = mm */
|
|
||||||
Bool
|
|
||||||
iplScreenInit(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 (!iplSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width))
|
|
||||||
return FALSE;
|
|
||||||
if (!iplFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width))
|
|
||||||
return FALSE;
|
|
||||||
#if INTER_PLANES == 2
|
|
||||||
/* This shouldn't be necessary */
|
|
||||||
PixmapWidthPaddingInfo[2].padPixelsLog2 = 4;
|
|
||||||
PixmapWidthPaddingInfo[2].padRoundUp = 15;
|
|
||||||
PixmapWidthPaddingInfo[2].padBytesLog2 = 2;
|
|
||||||
#endif
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
PixmapPtr
|
|
||||||
iplGetScreenPixmap(pScreen)
|
|
||||||
ScreenPtr pScreen;
|
|
||||||
{
|
|
||||||
#ifdef CFB_NEED_SCREEN_PRIVATE
|
|
||||||
return (PixmapPtr)(pScreen->devPrivates[iplScreenPrivateIndex].ptr);
|
|
||||||
#else
|
|
||||||
return (PixmapPtr)(pScreen->devPrivate.ptr);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
iplSetScreenPixmap(pPix)
|
|
||||||
PixmapPtr pPix;
|
|
||||||
{
|
|
||||||
#ifdef CFB_NEED_SCREEN_PRIVATE
|
|
||||||
if (pPix)
|
|
||||||
pPix->drawable.pScreen->devPrivates[iplScreenPrivateIndex].ptr =
|
|
||||||
(pointer)pPix;
|
|
||||||
#else
|
|
||||||
if (pPix)
|
|
||||||
pPix->drawable.pScreen->devPrivate.ptr = (pointer)pPix;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
@@ -1,304 +0,0 @@
|
|||||||
/* $XFree86$ */
|
|
||||||
/* $XConsortium: iplsetsp.c,v 5.10 94/04/17 20:29:01 dpw Exp $ */
|
|
||||||
/***********************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
******************************************************************/
|
|
||||||
|
|
||||||
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
|
|
||||||
interleaved planes */
|
|
||||||
|
|
||||||
#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 "ipl.h"
|
|
||||||
|
|
||||||
#include "iplmskbits.h"
|
|
||||||
#include "iplmergerop.h"
|
|
||||||
#include "iplpack.h"
|
|
||||||
|
|
||||||
/* iplSetScanline -- 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.)
|
|
||||||
*/
|
|
||||||
iplSetScanline(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 */
|
|
||||||
INTER_DECLAREG(*pdstBase); /* start of the drawable */
|
|
||||||
int widthDst; /* width of drawable in groups */
|
|
||||||
unsigned long planemask;
|
|
||||||
{
|
|
||||||
int w; /* width of scanline in bits */
|
|
||||||
INTER_DECLAREG(*pdst); /* where to put the bits */
|
|
||||||
INTER_DECLAREGP(tmpSrc); /* scratch buffer to collect bits in */
|
|
||||||
int dstBit; /* offset in bits from beginning of
|
|
||||||
* word */
|
|
||||||
register int nstart; /* number of bits from first partial */
|
|
||||||
register int nend; /* " " last partial word */
|
|
||||||
int offSrc;
|
|
||||||
INTER_DECLAREG(startmask);
|
|
||||||
INTER_DECLAREG(endmask);
|
|
||||||
int nlMiddle, nl, longs;
|
|
||||||
INTER_DECLAREG(*ipsrc);
|
|
||||||
INTER_DECLAREG(*tmppsrc);
|
|
||||||
INTER_DeclareMergeRop()
|
|
||||||
|
|
||||||
INTER_InitializeMergeRop(alu,planemask);
|
|
||||||
|
|
||||||
longs=NUM_LONGS(INTER_PLANES, xOrigin, xEnd);
|
|
||||||
|
|
||||||
tmppsrc = ipsrc = (unsigned short *)
|
|
||||||
ALLOCATE_LOCAL(NUM_TEMP_BYTES(INTER_PLANES,longs));
|
|
||||||
|
|
||||||
iplUnpackLine(INTER_PLANES, longs, psrc, ipsrc);
|
|
||||||
|
|
||||||
pdst = pdstBase + (y * widthDst) + (xStart >> INTER_PGSH) * INTER_PLANES;
|
|
||||||
offSrc = (xStart - xOrigin) & INTER_PIM;
|
|
||||||
w = xEnd - xStart;
|
|
||||||
dstBit = xStart & INTER_PIM;
|
|
||||||
|
|
||||||
ipsrc += ((xStart - xOrigin) >> INTER_PGSH) * INTER_PLANES;
|
|
||||||
if (dstBit + w <= INTER_PPG)
|
|
||||||
{
|
|
||||||
INTER_maskpartialbits(dstBit, w, startmask);
|
|
||||||
endmask = 0;
|
|
||||||
nlMiddle = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
INTER_maskbits(xStart, w, startmask, endmask, nlMiddle);
|
|
||||||
}
|
|
||||||
if (startmask)
|
|
||||||
nstart = INTER_PPG - dstBit;
|
|
||||||
else
|
|
||||||
nstart = 0;
|
|
||||||
if (endmask)
|
|
||||||
nend = xEnd & INTER_PIM;
|
|
||||||
else
|
|
||||||
nend = 0;
|
|
||||||
if (startmask)
|
|
||||||
{
|
|
||||||
INTER_getbits(ipsrc, offSrc, nstart, tmpSrc);
|
|
||||||
INTER_putbitsmropshort(tmpSrc, dstBit, nstart, pdst);
|
|
||||||
INTER_NEXT_GROUP(pdst);
|
|
||||||
offSrc += nstart;
|
|
||||||
if (offSrc > INTER_PLST)
|
|
||||||
{
|
|
||||||
INTER_NEXT_GROUP(ipsrc);
|
|
||||||
offSrc -= INTER_PPG;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
nl = nlMiddle;
|
|
||||||
while (nl--)
|
|
||||||
{
|
|
||||||
INTER_getbits(ipsrc, offSrc, INTER_PPG, tmpSrc);
|
|
||||||
INTER_DoMergeRop(tmpSrc, pdst, pdst);
|
|
||||||
INTER_NEXT_GROUP(pdst);
|
|
||||||
INTER_NEXT_GROUP(ipsrc);
|
|
||||||
}
|
|
||||||
if (endmask)
|
|
||||||
{
|
|
||||||
INTER_getbits(ipsrc, offSrc, nend, tmpSrc);
|
|
||||||
INTER_putbitsmropshort(tmpSrc, 0, nend, pdst);
|
|
||||||
}
|
|
||||||
DEALLOCATE_LOCAL(tmppsrc);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* 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
|
|
||||||
iplSetSpans(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;
|
|
||||||
INTER_DECLAREG(*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 = iplGetCompositeClip(pGC);
|
|
||||||
pptLast = ppt + nspans;
|
|
||||||
|
|
||||||
iplGetGroupWidthAndPointer (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);
|
|
||||||
iplSetScanline(ppt->y, ppt->x, xStart, xEnd, psrc, alu,
|
|
||||||
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);
|
|
||||||
iplSetScanline(ppt->y, ppt->x, xStart, xEnd, psrc, alu,
|
|
||||||
pdstBase, widthDst, pGC->planemask);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
psrc += PixmapWidthInPadUnits(*pwidth, pDrawable->depth);
|
|
||||||
ppt++;
|
|
||||||
pwidth++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,221 +0,0 @@
|
|||||||
/* $XFree86: xc/programs/Xserver/iplan2p4/iplsolid.c,v 3.0 1996/08/18 01:55:08 dawes Exp $ */
|
|
||||||
/*
|
|
||||||
* $XConsortium: iplsolid.c,v 1.9 94/04/17 20:29:02 dpw Exp $
|
|
||||||
*
|
|
||||||
Copyright (c) 1990 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
*
|
|
||||||
* Author: Keith Packard, MIT X Consortium
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
|
|
||||||
interleaved planes */
|
|
||||||
|
|
||||||
#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 "ipl.h"
|
|
||||||
#include "iplrrop.h"
|
|
||||||
|
|
||||||
#include "mi.h"
|
|
||||||
#include "mispans.h"
|
|
||||||
|
|
||||||
#include "iplmskbits.h"
|
|
||||||
|
|
||||||
# define Expand(left, right, leftAdjust) { \
|
|
||||||
while (h--) { \
|
|
||||||
pdst = pdstRect; \
|
|
||||||
left \
|
|
||||||
m = nmiddle; \
|
|
||||||
INTER_RROP_SPAN(pdst, m); \
|
|
||||||
right \
|
|
||||||
pdstRect += widthDst; \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
INTER_RROP_NAME(iplFillRectSolid) (pDrawable, pGC, nBox, pBox)
|
|
||||||
DrawablePtr pDrawable;
|
|
||||||
GCPtr pGC;
|
|
||||||
int nBox;
|
|
||||||
BoxPtr pBox;
|
|
||||||
{
|
|
||||||
register int m;
|
|
||||||
INTER_DECLAREG(*pdst);
|
|
||||||
INTER_RROP_DECLARE
|
|
||||||
INTER_DECLAREG(leftMask);
|
|
||||||
INTER_DECLAREG(rightMask);
|
|
||||||
INTER_DECLAREG(*pdstBase);
|
|
||||||
INTER_DECLAREG(*pdstRect);
|
|
||||||
int nmiddle;
|
|
||||||
int h;
|
|
||||||
int w;
|
|
||||||
int widthDst;
|
|
||||||
|
|
||||||
iplGetGroupWidthAndPointer (pDrawable, widthDst, pdstBase)
|
|
||||||
|
|
||||||
INTER_RROP_FETCH_GC(pGC)
|
|
||||||
|
|
||||||
for (; nBox; nBox--, pBox++)
|
|
||||||
{
|
|
||||||
pdstRect = pdstBase + pBox->y1 * widthDst;
|
|
||||||
h = pBox->y2 - pBox->y1;
|
|
||||||
w = pBox->x2 - pBox->x1;
|
|
||||||
pdstRect += (pBox->x1 >> INTER_PGSH) * INTER_PLANES;
|
|
||||||
if ((pBox->x1 & INTER_PIM) + w <= INTER_PPG)
|
|
||||||
{
|
|
||||||
INTER_maskpartialbits(pBox->x1, w, leftMask);
|
|
||||||
pdst = pdstRect;
|
|
||||||
while (h--) {
|
|
||||||
INTER_RROP_SOLID_MASK (pdst, leftMask);
|
|
||||||
pdst += widthDst;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
INTER_maskbits (pBox->x1, w, leftMask, rightMask, nmiddle);
|
|
||||||
if (leftMask)
|
|
||||||
{
|
|
||||||
if (rightMask) /* left mask and right mask */
|
|
||||||
{
|
|
||||||
Expand(INTER_RROP_SOLID_MASK (pdst, leftMask);
|
|
||||||
INTER_NEXT_GROUP(pdst);,
|
|
||||||
INTER_RROP_SOLID_MASK (pdst, rightMask);, 1)
|
|
||||||
}
|
|
||||||
else /* left mask and no right mask */
|
|
||||||
{
|
|
||||||
Expand(INTER_RROP_SOLID_MASK (pdst, leftMask);
|
|
||||||
INTER_NEXT_GROUP(pdst);,
|
|
||||||
;, 1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (rightMask) /* no left mask and right mask */
|
|
||||||
{
|
|
||||||
Expand(;,
|
|
||||||
INTER_RROP_SOLID_MASK (pdst, rightMask);, 0)
|
|
||||||
}
|
|
||||||
else /* no left mask and no right mask */
|
|
||||||
{
|
|
||||||
Expand(;,
|
|
||||||
;, 0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
INTER_RROP_NAME(iplSolidSpans) (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;
|
|
||||||
{
|
|
||||||
INTER_DECLAREG(*pdstBase);
|
|
||||||
int widthDst;
|
|
||||||
|
|
||||||
INTER_RROP_DECLARE
|
|
||||||
|
|
||||||
INTER_DECLAREG(*pdst);
|
|
||||||
register int ngmiddle;
|
|
||||||
INTER_DECLAREG(startmask);
|
|
||||||
INTER_DECLAREG(endmask);
|
|
||||||
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;
|
|
||||||
iplPrivGCPtr devPriv;
|
|
||||||
|
|
||||||
devPriv = iplGetGCPrivate(pGC);
|
|
||||||
INTER_RROP_FETCH_GCPRIV(devPriv)
|
|
||||||
n = nInit * miFindMaxBand(pGC->pCompositeClip);
|
|
||||||
pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
|
|
||||||
pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
|
|
||||||
if(!pptFree || !pwidthFree)
|
|
||||||
{
|
|
||||||
if (pptFree) DEALLOCATE_LOCAL(pptFree);
|
|
||||||
if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
pwidth = pwidthFree;
|
|
||||||
ppt = pptFree;
|
|
||||||
n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit,
|
|
||||||
ppt, pwidth, fSorted);
|
|
||||||
|
|
||||||
iplGetGroupWidthAndPointer (pDrawable, widthDst, pdstBase)
|
|
||||||
|
|
||||||
while (n--)
|
|
||||||
{
|
|
||||||
x = ppt->x;
|
|
||||||
pdst = pdstBase + (ppt->y * widthDst);
|
|
||||||
++ppt;
|
|
||||||
w = *pwidth++;
|
|
||||||
if (!w)
|
|
||||||
continue;
|
|
||||||
if ((x & INTER_PIM) + w <= INTER_PPG)
|
|
||||||
{
|
|
||||||
pdst += (x >> INTER_PGSH) * INTER_PLANES;
|
|
||||||
INTER_maskpartialbits (x, w, startmask);
|
|
||||||
INTER_RROP_SOLID_MASK (pdst, startmask);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pdst += (x >> INTER_PGSH) * INTER_PLANES;
|
|
||||||
INTER_maskbits (x, w, startmask, endmask, ngmiddle);
|
|
||||||
if (startmask)
|
|
||||||
{
|
|
||||||
INTER_RROP_SOLID_MASK (pdst, startmask);
|
|
||||||
INTER_NEXT_GROUP(pdst);
|
|
||||||
}
|
|
||||||
|
|
||||||
INTER_RROP_SPAN(pdst,ngmiddle);
|
|
||||||
|
|
||||||
if (endmask)
|
|
||||||
{
|
|
||||||
INTER_RROP_SOLID_MASK (pdst, endmask);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DEALLOCATE_LOCAL(pptFree);
|
|
||||||
DEALLOCATE_LOCAL(pwidthFree);
|
|
||||||
}
|
|
||||||
@@ -1,221 +0,0 @@
|
|||||||
/* $XFree86$ */
|
|
||||||
/* $XConsortium: ipltegblt.c,v 5.9 94/04/17 20:29:03 dpw Exp $ */
|
|
||||||
/***********************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
******************************************************************/
|
|
||||||
|
|
||||||
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
|
|
||||||
interleaved planes */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include <X11/Xmd.h>
|
|
||||||
#include <X11/Xproto.h>
|
|
||||||
#include "ipl.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 "mi.h"
|
|
||||||
#define MFB_CONSTS_ONLY
|
|
||||||
#include "maskbits.h"
|
|
||||||
|
|
||||||
#include "iplmskbits.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
this works for fonts with glyphs <= 32 bits wide, on an
|
|
||||||
arbitrarily deep display. Use iplTEGlyphBlt8 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
|
|
||||||
iplTEGlyphBlt(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;
|
|
||||||
INTER_DECLAREG(*pdstBase); /* pointer to group 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;
|
|
||||||
|
|
||||||
INTER_DECLAREG(*pdst); /* pointer to current group in dst */
|
|
||||||
int hTmp; /* counter for height */
|
|
||||||
BoxRec bbox; /* for clipping */
|
|
||||||
|
|
||||||
register int wtmp,xtemp,width;
|
|
||||||
INTER_DECLAREGP(bgfill);
|
|
||||||
INTER_DECLAREGP(fgfill);
|
|
||||||
unsigned long *ptemp;
|
|
||||||
INTER_DECLAREGP(tmpDst1);
|
|
||||||
INTER_DECLAREGP(tmpDst2);
|
|
||||||
INTER_DECLAREG(*pdtmp);
|
|
||||||
int tmpx;
|
|
||||||
|
|
||||||
xpos += pDrawable->x;
|
|
||||||
ypos += pDrawable->y;
|
|
||||||
|
|
||||||
iplGetGroupWidthAndPointer (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;
|
|
||||||
|
|
||||||
INTER_PFILL(pGC->fgPixel, fgfill);
|
|
||||||
INTER_PFILL(pGC->bgPixel, bgfill);
|
|
||||||
|
|
||||||
switch (RECT_IN_REGION(pGC->pScreen, iplGetCompositeClip(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...
|
|
||||||
*/
|
|
||||||
#if 1
|
|
||||||
miImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
|
|
||||||
#endif
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
tmpx = x & INTER_PIM;
|
|
||||||
w = min(width, INTER_PPG - tmpx);
|
|
||||||
/* w = min(w, (PGSZ - xtemp)); */
|
|
||||||
|
|
||||||
ptemp = (unsigned long *)(pglyph + (xtemp >> MFB_PWSH));
|
|
||||||
#if 1
|
|
||||||
INTER_getstipplepixelsb(ptemp,xtemp,w,bgfill,fgfill,tmpDst1);
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
INTER_DECLAREG(*pdsttmp) =
|
|
||||||
pdst + (x >> INTER_PGSH) * INTER_PLANES;
|
|
||||||
#if 1
|
|
||||||
INTER_putbits(tmpDst1,tmpx,w,pdsttmp,pGC->planemask);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
x += w;
|
|
||||||
xtemp += w;
|
|
||||||
width -= w;
|
|
||||||
}
|
|
||||||
pglyph += widthGlyph;
|
|
||||||
pdst += widthDst;
|
|
||||||
}
|
|
||||||
xpos += wtmp;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,272 +0,0 @@
|
|||||||
/* $XFree86: xc/programs/Xserver/iplan2p4/ipltile32.c,v 3.0 1996/08/18 01:55:10 dawes Exp $ */
|
|
||||||
/*
|
|
||||||
* Fill 32 bit tiled rectangles. Used by both PolyFillRect and PaintWindow.
|
|
||||||
* no depth dependencies.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
Copyright (c) 1989 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* $XConsortium: ipltile32.c,v 1.8 94/04/17 20:29:05 dpw Exp $ */
|
|
||||||
|
|
||||||
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
|
|
||||||
interleaved planes */
|
|
||||||
|
|
||||||
#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 "ipl.h"
|
|
||||||
|
|
||||||
#include "mi.h"
|
|
||||||
#include "mispans.h"
|
|
||||||
|
|
||||||
#include "iplmskbits.h"
|
|
||||||
#include "iplmergerop.h"
|
|
||||||
|
|
||||||
#define STORE(p) INTER_MROP_PREBUILT_SOLID(srcpix, p, p)
|
|
||||||
|
|
||||||
#define Expand(left,right) {\
|
|
||||||
while (h--) { \
|
|
||||||
INTER_COPY(psrc+srcy*INTER_PLANES, srcpix); \
|
|
||||||
INTER_MROP_PREBUILD(srcpix); \
|
|
||||||
++srcy; \
|
|
||||||
if (srcy == tileHeight) \
|
|
||||||
srcy = 0; \
|
|
||||||
left \
|
|
||||||
ngw = ngwMiddle; \
|
|
||||||
while (ngw--) \
|
|
||||||
{ \
|
|
||||||
STORE(p); \
|
|
||||||
INTER_NEXT_GROUP(p); \
|
|
||||||
} \
|
|
||||||
right \
|
|
||||||
p += ngwExtra; \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
INTER_MROP_NAME(iplFillRectTile32) (pDrawable, pGC, nBox, pBox)
|
|
||||||
DrawablePtr pDrawable;
|
|
||||||
GCPtr pGC;
|
|
||||||
int nBox; /* number of boxes to fill */
|
|
||||||
BoxPtr pBox; /* pointer to list of boxes to fill */
|
|
||||||
{
|
|
||||||
INTER_DECLAREGP(srcpix);
|
|
||||||
INTER_DECLAREG(*psrc); /* pointer to bits in tile, if needed */
|
|
||||||
int tileHeight; /* height of the tile */
|
|
||||||
|
|
||||||
int ngwDst; /* width in longwords of the dest pixmap */
|
|
||||||
int w; /* width of current box */
|
|
||||||
register int h; /* height of current box */
|
|
||||||
INTER_DECLAREG(startmask);
|
|
||||||
INTER_DECLAREG(endmask); /* masks for reggedy bits at either end of line */
|
|
||||||
int ngwMiddle; /* number of longwords between sides of boxes */
|
|
||||||
int ngwExtra; /* to get from right of box to left of next span */
|
|
||||||
register int ngw; /* loop version of ngwMiddle */
|
|
||||||
INTER_DECLAREG(*p); /* pointer to bits we're writing */
|
|
||||||
int y; /* current scan line */
|
|
||||||
int srcy; /* current tile position */
|
|
||||||
|
|
||||||
INTER_DECLAREG(*pbits); /* pointer to start of pixmap */
|
|
||||||
PixmapPtr tile; /* rotated, expanded tile */
|
|
||||||
INTER_MROP_DECLARE_REG()
|
|
||||||
INTER_MROP_PREBUILT_DECLARE()
|
|
||||||
|
|
||||||
tile = pGC->pRotatedPixmap;
|
|
||||||
tileHeight = tile->drawable.height;
|
|
||||||
psrc = (unsigned short *)tile->devPrivate.ptr;
|
|
||||||
|
|
||||||
INTER_MROP_INITIALIZE(pGC->alu, pGC->planemask);
|
|
||||||
|
|
||||||
iplGetGroupWidthAndPointer (pDrawable, ngwDst, pbits)
|
|
||||||
|
|
||||||
while (nBox--)
|
|
||||||
{
|
|
||||||
w = pBox->x2 - pBox->x1;
|
|
||||||
h = pBox->y2 - pBox->y1;
|
|
||||||
y = pBox->y1;
|
|
||||||
p = pbits + (y * ngwDst) + (pBox->x1 >> INTER_PGSH) * INTER_PLANES;
|
|
||||||
srcy = y % tileHeight;
|
|
||||||
|
|
||||||
if ( ((pBox->x1 & INTER_PIM) + w) <= INTER_PPG)
|
|
||||||
{
|
|
||||||
INTER_maskpartialbits(pBox->x1, w, startmask);
|
|
||||||
ngwExtra = ngwDst;
|
|
||||||
while (h--)
|
|
||||||
{
|
|
||||||
INTER_COPY(psrc+srcy*INTER_PLANES, srcpix);
|
|
||||||
INTER_MROP_PREBUILD(srcpix);
|
|
||||||
++srcy;
|
|
||||||
if (srcy == tileHeight)
|
|
||||||
srcy = 0;
|
|
||||||
INTER_MROP_PREBUILT_MASK(srcpix, p, startmask, p);
|
|
||||||
p += ngwExtra;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
INTER_maskbits(pBox->x1, w, startmask, endmask, ngwMiddle);
|
|
||||||
ngwExtra = ngwDst - ngwMiddle * INTER_PLANES;
|
|
||||||
|
|
||||||
if (startmask)
|
|
||||||
{
|
|
||||||
ngwExtra -= INTER_PLANES;
|
|
||||||
if (endmask)
|
|
||||||
{
|
|
||||||
Expand(
|
|
||||||
INTER_MROP_PREBUILT_MASK(srcpix, p, startmask, p);
|
|
||||||
INTER_NEXT_GROUP(p);,
|
|
||||||
INTER_MROP_PREBUILT_MASK(srcpix, p, endmask, p));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Expand(
|
|
||||||
INTER_MROP_PREBUILT_MASK(srcpix, p, startmask, p);
|
|
||||||
INTER_NEXT_GROUP(p);,
|
|
||||||
;)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (endmask)
|
|
||||||
{
|
|
||||||
Expand(;,
|
|
||||||
INTER_MROP_PREBUILT_MASK(srcpix, p, endmask, p));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Expand(;,
|
|
||||||
;)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pBox++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
INTER_MROP_NAME(iplTile32FS)(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 */
|
|
||||||
INTER_DECLAREG(*pbits); /* pointer to start of bitmap */
|
|
||||||
int ngwDst; /* width in longwords of bitmap */
|
|
||||||
INTER_DECLAREG(*p); /* pointer to current longword in bitmap */
|
|
||||||
register int w; /* current span width */
|
|
||||||
register int ngw;
|
|
||||||
register int x;
|
|
||||||
INTER_DECLAREG(startmask);
|
|
||||||
INTER_DECLAREG(endmask);
|
|
||||||
INTER_DECLAREGP(srcpix);
|
|
||||||
int y;
|
|
||||||
int *pwidthFree;/* copies of the pointers to free */
|
|
||||||
DDXPointPtr pptFree;
|
|
||||||
PixmapPtr tile;
|
|
||||||
INTER_DECLAREG(*psrc); /* pointer to bits in tile */
|
|
||||||
int tileHeight;/* height of the tile */
|
|
||||||
INTER_MROP_DECLARE_REG ()
|
|
||||||
INTER_MROP_PREBUILT_DECLARE()
|
|
||||||
|
|
||||||
n = nInit * miFindMaxBand( iplGetCompositeClip(pGC) );
|
|
||||||
pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
|
|
||||||
pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
|
|
||||||
if(!pptFree || !pwidthFree)
|
|
||||||
{
|
|
||||||
if (pptFree) DEALLOCATE_LOCAL(pptFree);
|
|
||||||
if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
pwidth = pwidthFree;
|
|
||||||
ppt = pptFree;
|
|
||||||
n = miClipSpans( iplGetCompositeClip(pGC),
|
|
||||||
pptInit, pwidthInit, nInit,
|
|
||||||
ppt, pwidth, fSorted);
|
|
||||||
|
|
||||||
tile = pGC->pRotatedPixmap;
|
|
||||||
tileHeight = tile->drawable.height;
|
|
||||||
psrc = (unsigned short *)tile->devPrivate.ptr;
|
|
||||||
|
|
||||||
INTER_MROP_INITIALIZE(pGC->alu, pGC->planemask);
|
|
||||||
|
|
||||||
iplGetGroupWidthAndPointer (pDrawable, ngwDst, pbits)
|
|
||||||
|
|
||||||
{
|
|
||||||
while (n--)
|
|
||||||
{
|
|
||||||
x = ppt->x;
|
|
||||||
y = ppt->y;
|
|
||||||
++ppt;
|
|
||||||
w = *pwidth++;
|
|
||||||
p = pbits + (y * ngwDst) + (x >> INTER_PGSH) * INTER_PLANES;
|
|
||||||
INTER_COPY(psrc +(y % tileHeight)*INTER_PLANES,srcpix);
|
|
||||||
INTER_MROP_PREBUILD(srcpix);
|
|
||||||
|
|
||||||
if ((x & INTER_PIM) + w < INTER_PPG)
|
|
||||||
{
|
|
||||||
INTER_maskpartialbits(x, w, startmask);
|
|
||||||
INTER_MROP_PREBUILT_MASK(srcpix, p, startmask, p);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
INTER_maskbits(x, w, startmask, endmask, ngw);
|
|
||||||
if (startmask)
|
|
||||||
{
|
|
||||||
INTER_MROP_PREBUILT_MASK(srcpix, p, startmask, p);
|
|
||||||
INTER_NEXT_GROUP(p);
|
|
||||||
}
|
|
||||||
while (ngw--)
|
|
||||||
{
|
|
||||||
STORE(p);
|
|
||||||
INTER_NEXT_GROUP(p);
|
|
||||||
}
|
|
||||||
if (endmask)
|
|
||||||
{
|
|
||||||
INTER_MROP_PREBUILT_MASK(srcpix, p, endmask, p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DEALLOCATE_LOCAL(pptFree);
|
|
||||||
DEALLOCATE_LOCAL(pwidthFree);
|
|
||||||
}
|
|
||||||
@@ -1,869 +0,0 @@
|
|||||||
/* $XFree86$ */
|
|
||||||
/*
|
|
||||||
* Fill odd tiled rectangles and spans.
|
|
||||||
* no depth dependencies.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
Copyright (c) 1989 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* $XConsortium: ipltileodd.c,v 1.16 94/04/17 20:29:06 dpw Exp $ */
|
|
||||||
|
|
||||||
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
|
|
||||||
interleaved planes */
|
|
||||||
|
|
||||||
#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 "ipl.h"
|
|
||||||
|
|
||||||
#include "iplmskbits.h"
|
|
||||||
#include "iplmergerop.h"
|
|
||||||
|
|
||||||
#define LEFTSHIFT_AMT 0
|
|
||||||
|
|
||||||
#define LastTileBits {\
|
|
||||||
INTER_COPY(bits, tmp); \
|
|
||||||
if (tileEndPart) \
|
|
||||||
INTER_MSKINSM(tileEndMask, 0, pSrc, \
|
|
||||||
~0, tileEndLeftShift, pSrcLine, bits) \
|
|
||||||
else \
|
|
||||||
INTER_COPY(pSrc, bits); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define ResetTileBits {\
|
|
||||||
pSrc = pSrcLine; \
|
|
||||||
nlwSrc = widthSrc;\
|
|
||||||
if (tileEndPart) { \
|
|
||||||
if (INTER_PPG - xoff + tileEndPart <= INTER_PPG) {\
|
|
||||||
INTER_COPY(pSrc, bits); INTER_NEXT_GROUP(pSrc); \
|
|
||||||
nlwSrc--; \
|
|
||||||
} else \
|
|
||||||
INTER_MSKINSM(~0, tileEndLeftShift, tmp, \
|
|
||||||
~0, tileEndRightShift, bits, bits); \
|
|
||||||
xoff = (xoff + xoffStep) & INTER_PIM; \
|
|
||||||
leftShift = xoff << LEFTSHIFT_AMT; \
|
|
||||||
rightShift = INTER_PGSZ - leftShift; \
|
|
||||||
}\
|
|
||||||
}
|
|
||||||
|
|
||||||
#define NextTileBits {\
|
|
||||||
if (nlwSrc == 1) {\
|
|
||||||
LastTileBits\
|
|
||||||
} else { \
|
|
||||||
if (nlwSrc == 0) {\
|
|
||||||
ResetTileBits\
|
|
||||||
} \
|
|
||||||
if (nlwSrc == 1) {\
|
|
||||||
LastTileBits\
|
|
||||||
} else {\
|
|
||||||
INTER_COPY(bits, tmp); \
|
|
||||||
INTER_COPY(pSrc, bits); INTER_NEXT_GROUP(pSrc); \
|
|
||||||
}\
|
|
||||||
}\
|
|
||||||
nlwSrc--; \
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
INTER_MROP_NAME(iplFillBoxTileOdd) (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 */
|
|
||||||
INTER_DECLAREG(startmask);
|
|
||||||
INTER_DECLAREG(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;
|
|
||||||
|
|
||||||
INTER_MROP_DECLARE_REG()
|
|
||||||
|
|
||||||
INTER_DECLAREG(*pDstBase); /* pointer to start of dest */
|
|
||||||
INTER_DECLAREG(*pDstLine); /* poitner to start of dest box */
|
|
||||||
INTER_DECLAREG(*pSrcBase); /* pointer to start of source */
|
|
||||||
INTER_DECLAREG(*pSrcLine); /* pointer to start of source line */
|
|
||||||
INTER_DECLAREG(*pDst);
|
|
||||||
INTER_DECLAREG(*pSrc);
|
|
||||||
INTER_DECLAREGP(bits);
|
|
||||||
INTER_DECLAREGP(tmp);
|
|
||||||
INTER_DECLAREGP(tmp1);
|
|
||||||
register int nlwPart;
|
|
||||||
int xoffStart, xoff;
|
|
||||||
int leftShiftStart, rightShiftStart, nlwSrcStart;
|
|
||||||
INTER_DECLAREG(tileEndMask);
|
|
||||||
int tileEndLeftShift, tileEndRightShift;
|
|
||||||
int xoffStep;
|
|
||||||
int tileEndPart;
|
|
||||||
int needFirst;
|
|
||||||
unsigned short narrow[2 * INTER_PLANES];
|
|
||||||
INTER_DECLAREG(narrowMask);
|
|
||||||
int narrowShift;
|
|
||||||
Bool narrowTile;
|
|
||||||
int narrowRep;
|
|
||||||
|
|
||||||
INTER_MROP_INITIALIZE (alu, planemask)
|
|
||||||
|
|
||||||
tileHeight = tile->drawable.height;
|
|
||||||
tileWidth = tile->drawable.width;
|
|
||||||
widthSrc = tile->devKind / (INTER_PGSZB * INTER_PLANES);
|
|
||||||
narrowTile = FALSE;
|
|
||||||
|
|
||||||
if (widthSrc == 1)
|
|
||||||
{
|
|
||||||
narrowRep = INTER_PPG / tileWidth;
|
|
||||||
narrowMask = iplendpartial [tileWidth];
|
|
||||||
tileWidth *= narrowRep;
|
|
||||||
narrowShift = tileWidth;
|
|
||||||
tileWidth *= 2;
|
|
||||||
widthSrc = 2;
|
|
||||||
narrowTile = TRUE;
|
|
||||||
}
|
|
||||||
pSrcBase = (unsigned short *)tile->devPrivate.ptr;
|
|
||||||
|
|
||||||
iplGetGroupWidthAndPointer (pDrawable, widthDst, pDstBase)
|
|
||||||
|
|
||||||
tileEndPart = tileWidth & INTER_PIM;
|
|
||||||
tileEndMask = iplendpartial[tileEndPart];
|
|
||||||
tileEndLeftShift = (tileEndPart) << LEFTSHIFT_AMT;
|
|
||||||
tileEndRightShift = INTER_PGSZ - tileEndLeftShift;
|
|
||||||
xoffStep = INTER_PPG - tileEndPart;
|
|
||||||
/*
|
|
||||||
* 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);
|
|
||||||
xoffDst = pBox->x1 & INTER_PIM;
|
|
||||||
if (xoffDst + w < INTER_PPG)
|
|
||||||
{
|
|
||||||
INTER_maskpartialbits(pBox->x1, w, startmask);
|
|
||||||
endmask = 0;
|
|
||||||
nlwMiddle = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
INTER_maskbits (pBox->x1, w, startmask, endmask, nlwMiddle)
|
|
||||||
}
|
|
||||||
pDstLine = pDstBase + (pBox->y1 * widthDst) +
|
|
||||||
(pBox->x1 >> INTER_PGSH) * INTER_PLANES;
|
|
||||||
pSrcLine = pSrcBase + (srcy * widthSrc) * INTER_PLANES;
|
|
||||||
xoffSrc = srcx & INTER_PIM;
|
|
||||||
if (xoffSrc >= xoffDst)
|
|
||||||
{
|
|
||||||
xoffStart = xoffSrc - xoffDst;
|
|
||||||
needFirst = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
xoffStart = INTER_PPG - (xoffDst - xoffSrc);
|
|
||||||
needFirst = 0;
|
|
||||||
}
|
|
||||||
leftShiftStart = (xoffStart) << LEFTSHIFT_AMT;
|
|
||||||
rightShiftStart = INTER_PGSZ - leftShiftStart;
|
|
||||||
nlwSrcStart = (widthSrc - (srcx >> INTER_PGSH));
|
|
||||||
while (h--)
|
|
||||||
{
|
|
||||||
/* XXX only works when narrowShift >= INTER_PPG/2 */
|
|
||||||
if (narrowTile)
|
|
||||||
{
|
|
||||||
int tmpnarrowRep;
|
|
||||||
int shift=narrowShift/narrowRep;
|
|
||||||
INTER_ANDMSK(pSrcBase + srcy * INTER_PLANES, narrowMask, tmp);
|
|
||||||
tmpnarrowRep=narrowRep;
|
|
||||||
/* copy tile until its nearly a whole group wide */
|
|
||||||
while (--tmpnarrowRep)
|
|
||||||
INTER_MSKINSM(~0,0,tmp,~0,shift,tmp,tmp);
|
|
||||||
INTER_MSKINSM(~0, 0, tmp, ~0, narrowShift, tmp, narrow);
|
|
||||||
INTER_MSKINSM(~0, INTER_PPG - narrowShift, tmp,
|
|
||||||
~0, 2 * narrowShift - INTER_PPG, tmp,
|
|
||||||
narrow + INTER_PLANES);
|
|
||||||
pSrcLine = narrow;
|
|
||||||
}
|
|
||||||
xoff = xoffStart;
|
|
||||||
leftShift = leftShiftStart;
|
|
||||||
rightShift = rightShiftStart;
|
|
||||||
nlwSrc = nlwSrcStart;
|
|
||||||
pSrc = pSrcLine + (srcx >> INTER_PGSH) * INTER_PLANES;
|
|
||||||
pDst = pDstLine;
|
|
||||||
INTER_CLR(bits);
|
|
||||||
if (needFirst)
|
|
||||||
{
|
|
||||||
NextTileBits
|
|
||||||
}
|
|
||||||
if (startmask)
|
|
||||||
{
|
|
||||||
NextTileBits
|
|
||||||
INTER_SCRLEFT(leftShift, tmp, tmp);
|
|
||||||
if (rightShift != INTER_PGSZ)
|
|
||||||
INTER_MSKINSM(~0, 0, tmp, ~0, rightShift, bits, tmp)
|
|
||||||
INTER_MROP_MASK (tmp, pDst, startmask, pDst);
|
|
||||||
INTER_NEXT_GROUP(pDst);
|
|
||||||
}
|
|
||||||
nlw = nlwMiddle;
|
|
||||||
while (nlw)
|
|
||||||
{
|
|
||||||
{
|
|
||||||
NextTileBits
|
|
||||||
if (rightShift != INTER_PGSZ)
|
|
||||||
{
|
|
||||||
INTER_MSKINSM(~0, leftShift, tmp, ~0, rightShift, bits,
|
|
||||||
tmp1);
|
|
||||||
INTER_MROP_SOLID(tmp1, pDst, pDst);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
INTER_MROP_SOLID (tmp, pDst, pDst);
|
|
||||||
}
|
|
||||||
INTER_NEXT_GROUP(pDst);
|
|
||||||
nlw--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (endmask)
|
|
||||||
{
|
|
||||||
NextTileBits
|
|
||||||
if (rightShift == INTER_PGSZ)
|
|
||||||
INTER_CLR(bits);
|
|
||||||
INTER_MSKINSM(~0, leftShift, tmp, ~0, rightShift, bits, tmp1);
|
|
||||||
INTER_MROP_MASK(tmp1, pDst, endmask, pDst);
|
|
||||||
}
|
|
||||||
pDstLine += widthDst;
|
|
||||||
pSrcLine += widthSrc * INTER_PLANES;
|
|
||||||
if (++srcy == tileHeight)
|
|
||||||
{
|
|
||||||
srcy = 0;
|
|
||||||
pSrcLine = pSrcBase;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pBox++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
INTER_MROP_NAME(iplFillSpanTileOdd) (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 */
|
|
||||||
INTER_DECLAREG(startmask);
|
|
||||||
INTER_DECLAREG (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;
|
|
||||||
|
|
||||||
INTER_MROP_DECLARE_REG()
|
|
||||||
|
|
||||||
INTER_DECLAREG(*pDstBase); /* pointer to start of dest */
|
|
||||||
INTER_DECLAREG(*pDstLine); /* poitner to start of dest box */
|
|
||||||
INTER_DECLAREG(*pSrcBase); /* pointer to start of source */
|
|
||||||
INTER_DECLAREG(*pSrcLine); /* pointer to start of source line */
|
|
||||||
INTER_DECLAREG(*pDst);
|
|
||||||
INTER_DECLAREG(*pSrc);
|
|
||||||
INTER_DECLAREGP(bits);
|
|
||||||
INTER_DECLAREGP(tmp);
|
|
||||||
INTER_DECLAREGP(tmp1);
|
|
||||||
register int nlwPart;
|
|
||||||
int xoffStart, xoff;
|
|
||||||
int leftShiftStart, rightShiftStart, nlwSrcStart;
|
|
||||||
INTER_DECLAREG(tileEndMask);
|
|
||||||
int tileEndLeftShift, tileEndRightShift;
|
|
||||||
int xoffStep;
|
|
||||||
int tileEndPart;
|
|
||||||
int needFirst;
|
|
||||||
unsigned short narrow[2 * INTER_PLANES];
|
|
||||||
INTER_DECLAREG(narrowMask);
|
|
||||||
int narrowShift;
|
|
||||||
Bool narrowTile;
|
|
||||||
int narrowRep;
|
|
||||||
|
|
||||||
INTER_MROP_INITIALIZE (alu, planemask)
|
|
||||||
|
|
||||||
tileHeight = tile->drawable.height;
|
|
||||||
tileWidth = tile->drawable.width;
|
|
||||||
widthSrc = tile->devKind / (INTER_PGSZB * INTER_PLANES);
|
|
||||||
narrowTile = FALSE;
|
|
||||||
if (widthSrc == 1)
|
|
||||||
{
|
|
||||||
narrowRep = INTER_PPG / tileWidth;
|
|
||||||
narrowMask = iplendpartial [tileWidth];
|
|
||||||
tileWidth *= narrowRep;
|
|
||||||
narrowShift = tileWidth;
|
|
||||||
tileWidth *= 2;
|
|
||||||
widthSrc = 2;
|
|
||||||
narrowTile = TRUE;
|
|
||||||
}
|
|
||||||
pSrcBase = (unsigned short *)tile->devPrivate.ptr;
|
|
||||||
|
|
||||||
iplGetGroupWidthAndPointer (pDrawable, widthDst, pDstBase)
|
|
||||||
|
|
||||||
tileEndPart = tileWidth & INTER_PIM;
|
|
||||||
tileEndMask = iplendpartial[tileEndPart];
|
|
||||||
tileEndLeftShift = (tileEndPart) << LEFTSHIFT_AMT;
|
|
||||||
tileEndRightShift = INTER_PGSZ - tileEndLeftShift;
|
|
||||||
xoffStep = INTER_PPG - tileEndPart;
|
|
||||||
while (n--)
|
|
||||||
{
|
|
||||||
w = *pwidth++;
|
|
||||||
modulus (ppt->x - xrot, tileWidth, srcx);
|
|
||||||
modulus (ppt->y - yrot, tileHeight, srcy);
|
|
||||||
xoffDst = ppt->x & INTER_PIM;
|
|
||||||
if (xoffDst + w < INTER_PPG)
|
|
||||||
{
|
|
||||||
INTER_maskpartialbits(ppt->x, w, startmask);
|
|
||||||
endmask = 0;
|
|
||||||
nlw = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
INTER_maskbits (ppt->x, w, startmask, endmask, nlw)
|
|
||||||
}
|
|
||||||
pDstLine = pDstBase + (ppt->y * widthDst) +
|
|
||||||
(ppt->x >> INTER_PGSH) * INTER_PLANES;
|
|
||||||
pSrcLine = pSrcBase + (srcy * widthSrc) * INTER_PLANES;
|
|
||||||
xoffSrc = srcx & INTER_PIM;
|
|
||||||
if (xoffSrc >= xoffDst)
|
|
||||||
{
|
|
||||||
xoffStart = xoffSrc - xoffDst;
|
|
||||||
needFirst = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
xoffStart = INTER_PPG - (xoffDst - xoffSrc);
|
|
||||||
needFirst = 0;
|
|
||||||
}
|
|
||||||
leftShiftStart = (xoffStart) << LEFTSHIFT_AMT;
|
|
||||||
rightShiftStart = INTER_PGSZ - leftShiftStart;
|
|
||||||
nlwSrcStart = widthSrc - (srcx >> INTER_PGSH);
|
|
||||||
/* XXX only works when narrowShift >= INTER_PPG/2 */
|
|
||||||
if (narrowTile)
|
|
||||||
{
|
|
||||||
int tmpnarrowRep;
|
|
||||||
int shift=narrowShift/narrowRep;
|
|
||||||
INTER_ANDMSK(pSrcBase + srcy * INTER_PLANES, narrowMask, tmp);
|
|
||||||
tmpnarrowRep=narrowRep;
|
|
||||||
/* copy tile until its nearly a whole group wide */
|
|
||||||
while (--tmpnarrowRep)
|
|
||||||
INTER_MSKINSM(~0,0,tmp,~0,shift,tmp,tmp);
|
|
||||||
INTER_MSKINSM(~0, 0, tmp, ~0, narrowShift, tmp, narrow);
|
|
||||||
INTER_MSKINSM(~0, INTER_PPG - narrowShift, tmp,
|
|
||||||
~0, 2 * narrowShift - INTER_PPG, tmp,
|
|
||||||
narrow + INTER_PLANES);
|
|
||||||
pSrcLine = narrow;
|
|
||||||
}
|
|
||||||
xoff = xoffStart;
|
|
||||||
leftShift = leftShiftStart;
|
|
||||||
rightShift = rightShiftStart;
|
|
||||||
nlwSrc = nlwSrcStart;
|
|
||||||
pSrc = pSrcLine + (srcx >> INTER_PGSH) * INTER_PLANES;
|
|
||||||
pDst = pDstLine;
|
|
||||||
INTER_CLR(bits);
|
|
||||||
if (needFirst)
|
|
||||||
{
|
|
||||||
NextTileBits
|
|
||||||
}
|
|
||||||
if (startmask)
|
|
||||||
{
|
|
||||||
NextTileBits
|
|
||||||
INTER_SCRLEFT(leftShift, tmp, tmp);
|
|
||||||
if (rightShift != INTER_PGSZ)
|
|
||||||
INTER_MSKINSM(~0, 0, tmp, ~0, rightShift, bits, tmp);
|
|
||||||
INTER_MROP_MASK (tmp, pDst, startmask, pDst);
|
|
||||||
INTER_NEXT_GROUP(pDst);
|
|
||||||
}
|
|
||||||
while (nlw)
|
|
||||||
{
|
|
||||||
{
|
|
||||||
NextTileBits
|
|
||||||
if (rightShift != INTER_PGSZ)
|
|
||||||
{
|
|
||||||
INTER_MSKINSM(~0, leftShift, tmp, ~0, rightShift, bits,
|
|
||||||
tmp1);
|
|
||||||
INTER_MROP_SOLID(tmp1, pDst, pDst);
|
|
||||||
INTER_NEXT_GROUP(pDst);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
INTER_MROP_SOLID (tmp, pDst, pDst);
|
|
||||||
INTER_NEXT_GROUP(pDst);
|
|
||||||
}
|
|
||||||
nlw--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (endmask)
|
|
||||||
{
|
|
||||||
NextTileBits
|
|
||||||
if (rightShift == INTER_PGSZ)
|
|
||||||
INTER_CLR(bits);
|
|
||||||
|
|
||||||
INTER_MSKINSM(~0, leftShift, tmp, ~0, rightShift, bits, tmp1);
|
|
||||||
INTER_MROP_MASK(tmp1, pDst, endmask, pDst);
|
|
||||||
}
|
|
||||||
ppt++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# include "fastblt.h"
|
|
||||||
|
|
||||||
#define IncSrcPtr INTER_NEXT_GROUP(psrc); if (!--srcRemaining) { srcRemaining = widthSrc; psrc = psrcStart; }
|
|
||||||
|
|
||||||
void
|
|
||||||
INTER_MROP_NAME(iplFillBoxTile32s) (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 */
|
|
||||||
INTER_DECLAREG(startmask);
|
|
||||||
INTER_DECLAREG(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;
|
|
||||||
|
|
||||||
INTER_MROP_DECLARE_REG()
|
|
||||||
|
|
||||||
INTER_DECLAREG(*pdstBase); /* pointer to start of dest */
|
|
||||||
INTER_DECLAREG(*pdstLine); /* poitner to start of dest box */
|
|
||||||
INTER_DECLAREG(*psrcBase); /* pointer to start of source */
|
|
||||||
INTER_DECLAREG(*psrcLine); /* pointer to fetch point of source */
|
|
||||||
INTER_DECLAREG(*psrcStart); /* pointer to start of source line */
|
|
||||||
INTER_DECLAREG(*pdst);
|
|
||||||
INTER_DECLAREG(*psrc);
|
|
||||||
INTER_DECLAREGP(bits);
|
|
||||||
INTER_DECLAREGP(bits1);
|
|
||||||
register int nlTemp;
|
|
||||||
|
|
||||||
INTER_MROP_INITIALIZE (alu, planemask)
|
|
||||||
|
|
||||||
psrcBase = (unsigned short *)tile->devPrivate.ptr;
|
|
||||||
tileHeight = tile->drawable.height;
|
|
||||||
tileWidth = tile->drawable.width;
|
|
||||||
widthSrc = tile->devKind / (INTER_PGSZB * INTER_PLANES);
|
|
||||||
|
|
||||||
iplGetGroupWidthAndPointer (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);
|
|
||||||
xoffSrc = srcx & INTER_PIM;
|
|
||||||
srcStart = srcx >> INTER_PGSH;
|
|
||||||
psrcStart = psrcBase + (srcy * widthSrc) * INTER_PLANES;
|
|
||||||
psrcLine = psrcStart + srcStart * INTER_PLANES;
|
|
||||||
|
|
||||||
/* set up dest */
|
|
||||||
xoffDst = pBox->x1 & INTER_PIM;
|
|
||||||
pdstLine = pdstBase + (pBox->y1 * widthDst) +
|
|
||||||
(pBox->x1 >> INTER_PGSH) * INTER_PLANES;
|
|
||||||
/* set up masks */
|
|
||||||
if (xoffDst + w < INTER_PPG)
|
|
||||||
{
|
|
||||||
INTER_maskpartialbits(pBox->x1, w, startmask);
|
|
||||||
endmask = 0;
|
|
||||||
nlMiddle = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
INTER_maskbits (pBox->x1, w, startmask, endmask, nlMiddle)
|
|
||||||
}
|
|
||||||
if (xoffSrc == xoffDst)
|
|
||||||
{
|
|
||||||
while (h--)
|
|
||||||
{
|
|
||||||
psrc = psrcLine;
|
|
||||||
pdst = pdstLine;
|
|
||||||
srcRemaining = widthSrc - srcStart;
|
|
||||||
if (startmask)
|
|
||||||
{
|
|
||||||
INTER_MROP_MASK (psrc, pdst, startmask, pdst);
|
|
||||||
INTER_NEXT_GROUP(pdst);
|
|
||||||
IncSrcPtr
|
|
||||||
}
|
|
||||||
nlTemp = nlMiddle;
|
|
||||||
while (nlTemp)
|
|
||||||
{
|
|
||||||
nl = nlTemp;
|
|
||||||
if (nl > srcRemaining)
|
|
||||||
nl = srcRemaining;
|
|
||||||
|
|
||||||
nlTemp -= nl;
|
|
||||||
srcRemaining -= nl;
|
|
||||||
|
|
||||||
while (nl--) {
|
|
||||||
INTER_MROP_SOLID (psrc, pdst, pdst);
|
|
||||||
INTER_NEXT_GROUP(pdst); INTER_NEXT_GROUP(psrc);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!srcRemaining)
|
|
||||||
{
|
|
||||||
srcRemaining = widthSrc;
|
|
||||||
psrc = psrcStart;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (endmask)
|
|
||||||
{
|
|
||||||
INTER_MROP_MASK (psrc, pdst, endmask, pdst);
|
|
||||||
}
|
|
||||||
pdstLine += widthDst;
|
|
||||||
psrcLine += widthSrc * INTER_PLANES;
|
|
||||||
psrcStart += widthSrc * INTER_PLANES;
|
|
||||||
if (++srcy == tileHeight)
|
|
||||||
{
|
|
||||||
psrcStart = psrcBase;
|
|
||||||
psrcLine = psrcStart + srcStart * INTER_PLANES;
|
|
||||||
srcy = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (xoffSrc > xoffDst)
|
|
||||||
{
|
|
||||||
leftShift = (xoffSrc - xoffDst) << LEFTSHIFT_AMT;
|
|
||||||
rightShift = INTER_PGSZ - leftShift;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
rightShift = (xoffDst - xoffSrc) << LEFTSHIFT_AMT;
|
|
||||||
leftShift = INTER_PGSZ - rightShift;
|
|
||||||
}
|
|
||||||
while (h--)
|
|
||||||
{
|
|
||||||
psrc = psrcLine;
|
|
||||||
pdst = pdstLine;
|
|
||||||
INTER_CLR(bits);
|
|
||||||
srcRemaining = widthSrc - srcStart;
|
|
||||||
if (xoffSrc > xoffDst)
|
|
||||||
{
|
|
||||||
INTER_COPY(psrc, bits);
|
|
||||||
IncSrcPtr
|
|
||||||
}
|
|
||||||
if (startmask)
|
|
||||||
{
|
|
||||||
INTER_SCRLEFT(leftShift, bits, bits1);
|
|
||||||
INTER_COPY(psrc, bits);
|
|
||||||
IncSrcPtr
|
|
||||||
INTER_MSKINSM(~0, 0, bits1, ~0, rightShift, bits, bits1);
|
|
||||||
INTER_MROP_MASK(bits1, pdst, startmask, pdst);
|
|
||||||
INTER_NEXT_GROUP(pdst);
|
|
||||||
}
|
|
||||||
nlTemp = nlMiddle;
|
|
||||||
while (nlTemp)
|
|
||||||
{
|
|
||||||
nl = nlTemp;
|
|
||||||
if (nl > srcRemaining)
|
|
||||||
nl = srcRemaining;
|
|
||||||
|
|
||||||
nlTemp -= nl;
|
|
||||||
srcRemaining -= nl;
|
|
||||||
|
|
||||||
while (nl--) {
|
|
||||||
INTER_SCRLEFT(leftShift, bits, bits1);
|
|
||||||
INTER_COPY(psrc, bits); INTER_NEXT_GROUP(psrc);
|
|
||||||
INTER_MSKINSM(~0, 0, bits1, ~0, rightShift, bits, bits1);
|
|
||||||
INTER_MROP_SOLID (bits1, pdst, pdst);
|
|
||||||
INTER_NEXT_GROUP(pdst);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!srcRemaining)
|
|
||||||
{
|
|
||||||
srcRemaining = widthSrc;
|
|
||||||
psrc = psrcStart;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (endmask)
|
|
||||||
{
|
|
||||||
INTER_SCRLEFT(leftShift, bits, bits1);
|
|
||||||
if (endmask << rightShift)
|
|
||||||
{
|
|
||||||
INTER_COPY(psrc, bits);
|
|
||||||
INTER_MSKINSM(~0, 0, bits1, ~0, rightShift, bits, bits1);
|
|
||||||
}
|
|
||||||
INTER_MROP_MASK (bits1, pdst, endmask, pdst);
|
|
||||||
}
|
|
||||||
pdstLine += widthDst;
|
|
||||||
psrcLine += widthSrc * INTER_PLANES;
|
|
||||||
psrcStart += widthSrc * INTER_PLANES;
|
|
||||||
if (++srcy == tileHeight)
|
|
||||||
{
|
|
||||||
psrcStart = psrcBase;
|
|
||||||
psrcLine = psrcStart + srcStart * INTER_PLANES;
|
|
||||||
srcy = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pBox++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
INTER_MROP_NAME(iplFillSpanTile32s) (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 */
|
|
||||||
INTER_DECLAREG(startmask);
|
|
||||||
INTER_DECLAREG(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;
|
|
||||||
|
|
||||||
INTER_MROP_DECLARE_REG()
|
|
||||||
|
|
||||||
INTER_DECLAREG(*pdstBase); /* pointer to start of dest */
|
|
||||||
INTER_DECLAREG(*pdstLine); /* poitner to start of dest box */
|
|
||||||
INTER_DECLAREG(*psrcBase); /* pointer to start of source */
|
|
||||||
INTER_DECLAREG(*psrcLine); /* pointer to fetch point of source */
|
|
||||||
INTER_DECLAREG(*psrcStart); /* pointer to start of source line */
|
|
||||||
INTER_DECLAREG(*pdst);
|
|
||||||
INTER_DECLAREG(*psrc);
|
|
||||||
INTER_DECLAREGP(bits);
|
|
||||||
INTER_DECLAREGP(bits1);
|
|
||||||
register int nlTemp;
|
|
||||||
|
|
||||||
INTER_MROP_INITIALIZE (alu, planemask)
|
|
||||||
|
|
||||||
psrcBase = (unsigned short *)tile->devPrivate.ptr;
|
|
||||||
tileHeight = tile->drawable.height;
|
|
||||||
tileWidth = tile->drawable.width;
|
|
||||||
widthSrc = tile->devKind / (INTER_PGSZB * INTER_PLANES);
|
|
||||||
|
|
||||||
iplGetGroupWidthAndPointer (pDrawable, widthDst, pdstBase)
|
|
||||||
|
|
||||||
while (n--)
|
|
||||||
{
|
|
||||||
w = *pwidth++;
|
|
||||||
|
|
||||||
/* set up source */
|
|
||||||
modulus (ppt->x - xrot, tileWidth, srcx);
|
|
||||||
modulus (ppt->y - yrot, tileHeight, srcy);
|
|
||||||
xoffSrc = srcx & INTER_PIM;
|
|
||||||
srcStart = srcx >> INTER_PGSH;
|
|
||||||
psrcStart = psrcBase + (srcy * widthSrc) * INTER_PLANES;
|
|
||||||
psrcLine = psrcStart + srcStart * INTER_PLANES;
|
|
||||||
|
|
||||||
/* set up dest */
|
|
||||||
xoffDst = ppt->x & INTER_PIM;
|
|
||||||
pdstLine = pdstBase + (ppt->y * widthDst) +
|
|
||||||
(ppt->x >> INTER_PGSH) * INTER_PLANES;
|
|
||||||
/* set up masks */
|
|
||||||
if (xoffDst + w < INTER_PPG)
|
|
||||||
{
|
|
||||||
INTER_maskpartialbits(ppt->x, w, startmask);
|
|
||||||
endmask = 0;
|
|
||||||
nlMiddle = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
INTER_maskbits (ppt->x, w, startmask, endmask, nlMiddle)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (xoffSrc == xoffDst)
|
|
||||||
{
|
|
||||||
psrc = psrcLine;
|
|
||||||
pdst = pdstLine;
|
|
||||||
srcRemaining = widthSrc - srcStart;
|
|
||||||
if (startmask)
|
|
||||||
{
|
|
||||||
INTER_MROP_MASK (psrc, pdst, startmask, pdst);
|
|
||||||
INTER_NEXT_GROUP(pdst);
|
|
||||||
IncSrcPtr
|
|
||||||
}
|
|
||||||
nlTemp = nlMiddle;
|
|
||||||
while (nlTemp)
|
|
||||||
{
|
|
||||||
nl = nlTemp;
|
|
||||||
if (nl > srcRemaining)
|
|
||||||
nl = srcRemaining;
|
|
||||||
|
|
||||||
nlTemp -= nl;
|
|
||||||
srcRemaining -= nl;
|
|
||||||
|
|
||||||
while (nl--) {
|
|
||||||
INTER_MROP_SOLID (psrc, pdst, pdst);
|
|
||||||
INTER_NEXT_GROUP(pdst); INTER_NEXT_GROUP(psrc);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!srcRemaining)
|
|
||||||
{
|
|
||||||
srcRemaining = widthSrc;
|
|
||||||
psrc = psrcStart;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (endmask)
|
|
||||||
{
|
|
||||||
INTER_MROP_MASK (psrc, pdst, endmask, pdst);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (xoffSrc > xoffDst)
|
|
||||||
{
|
|
||||||
leftShift = (xoffSrc - xoffDst) << LEFTSHIFT_AMT;
|
|
||||||
rightShift = INTER_PGSZ - leftShift;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
rightShift = (xoffDst - xoffSrc) << LEFTSHIFT_AMT;
|
|
||||||
leftShift = INTER_PGSZ - rightShift;
|
|
||||||
}
|
|
||||||
psrc = psrcLine;
|
|
||||||
pdst = pdstLine;
|
|
||||||
INTER_CLR(bits);
|
|
||||||
srcRemaining = widthSrc - srcStart;
|
|
||||||
if (xoffSrc > xoffDst)
|
|
||||||
{
|
|
||||||
INTER_COPY(psrc, bits);
|
|
||||||
IncSrcPtr
|
|
||||||
}
|
|
||||||
if (startmask)
|
|
||||||
{
|
|
||||||
INTER_SCRLEFT(leftShift, bits, bits1);
|
|
||||||
INTER_COPY(psrc, bits);
|
|
||||||
IncSrcPtr
|
|
||||||
INTER_MSKINSM(~0, 0, bits1, ~0, rightShift, bits, bits1);
|
|
||||||
INTER_MROP_MASK(bits1, pdst, startmask, pdst);
|
|
||||||
INTER_NEXT_GROUP(pdst);
|
|
||||||
}
|
|
||||||
nlTemp = nlMiddle;
|
|
||||||
while (nlTemp)
|
|
||||||
{
|
|
||||||
nl = nlTemp;
|
|
||||||
if (nl > srcRemaining)
|
|
||||||
nl = srcRemaining;
|
|
||||||
|
|
||||||
nlTemp -= nl;
|
|
||||||
srcRemaining -= nl;
|
|
||||||
|
|
||||||
while (nl--) {
|
|
||||||
INTER_SCRLEFT(leftShift, bits, bits1);
|
|
||||||
INTER_COPY(psrc, bits); INTER_NEXT_GROUP(psrc);
|
|
||||||
INTER_MSKINSM(~0, 0, bits1, ~0, rightShift, bits, bits1);
|
|
||||||
INTER_MROP_SOLID(bits1, pdst, pdst);
|
|
||||||
INTER_NEXT_GROUP(pdst);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!srcRemaining)
|
|
||||||
{
|
|
||||||
srcRemaining = widthSrc;
|
|
||||||
psrc = psrcStart;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (endmask)
|
|
||||||
{
|
|
||||||
INTER_SCRLEFT(leftShift, bits, bits1);
|
|
||||||
if (endmask << rightShift)
|
|
||||||
{
|
|
||||||
INTER_COPY(psrc, bits);
|
|
||||||
INTER_MSKINSM(~0, 0, bits1, ~0, rightShift, bits, bits1);
|
|
||||||
}
|
|
||||||
INTER_MROP_MASK (bits1, pdst, endmask, pdst);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ppt++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,343 +0,0 @@
|
|||||||
/* $XFree86: xc/programs/Xserver/iplan2p4/iplwindow.c,v 3.0tsi Exp $ */
|
|
||||||
/* $XConsortium: iplwindow.c,v 5.22 94/04/17 20:29:07 dpw Exp $ */
|
|
||||||
/***********************************************************
|
|
||||||
|
|
||||||
Copyright (c) 1987 X Consortium
|
|
||||||
|
|
||||||
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
|
|
||||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
******************************************************************/
|
|
||||||
|
|
||||||
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
|
|
||||||
interleaved planes */
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
|
||||||
#include <dix-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include "scrnintstr.h"
|
|
||||||
#include "windowstr.h"
|
|
||||||
#include "ipl.h"
|
|
||||||
#include "mistruct.h"
|
|
||||||
#include "regionstr.h"
|
|
||||||
#include "iplmskbits.h"
|
|
||||||
|
|
||||||
extern WindowPtr *WindowTable;
|
|
||||||
|
|
||||||
Bool
|
|
||||||
iplCreateWindow(pWin)
|
|
||||||
WindowPtr pWin;
|
|
||||||
{
|
|
||||||
iplPrivWin *pPrivWin;
|
|
||||||
|
|
||||||
pPrivWin = iplGetWindowPrivate(pWin);
|
|
||||||
pPrivWin->pRotatedBorder = NullPixmap;
|
|
||||||
pPrivWin->pRotatedBackground = NullPixmap;
|
|
||||||
pPrivWin->fastBackground = FALSE;
|
|
||||||
pPrivWin->fastBorder = FALSE;
|
|
||||||
pPrivWin->oldRotate.x = 0;
|
|
||||||
pPrivWin->oldRotate.y = 0;
|
|
||||||
|
|
||||||
#ifdef PIXMAP_PER_WINDOW
|
|
||||||
/* Setup pointer to Screen pixmap */
|
|
||||||
pWin->devPrivates[frameWindowPrivateIndex].ptr =
|
|
||||||
(pointer) iplGetScreenPixmap(pWin->drawable.pScreen);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool
|
|
||||||
iplDestroyWindow(pWin)
|
|
||||||
WindowPtr pWin;
|
|
||||||
{
|
|
||||||
iplPrivWin *pPrivWin;
|
|
||||||
|
|
||||||
pPrivWin = iplGetWindowPrivate(pWin);
|
|
||||||
|
|
||||||
if (pPrivWin->pRotatedBorder)
|
|
||||||
(*pWin->drawable.pScreen->DestroyPixmap)(pPrivWin->pRotatedBorder);
|
|
||||||
if (pPrivWin->pRotatedBackground)
|
|
||||||
(*pWin->drawable.pScreen->DestroyPixmap)(pPrivWin->pRotatedBackground);
|
|
||||||
return(TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*ARGSUSED*/
|
|
||||||
Bool
|
|
||||||
iplMapWindow(pWindow)
|
|
||||||
WindowPtr pWindow;
|
|
||||||
{
|
|
||||||
return(TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (x, y) is the upper left corner of the window on the screen
|
|
||||||
do we really need to pass this? (is it a;ready in pWin->absCorner?)
|
|
||||||
we only do the rotation for pixmaps that are 32 bits wide (padded
|
|
||||||
or otherwise.)
|
|
||||||
iplChangeWindowAttributes() has already put a copy of the pixmap
|
|
||||||
in pPrivWin->pRotated*
|
|
||||||
*/
|
|
||||||
/*ARGSUSED*/
|
|
||||||
Bool
|
|
||||||
iplPositionWindow(pWin, x, y)
|
|
||||||
WindowPtr pWin;
|
|
||||||
int x, y;
|
|
||||||
{
|
|
||||||
iplPrivWin *pPrivWin;
|
|
||||||
int setxy = 0;
|
|
||||||
|
|
||||||
pPrivWin = iplGetWindowPrivate(pWin);
|
|
||||||
if (pWin->backgroundState == BackgroundPixmap && pPrivWin->fastBackground)
|
|
||||||
{
|
|
||||||
iplXRotatePixmap(pPrivWin->pRotatedBackground,
|
|
||||||
pWin->drawable.x - pPrivWin->oldRotate.x);
|
|
||||||
iplYRotatePixmap(pPrivWin->pRotatedBackground,
|
|
||||||
pWin->drawable.y - pPrivWin->oldRotate.y);
|
|
||||||
setxy = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pWin->borderIsPixel && pPrivWin->fastBorder)
|
|
||||||
{
|
|
||||||
while (pWin->backgroundState == ParentRelative)
|
|
||||||
pWin = pWin->parent;
|
|
||||||
iplXRotatePixmap(pPrivWin->pRotatedBorder,
|
|
||||||
pWin->drawable.x - pPrivWin->oldRotate.x);
|
|
||||||
iplYRotatePixmap(pPrivWin->pRotatedBorder,
|
|
||||||
pWin->drawable.y - pPrivWin->oldRotate.y);
|
|
||||||
setxy = 1;
|
|
||||||
}
|
|
||||||
if (setxy)
|
|
||||||
{
|
|
||||||
pPrivWin->oldRotate.x = pWin->drawable.x;
|
|
||||||
pPrivWin->oldRotate.y = pWin->drawable.y;
|
|
||||||
}
|
|
||||||
return (TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*ARGSUSED*/
|
|
||||||
Bool
|
|
||||||
iplUnmapWindow(pWindow)
|
|
||||||
WindowPtr pWindow;
|
|
||||||
{
|
|
||||||
return (TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* UNCLEAN!
|
|
||||||
this code calls the bitblt helper code directly.
|
|
||||||
|
|
||||||
iplCopyWindow copies only the parts of the destination that are
|
|
||||||
visible in the source.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
iplCopyWindow(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 )ALLOCATE_LOCAL(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;
|
|
||||||
}
|
|
||||||
|
|
||||||
iplDoBitbltCopy((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
|
|
||||||
GXcopy, &rgnDst, pptSrc, ~0L);
|
|
||||||
DEALLOCATE_LOCAL(pptSrc);
|
|
||||||
REGION_UNINIT(pWin->drawable.pScreen, &rgnDst);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* swap in correct PaintWindow* routine. If we can use a fast output
|
|
||||||
routine (i.e. the pixmap is paddable to 32 bits), also pre-rotate a copy
|
|
||||||
of it in devPrivates[iplWindowPrivateIndex].ptr.
|
|
||||||
*/
|
|
||||||
Bool
|
|
||||||
iplChangeWindowAttributes(pWin, mask)
|
|
||||||
WindowPtr pWin;
|
|
||||||
unsigned long mask;
|
|
||||||
{
|
|
||||||
register unsigned long index;
|
|
||||||
register iplPrivWin *pPrivWin;
|
|
||||||
int width;
|
|
||||||
WindowPtr pBgWin;
|
|
||||||
|
|
||||||
pPrivWin = iplGetWindowPrivate(pWin);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* When background state changes from ParentRelative and
|
|
||||||
* we had previously rotated the fast border pixmap to match
|
|
||||||
* the parent relative origin, rerotate to match window
|
|
||||||
*/
|
|
||||||
if (mask & (CWBackPixmap | CWBackPixel) &&
|
|
||||||
pWin->backgroundState != ParentRelative &&
|
|
||||||
pPrivWin->fastBorder &&
|
|
||||||
(pPrivWin->oldRotate.x != pWin->drawable.x ||
|
|
||||||
pPrivWin->oldRotate.y != pWin->drawable.y))
|
|
||||||
{
|
|
||||||
iplXRotatePixmap(pPrivWin->pRotatedBorder,
|
|
||||||
pWin->drawable.x - pPrivWin->oldRotate.x);
|
|
||||||
iplYRotatePixmap(pPrivWin->pRotatedBorder,
|
|
||||||
pWin->drawable.y - pPrivWin->oldRotate.y);
|
|
||||||
pPrivWin->oldRotate.x = pWin->drawable.x;
|
|
||||||
pPrivWin->oldRotate.y = pWin->drawable.y;
|
|
||||||
}
|
|
||||||
while(mask)
|
|
||||||
{
|
|
||||||
index = lowbit (mask);
|
|
||||||
mask &= ~index;
|
|
||||||
switch(index)
|
|
||||||
{
|
|
||||||
case CWBackPixmap:
|
|
||||||
if (pWin->backgroundState == None)
|
|
||||||
{
|
|
||||||
pPrivWin->fastBackground = FALSE;
|
|
||||||
}
|
|
||||||
else if (pWin->backgroundState == ParentRelative)
|
|
||||||
{
|
|
||||||
pPrivWin->fastBackground = FALSE;
|
|
||||||
/* Rotate border to match parent origin */
|
|
||||||
if (pPrivWin->pRotatedBorder) {
|
|
||||||
for (pBgWin = pWin->parent;
|
|
||||||
pBgWin->backgroundState == ParentRelative;
|
|
||||||
pBgWin = pBgWin->parent);
|
|
||||||
iplXRotatePixmap(pPrivWin->pRotatedBorder,
|
|
||||||
pBgWin->drawable.x - pPrivWin->oldRotate.x);
|
|
||||||
iplYRotatePixmap(pPrivWin->pRotatedBorder,
|
|
||||||
pBgWin->drawable.y - pPrivWin->oldRotate.y);
|
|
||||||
pPrivWin->oldRotate.x = pBgWin->drawable.x;
|
|
||||||
pPrivWin->oldRotate.y = pBgWin->drawable.y;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (((width = (pWin->background.pixmap->drawable.width))
|
|
||||||
<= INTER_PGSZ) && !(width & (width - 1)))
|
|
||||||
{
|
|
||||||
iplCopyRotatePixmap(pWin->background.pixmap,
|
|
||||||
&pPrivWin->pRotatedBackground,
|
|
||||||
pWin->drawable.x,
|
|
||||||
pWin->drawable.y);
|
|
||||||
if (pPrivWin->pRotatedBackground)
|
|
||||||
{
|
|
||||||
pPrivWin->fastBackground = TRUE;
|
|
||||||
pPrivWin->oldRotate.x = pWin->drawable.x;
|
|
||||||
pPrivWin->oldRotate.y = pWin->drawable.y;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pPrivWin->fastBackground = FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pPrivWin->fastBackground = FALSE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CWBackPixel:
|
|
||||||
pPrivWin->fastBackground = FALSE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CWBorderPixmap:
|
|
||||||
if (((width = (pWin->border.pixmap->drawable.width)) <= INTER_PGSZ) &&
|
|
||||||
!(width & (width - 1)))
|
|
||||||
{
|
|
||||||
for (pBgWin = pWin;
|
|
||||||
pBgWin->backgroundState == ParentRelative;
|
|
||||||
pBgWin = pBgWin->parent);
|
|
||||||
iplCopyRotatePixmap(pWin->border.pixmap,
|
|
||||||
&pPrivWin->pRotatedBorder,
|
|
||||||
pBgWin->drawable.x,
|
|
||||||
pBgWin->drawable.y);
|
|
||||||
if (pPrivWin->pRotatedBorder)
|
|
||||||
{
|
|
||||||
pPrivWin->fastBorder = TRUE;
|
|
||||||
pPrivWin->oldRotate.x = pBgWin->drawable.x;
|
|
||||||
pPrivWin->oldRotate.y = pBgWin->drawable.y;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pPrivWin->fastBorder = FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pPrivWin->fastBorder = FALSE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case CWBorderPixel:
|
|
||||||
pPrivWin->fastBorder = FALSE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return (TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user