1
/* $XFree86: xc/programs/Xserver/iplan2p4/iplpolypnt.c,v 3.0 1996/08/18 01:55:02 dawes Exp $ */
2
/************************************************************
4
Copyright (c) 1989 X Consortium
6
Permission is hereby granted, free of charge, to any person obtaining a copy
7
of this software and associated documentation files (the "Software"), to deal
8
in the Software without restriction, including without limitation the rights
9
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
copies of the Software, and to permit persons to whom the Software is
11
furnished to do so, subject to the following conditions:
13
The above copyright notice and this permission notice shall be included in
14
all copies or substantial portions of the Software.
16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
Except as contained in this notice, the name of the X Consortium shall not be
24
used in advertising or otherwise to promote the sale, use or other dealings
25
in this Software without prior written authorization from the X Consortium.
27
********************************************************/
29
/* $XConsortium: iplpolypnt.c,v 5.17 94/04/17 20:28:57 dpw Exp $ */
31
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
34
#ifdef HAVE_DIX_CONFIG_H
35
#include <dix-config.h>
40
#include "windowstr.h"
41
#include "pixmapstr.h"
42
#include "regionstr.h"
43
#include "scrnintstr.h"
45
#include "iplmskbits.h"
47
#define isClipped(c,ul,lr) ((((c) - (ul)) | ((lr) - (c))) & ClipMask)
49
/* WARNING: pbox contains two shorts. This code assumes they are packed
50
* and can be referenced together as an INT32.
53
#define PointLoop(fill) { \
54
for (nbox = REGION_NUM_RECTS(cclip), pbox = REGION_RECTS(cclip); \
58
c1 = *((INT32 *) &pbox->x1) - off; \
59
c2 = *((INT32 *) &pbox->x2) - off - 0x00010001; \
60
for (ppt = (INT32 *) pptInit, i = npt; --i >= 0;) \
63
if (!isClipped(pt,c1,c2)) { \
71
iplPolyPoint(pDrawable, pGC, mode, npt, pptInit)
72
DrawablePtr pDrawable;
79
register INT32 c1, c2;
80
register unsigned long ClipMask = 0x80008000;
81
INTER_DECLAREG(*addrg);
84
INTER_DECLAREG(*addrgt);
90
INTER_DECLARERRAX(and);
91
INTER_DECLARERRAX(xor);
97
devPriv =iplGetGCPrivate(pGC);
101
cclip = pGC->pCompositeClip;
104
if ((mode == CoordModePrevious) && (npt > 1))
106
for (pptPrev = pptInit + 1, i = npt - 1; --i >= 0; pptPrev++)
108
pptPrev->x += (pptPrev-1)->x;
109
pptPrev->y += (pptPrev-1)->y;
112
off = *((int *) &pDrawable->x);
113
off -= (off & 0x8000) << 1;
114
iplGetGroupWidthAndPointer(pDrawable, ngwidth, addrg);
115
addrg = addrg + pDrawable->y * ngwidth +
116
(pDrawable->x >> INTER_PGSH) * INTER_PLANES;
117
xoffset = pDrawable->x & INTER_PIM;
118
PointLoop( addrgt = addrg + intToY(pt) * ngwidth
119
+ ((intToX(pt) + xoffset) >> INTER_PGSH) * INTER_PLANES;
120
INTER_DoMaskRRop(addrgt, and, xor,
121
iplmask[(intToX(pt) + xoffset) & INTER_PIM], addrgt);