1
/* $XFree86: xc/programs/Xserver/iplan2p4/ipltile32.c,v 3.0 1996/08/18 01:55:10 dawes Exp $ */
3
* Fill 32 bit tiled rectangles. Used by both PolyFillRect and PaintWindow.
4
* no depth dependencies.
9
Copyright (c) 1989 X Consortium
11
Permission is hereby granted, free of charge, to any person obtaining a copy
12
of this software and associated documentation files (the "Software"), to deal
13
in the Software without restriction, including without limitation the rights
14
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
copies of the Software, and to permit persons to whom the Software is
16
furnished to do so, subject to the following conditions:
18
The above copyright notice and this permission notice shall be included in
19
all copies or substantial portions of the Software.
21
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
25
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
26
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
Except as contained in this notice, the name of the X Consortium shall not be
29
used in advertising or otherwise to promote the sale, use or other dealings
30
in this Software without prior written authorization from the X Consortium.
33
/* $XConsortium: ipltile32.c,v 1.8 94/04/17 20:29:05 dpw Exp $ */
35
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
38
#ifdef HAVE_DIX_CONFIG_H
39
#include <dix-config.h>
47
#include "pixmapstr.h"
48
#include "scrnintstr.h"
49
#include "windowstr.h"
56
#include "iplmskbits.h"
57
#include "iplmergerop.h"
59
#define STORE(p) INTER_MROP_PREBUILT_SOLID(srcpix, p, p)
61
#define Expand(left,right) {\
63
INTER_COPY(psrc+srcy*INTER_PLANES, srcpix); \
64
INTER_MROP_PREBUILD(srcpix); \
66
if (srcy == tileHeight) \
73
INTER_NEXT_GROUP(p); \
81
INTER_MROP_NAME(iplFillRectTile32) (pDrawable, pGC, nBox, pBox)
82
DrawablePtr pDrawable;
84
int nBox; /* number of boxes to fill */
85
BoxPtr pBox; /* pointer to list of boxes to fill */
87
INTER_DECLAREGP(srcpix);
88
INTER_DECLAREG(*psrc); /* pointer to bits in tile, if needed */
89
int tileHeight; /* height of the tile */
91
int ngwDst; /* width in longwords of the dest pixmap */
92
int w; /* width of current box */
93
register int h; /* height of current box */
94
INTER_DECLAREG(startmask);
95
INTER_DECLAREG(endmask); /* masks for reggedy bits at either end of line */
96
int ngwMiddle; /* number of longwords between sides of boxes */
97
int ngwExtra; /* to get from right of box to left of next span */
98
register int ngw; /* loop version of ngwMiddle */
99
INTER_DECLAREG(*p); /* pointer to bits we're writing */
100
int y; /* current scan line */
101
int srcy; /* current tile position */
103
INTER_DECLAREG(*pbits); /* pointer to start of pixmap */
104
PixmapPtr tile; /* rotated, expanded tile */
105
INTER_MROP_DECLARE_REG()
106
INTER_MROP_PREBUILT_DECLARE()
108
tile = pGC->pRotatedPixmap;
109
tileHeight = tile->drawable.height;
110
psrc = (unsigned short *)tile->devPrivate.ptr;
112
INTER_MROP_INITIALIZE(pGC->alu, pGC->planemask);
114
iplGetGroupWidthAndPointer (pDrawable, ngwDst, pbits)
118
w = pBox->x2 - pBox->x1;
119
h = pBox->y2 - pBox->y1;
121
p = pbits + (y * ngwDst) + (pBox->x1 >> INTER_PGSH) * INTER_PLANES;
122
srcy = y % tileHeight;
124
if ( ((pBox->x1 & INTER_PIM) + w) <= INTER_PPG)
126
INTER_maskpartialbits(pBox->x1, w, startmask);
130
INTER_COPY(psrc+srcy*INTER_PLANES, srcpix);
131
INTER_MROP_PREBUILD(srcpix);
133
if (srcy == tileHeight)
135
INTER_MROP_PREBUILT_MASK(srcpix, p, startmask, p);
141
INTER_maskbits(pBox->x1, w, startmask, endmask, ngwMiddle);
142
ngwExtra = ngwDst - ngwMiddle * INTER_PLANES;
146
ngwExtra -= INTER_PLANES;
150
INTER_MROP_PREBUILT_MASK(srcpix, p, startmask, p);
151
INTER_NEXT_GROUP(p);,
152
INTER_MROP_PREBUILT_MASK(srcpix, p, endmask, p));
157
INTER_MROP_PREBUILT_MASK(srcpix, p, startmask, p);
158
INTER_NEXT_GROUP(p);,
167
INTER_MROP_PREBUILT_MASK(srcpix, p, endmask, p));
181
INTER_MROP_NAME(iplTile32FS)(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
182
DrawablePtr pDrawable;
184
int nInit; /* number of spans to fill */
185
DDXPointPtr pptInit; /* pointer to list of start points */
186
int *pwidthInit; /* pointer to list of n widths */
189
/* next three parameters are post-clip */
190
int n; /* number of spans to fill */
191
DDXPointPtr ppt; /* pointer to list of start points */
192
int *pwidth;/* pointer to list of n widths */
193
INTER_DECLAREG(*pbits); /* pointer to start of bitmap */
194
int ngwDst; /* width in longwords of bitmap */
195
INTER_DECLAREG(*p); /* pointer to current longword in bitmap */
196
register int w; /* current span width */
199
INTER_DECLAREG(startmask);
200
INTER_DECLAREG(endmask);
201
INTER_DECLAREGP(srcpix);
203
int *pwidthFree;/* copies of the pointers to free */
206
INTER_DECLAREG(*psrc); /* pointer to bits in tile */
207
int tileHeight;/* height of the tile */
208
INTER_MROP_DECLARE_REG ()
209
INTER_MROP_PREBUILT_DECLARE()
211
n = nInit * miFindMaxBand( iplGetCompositeClip(pGC) );
212
pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
213
pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
214
if(!pptFree || !pwidthFree)
216
if (pptFree) DEALLOCATE_LOCAL(pptFree);
217
if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
222
n = miClipSpans( iplGetCompositeClip(pGC),
223
pptInit, pwidthInit, nInit,
224
ppt, pwidth, fSorted);
226
tile = pGC->pRotatedPixmap;
227
tileHeight = tile->drawable.height;
228
psrc = (unsigned short *)tile->devPrivate.ptr;
230
INTER_MROP_INITIALIZE(pGC->alu, pGC->planemask);
232
iplGetGroupWidthAndPointer (pDrawable, ngwDst, pbits)
241
p = pbits + (y * ngwDst) + (x >> INTER_PGSH) * INTER_PLANES;
242
INTER_COPY(psrc +(y % tileHeight)*INTER_PLANES,srcpix);
243
INTER_MROP_PREBUILD(srcpix);
245
if ((x & INTER_PIM) + w < INTER_PPG)
247
INTER_maskpartialbits(x, w, startmask);
248
INTER_MROP_PREBUILT_MASK(srcpix, p, startmask, p);
252
INTER_maskbits(x, w, startmask, endmask, ngw);
255
INTER_MROP_PREBUILT_MASK(srcpix, p, startmask, p);
265
INTER_MROP_PREBUILT_MASK(srcpix, p, endmask, p);
270
DEALLOCATE_LOCAL(pptFree);
271
DEALLOCATE_LOCAL(pwidthFree);