1
/* $XFree86: xc/programs/Xserver/iplan2p4/iplply1rct.c,v 3.0 1996/08/18 01:55:00 dawes Exp $ */
3
* $XConsortium: iplply1rct.c,v 1.14 94/04/17 20:28:56 dpw Exp $
5
Copyright (c) 1990 X Consortium
7
Permission is hereby granted, free of charge, to any person obtaining a copy
8
of this software and associated documentation files (the "Software"), to deal
9
in the Software without restriction, including without limitation the rights
10
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
copies of the Software, and to permit persons to whom the Software is
12
furnished to do so, subject to the following conditions:
14
The above copyright notice and this permission notice shall be included in
15
all copies or substantial portions of the Software.
17
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
Except as contained in this notice, the name of the X Consortium shall not be
25
used in advertising or otherwise to promote the sale, use or other dealings
26
in this Software without prior written authorization from the X Consortium.
28
* Author: Keith Packard, MIT X Consortium
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>
41
#include "windowstr.h"
42
#include "pixmapstr.h"
43
#include "regionstr.h"
44
#include "scrnintstr.h"
50
#include "iplmskbits.h"
53
INTER_RROP_NAME(iplFillPoly1Rect) (pDrawable, pGC, shape, mode, count, ptsIn)
54
DrawablePtr pDrawable;
61
unsigned short *addrl, *addr;
64
register int vertex1, vertex2;
69
int *vertex1p, *vertex2p;
85
if (mode == CoordModePrevious)
87
miFillPolygon (pDrawable, pGC, shape, mode, count, ptsIn);
91
devPriv = iplGetGCPrivate(pGC);
93
if (REGION_NUM_RECTS(pGC->pCompositeClip) != 1)
95
miFillPolygon (pDrawable, pGC, shape, mode, count, ptsIn);
99
origin = *((int *) &pDrawable->x);
100
origin -= (origin & 0x8000) << 1;
101
extents = &pGC->pCompositeClip->extents;
102
INTER_RROP_FETCH_GCPRIV(devPriv);
103
vertex1 = *((int *) &extents->x1) - origin;
104
vertex2 = *((int *) &extents->x2) - origin - 0x00010001;
108
vertex2p = (int *) ptsIn;
109
endp = vertex2p + count;
115
clip |= (c - vertex1) | (vertex2 - c);
136
clip |= (c - vertex1) | (vertex2 - c);
153
dx2 = dx1 = (c - x1) >> 31;
156
if ((c - x1) >> 31 != dx1)
174
if (clip & 0x80008000)
176
miFillPolygon (pDrawable, pGC, shape, mode, vertex2p - (int *) ptsIn, ptsIn);
180
#define AddrYPlus(a,y) ((a) + (y) * ngwidth)
182
iplGetGroupWidthAndPointer(pDrawable, ngwidth, addrl);
183
addrl = AddrYPlus(addrl,y + pDrawable->y);
184
origin = intToX(origin);
186
vertex2 = vertex1 = *vertex2p++;
187
if (vertex2p == endp)
188
vertex2p = (int *) ptsIn;
189
#define Setup(c,x,vertex,dx,dy,e,sign,step) {\
190
x = intToX(vertex); \
191
if (dy = intToY(c) - y) { \
192
dx = intToX(c) - x; \
209
step = - (dx / dy); \
218
#define Step(x,dx,dy,e,sign,step) {\
228
if (y == intToY(vertex1))
232
if (vertex1p == (int *) ptsIn)
235
Setup (c,x1,vertex1,dx1,dy1,e1,sign1,step1)
236
} while (y >= intToY(vertex1));
241
Step(x1,dx1,dy1,e1,sign1,step1)
242
h = intToY(vertex1) - y;
244
if (y == intToY(vertex2))
249
if (vertex2p == endp)
250
vertex2p = (int *) ptsIn;
251
Setup (c,x2,vertex2,dx2,dy2,e2,sign2,step2)
252
} while (y >= intToY(vertex2));
258
Step(x2,dx2,dy2,e2,sign2,step2)
259
if ((c = (intToY(vertex2) - y)) < h)
262
/* fill spans for this segment */
278
addr = addrl + (l >> INTER_PGSH) * INTER_PLANES;
279
if (c + nmiddle < INTER_PPG)
281
mask = (bits >> c) ^ (bits >> (c+nmiddle));
282
INTER_RROP_SOLID_MASK(addr,mask);
289
INTER_RROP_SOLID_MASK(addr,mask);
290
nmiddle += c - INTER_PPG;
291
INTER_NEXT_GROUP(addr);
293
nmiddle >>= INTER_PGSH;
294
while (--nmiddle >= 0) {
295
INTER_RROP_SOLID(addr); INTER_NEXT_GROUP(addr);
297
if (mask = ~(bits >> (r & INTER_PIM)))
298
INTER_RROP_SOLID_MASK(addr,mask);
302
addrl = AddrYPlus (addrl, 1);
303
Step(x1,dx1,dy1,e1,sign1,step1)
304
Step(x2,dx2,dy2,e2,sign2,step2)
308
addrl = AddrYPlus (addrl, 1);