1
/* $XFree86: xc/programs/Xserver/cfb/cfbfillsp.c,v 3.7tsi Exp $ */
2
/************************************************************
3
Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
7
Permission to use, copy, modify, and distribute this
8
software and its documentation for any purpose and without
9
fee is hereby granted, provided that the above copyright no-
10
tice appear in all copies and that both that copyright no-
11
tice and this permission notice appear in supporting docu-
12
mentation, and that the names of Sun or The Open Group
13
not be used in advertising or publicity pertaining to
14
distribution of the software without specific prior
15
written permission. Sun and The Open Group make no
16
representations about the suitability of this software for
17
any purpose. It is provided "as is" without any express or
20
SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
21
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
22
NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
23
ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
24
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
25
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
26
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
27
THE USE OR PERFORMANCE OF THIS SOFTWARE.
29
********************************************************/
31
/***********************************************************
33
Copyright 1987, 1998 The Open Group
35
Permission to use, copy, modify, distribute, and sell this software and its
36
documentation for any purpose is hereby granted without fee, provided that
37
the above copyright notice appear in all copies and that both that
38
copyright notice and this permission notice appear in supporting
41
The above copyright notice and this permission notice shall be included in
42
all copies or substantial portions of the Software.
44
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
45
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
46
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
47
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
48
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
49
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
51
Except as contained in this notice, the name of The Open Group shall not be
52
used in advertising or otherwise to promote the sale, use or other dealings
53
in this Software without prior written authorization from The Open Group.
56
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
60
Permission to use, copy, modify, and distribute this software and its
61
documentation for any purpose and without fee is hereby granted,
62
provided that the above copyright notice appear in all copies and that
63
both that copyright notice and this permission notice appear in
64
supporting documentation, and that the name of Digital not be
65
used in advertising or publicity pertaining to distribution of the
66
software without specific, written prior permission.
68
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
69
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
70
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
71
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
72
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
73
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
76
******************************************************************/
78
/* $Xorg: cfbfillsp.c,v 1.4 2001/02/09 02:04:37 xorgcvs Exp $ */
80
#ifdef HAVE_DIX_CONFIG_H
81
#include <dix-config.h>
89
#include "pixmapstr.h"
90
#include "scrnintstr.h"
91
#include "windowstr.h"
94
#include "cfbmskbits.h"
102
#define MFB_CONSTS_ONLY
103
#include "maskbits.h"
108
/* scanline filling for color frame buffer
109
written by drewry, oct 1986 modified by smarks
110
changes for compatibility with Little-endian systems Jul 1987; MIT:yba.
112
these routines all clip. they assume that anything that has called
113
them has already translated the points (i.e. pGC->miTranslate is
114
non-zero, which is howit gets set in cfbCreateGC().)
116
the number of new scnalines created by clipping ==
117
MaxRectsPerBand * nSpans.
119
FillSolid is overloaded to be used for OpaqueStipple as well,
120
if fgPixel == bgPixel.
121
Note that for solids, PrivGC.rop == PrivGC.ropOpStip
124
FillTiled is overloaded to be used for OpaqueStipple, if
125
fgPixel != bgPixel. based on the fill style, it uses
126
{RotatedTile, gc.alu} or {RotatedStipple, PrivGC.ropOpStip}
132
dumpspans(n, ppt, pwidth)
137
fprintf(stderr,"%d spans\n", n);
139
fprintf(stderr, "[%d,%d] %d\n", ppt->x, ppt->y, *pwidth);
143
fprintf(stderr, "\n");
147
/* Fill spans with tiles that aren't 32 bits wide */
149
cfbUnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
150
DrawablePtr pDrawable;
152
int nInit; /* number of spans to fill */
153
DDXPointPtr pptInit; /* pointer to list of start points */
154
int *pwidthInit; /* pointer to list of n widths */
157
int n; /* number of spans to fill */
158
register DDXPointPtr ppt; /* pointer to list of start points */
159
register int *pwidth; /* pointer to list of n widths */
160
void (*fill)(DrawablePtr, int, DDXPointPtr, int *, PixmapPtr, int, int, int, unsigned long);
163
if (!(pGC->planemask))
167
if (pGC->tile.pixmap->drawable.width & 3)
169
if (pGC->tile.pixmap->drawable.width & PIM)
172
fill = cfbFillSpanTileOddGeneral;
173
if ((pGC->planemask & PMSK) == PMSK)
175
if (pGC->alu == GXcopy)
176
fill = cfbFillSpanTileOddCopy;
181
fill = cfbFillSpanTile32sGeneral;
182
if ((pGC->planemask & PMSK) == PMSK)
184
if (pGC->alu == GXcopy)
185
fill = cfbFillSpanTile32sCopy;
188
n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) );
191
pwidth = (int *)ALLOCATE_LOCAL(n * sizeof(int));
192
ppt = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
195
if (ppt) DEALLOCATE_LOCAL(ppt);
196
if (pwidth) DEALLOCATE_LOCAL(pwidth);
199
n = miClipSpans( cfbGetCompositeClip(pGC),
200
pptInit, pwidthInit, nInit,
201
ppt, pwidth, fSorted);
203
xrot = pDrawable->x + pGC->patOrg.x;
204
yrot = pDrawable->y + pGC->patOrg.y;
206
(*fill) (pDrawable, n, ppt, pwidth, pGC->tile.pixmap, xrot, yrot, pGC->alu, pGC->planemask);
208
DEALLOCATE_LOCAL(ppt);
209
DEALLOCATE_LOCAL(pwidth);
215
cfbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
216
DrawablePtr pDrawable;
218
int nInit; /* number of spans to fill */
219
DDXPointPtr pptInit; /* pointer to list of start points */
220
int *pwidthInit; /* pointer to list of n widths */
223
/* next three parameters are post-clip */
224
int n; /* number of spans to fill */
225
DDXPointPtr ppt; /* pointer to list of start points */
226
int *pwidth; /* pointer to list of n widths */
227
int *pwidthFree;/* copies of the pointers to free */
229
CfbBits *pdstBase; /* pointer to start of bitmap */
230
int nlwDst; /* width in longwords of bitmap */
231
register CfbBits *pdst; /* pointer to current word in bitmap */
232
PixmapPtr pStipple; /* pointer to stipple we want to fill with */
234
int x, y, w, xrem, xSrc, ySrc;
235
int stwidth, stippleWidth;
237
register CfbBits bits, inputBits;
238
register int partBitsLeft;
240
int bitsLeft, bitsWhole;
241
CfbBits *srcTemp, *srcStart;
243
CfbBits startmask, endmask;
245
if (pGC->fillStyle == FillStippled)
246
cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask);
248
cfb8CheckOpaqueStipple (pGC->alu, pGC->fgPixel, pGC->bgPixel, pGC->planemask);
250
if (cfb8StippleRRop == GXnoop)
253
n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) );
256
pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
257
pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
258
if(!pptFree || !pwidthFree)
260
if (pptFree) DEALLOCATE_LOCAL(pptFree);
261
if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
267
n = miClipSpans( cfbGetCompositeClip(pGC),
268
pptInit, pwidthInit, nInit,
269
ppt, pwidth, fSorted);
272
* OK, so what's going on here? We have two Drawables:
276
* Width = stippleWidth
277
* Words per scanline = stwidth
278
* Pointer to pixels = pStipple->devPrivate.ptr
281
pStipple = pGC->stipple;
283
stwidth = pStipple->devKind >> PWSH;
284
stippleWidth = pStipple->drawable.width;
285
stippleHeight = pStipple->drawable.height;
286
psrcBase = (CfbBits *) pStipple->devPrivate.ptr;
291
* Width = determined from *pwidth
292
* Words per scanline = nlwDst
293
* Pointer to pixels = addrlBase
296
cfbGetLongWidthAndPointer (pDrawable, nlwDst, pdstBase)
298
/* this replaces rotating the stipple. Instead we just adjust the offset
299
* at which we start grabbing bits from the stipple.
300
* Ensure that ppt->x - xSrc >= 0 and ppt->y - ySrc >= 0,
301
* so that iline and xrem always stay within the stipple bounds.
304
modulus (pGC->patOrg.x, stippleWidth, xSrc);
305
xSrc += pDrawable->x - stippleWidth;
306
modulus (pGC->patOrg.y, stippleHeight, ySrc);
307
ySrc += pDrawable->y - stippleHeight;
309
bitsWhole = stippleWidth;
317
pdst = pdstBase + y * nlwDst + (x >> PWSH);
318
y = (y - ySrc) % stippleHeight;
319
srcStart = psrcBase + y * stwidth;
320
xrem = ((x & ~(PGSZB-1)) - xSrc) % stippleWidth;
321
srcTemp = srcStart + (xrem >> MFB_PWSH);
322
bitsLeft = stippleWidth - (xrem & ~MFB_PIM);
324
NextUnnaturalStippleWord
325
if (partBitsLeft < xrem)
326
FatalError ("cfbUnnaturalStippleFS bad partBitsLeft %d xrem %d",
328
NextSomeBits (inputBits, xrem);
329
partBitsLeft -= xrem;
330
if (((x & PIM) + w) <= PPW)
332
maskpartialbits (x, w, startmask)
333
NextUnnaturalStippleBits
334
*pdst = MaskRRopPixels(*pdst,bits,startmask);
338
maskbits (x, w, startmask, endmask, nlw);
339
nextPartBits = (x & (PGSZB-1)) + w;
340
if (nextPartBits < partBitsLeft)
344
MaskRRopBitGroup(pdst,GetBitGroup(inputBits),startmask)
346
NextBitGroup (inputBits);
350
RRopBitGroup (pdst, GetBitGroup (inputBits));
352
NextBitGroup (inputBits);
356
MaskRRopBitGroup(pdst,GetBitGroup(inputBits),endmask)
359
else if (bitsLeft != bitsWhole && nextPartBits < partBitsLeft + bitsLeft)
361
NextUnnaturalStippleBitsFast
364
*pdst = MaskRRopPixels(*pdst,bits,startmask);
366
NextUnnaturalStippleBitsFast
370
*pdst = RRopPixels(*pdst,bits);
372
NextUnnaturalStippleBitsFast
375
*pdst = MaskRRopPixels (*pdst,bits,endmask);
379
NextUnnaturalStippleBits
382
*pdst = MaskRRopPixels(*pdst,bits,startmask);
384
NextUnnaturalStippleBits
388
*pdst = RRopPixels(*pdst,bits);
390
NextUnnaturalStippleBits
393
*pdst = MaskRRopPixels(*pdst,bits,endmask);
397
DEALLOCATE_LOCAL(pptFree);
398
DEALLOCATE_LOCAL(pwidthFree);
403
/* Fill spans with stipples that aren't 32 bits wide */
405
cfbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
406
DrawablePtr pDrawable;
408
int nInit; /* number of spans to fill */
409
DDXPointPtr pptInit; /* pointer to list of start points */
410
int *pwidthInit; /* pointer to list of n widths */
413
/* next three parameters are post-clip */
414
int n; /* number of spans to fill */
415
register DDXPointPtr ppt; /* pointer to list of start points */
416
register int *pwidth; /* pointer to list of n widths */
417
int iline; /* first line of tile to use */
418
CfbBits *addrlBase; /* pointer to start of bitmap */
419
int nlwidth; /* width in longwords of bitmap */
420
register CfbBits *pdst; /* pointer to current word in bitmap */
421
PixmapPtr pStipple; /* pointer to stipple we want to fill with */
423
int width, x, xrem, xSrc, ySrc;
424
CfbBits tmpSrc, tmpDst1, tmpDst2;
425
int stwidth, stippleWidth;
427
int rop, stiprop = 0;
429
int *pwidthFree; /* copies of the pointers to free */
431
CfbBits fgfill, bgfill;
433
if (!(pGC->planemask))
436
n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) );
439
pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
440
pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
441
if(!pptFree || !pwidthFree)
443
if (pptFree) DEALLOCATE_LOCAL(pptFree);
444
if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
449
n = miClipSpans( cfbGetCompositeClip(pGC),
450
pptInit, pwidthInit, nInit,
451
ppt, pwidth, fSorted);
453
if (pGC->fillStyle == FillStippled) {
466
fgfill = PFILL(pGC->fgPixel);
467
bgfill = PFILL(pGC->bgPixel);
470
* OK, so what's going on here? We have two Drawables:
474
* Width = stippleWidth
475
* Words per scanline = stwidth
476
* Pointer to pixels = pStipple->devPrivate.ptr
478
pStipple = pGC->stipple;
480
stwidth = pStipple->devKind / PGSZB;
481
stippleWidth = pStipple->drawable.width;
482
stippleHeight = pStipple->drawable.height;
487
* Width = determined from *pwidth
488
* Words per scanline = nlwidth
489
* Pointer to pixels = addrlBase
492
cfbGetLongWidthAndPointer (pDrawable, nlwidth, addrlBase)
494
/* this replaces rotating the stipple. Instead we just adjust the offset
495
* at which we start grabbing bits from the stipple.
496
* Ensure that ppt->x - xSrc >= 0 and ppt->y - ySrc >= 0,
497
* so that iline and xrem always stay within the stipple bounds.
499
modulus (pGC->patOrg.x, stippleWidth, xSrc);
500
xSrc += pDrawable->x - stippleWidth;
501
modulus (pGC->patOrg.y, stippleHeight, ySrc);
502
ySrc += pDrawable->y - stippleHeight;
506
iline = (ppt->y - ySrc) % stippleHeight;
508
pdst = addrlBase + (ppt->y * nlwidth);
509
psrcS = (CfbBits *) pStipple->devPrivate.ptr + (iline * stwidth);
517
#if PSZ != 32 || PPW != 1
520
register CfbBits *ptemp;
521
register CfbBits *pdsttmp;
523
* Do a stripe through the stipple & destination w pixels
524
* wide. w is not more than:
525
* - the width of the destination
526
* - the width of the stipple
527
* - the distance between x and the next word
528
* boundary in the destination
529
* - the distance between x and the next word
530
* boundary in the stipple
533
/* width of dest/stipple */
534
xrem = (x - xSrc) % stippleWidth;
538
w = min((stippleWidth - xrem), width);
539
/* dist to word bound in dest */
540
w = min(w, PPW - (x & PIM));
541
/* dist to word bound in stip */
542
w = min(w, MFB_PPW - (x & MFB_PIM));
545
xtemp = (xrem & MFB_PIM);
546
ptemp = (CfbBits *)(psrcS + (xrem >> MFB_PWSH));
549
pdsttmp = pdst + ((x * 3)>>2);
551
#if PSZ != 32 || PPW != 1
554
pdsttmp = pdst + (x>>PWSH);
556
switch ( pGC->fillStyle ) {
557
case FillOpaqueStippled:
559
getstipplepixels24(ptemp, xtemp, 0, &bgfill, &tmpDst1, xrem);
560
getstipplepixels24(ptemp, xtemp, 1, &fgfill, &tmpDst2, xrem);
562
getstipplepixels(ptemp, xtemp, w, 0, &bgfill, &tmpDst1);
563
getstipplepixels(ptemp, xtemp, w, 1, &fgfill, &tmpDst2);
567
/* Fill tmpSrc with the source pixels */
569
getbits24(pdsttmp, tmpSrc, x);
570
getstipplepixels24(ptemp, xtemp, 0, &tmpSrc, &tmpDst1, xrem);
572
getbits(pdsttmp, tmpx, w, tmpSrc);
573
getstipplepixels(ptemp, xtemp, w, 0, &tmpSrc, &tmpDst1);
575
if (rop != stiprop) {
577
putbitsrop24(fgfill, 0, &tmpSrc, pGC->planemask, stiprop);
579
putbitsrop(fgfill, 0, w, &tmpSrc, pGC->planemask, stiprop);
585
getstipplepixels24(ptemp, xtemp, 1, &tmpSrc, &tmpDst2, xrem);
587
getstipplepixels(ptemp, xtemp, w, 1, &tmpSrc, &tmpDst2);
593
putbitsrop24(tmpDst2, tmpx, pdsttmp, pGC->planemask, rop);
595
putbitsrop(tmpDst2, tmpx, w, pdsttmp, pGC->planemask, rop);
604
DEALLOCATE_LOCAL(pptFree);
605
DEALLOCATE_LOCAL(pwidthFree);
608
#endif /* PSZ == 8 */
613
cfb8Stipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
614
DrawablePtr pDrawable;
616
int nInit; /* number of spans to fill */
617
DDXPointPtr pptInit; /* pointer to list of start points */
618
int *pwidthInit; /* pointer to list of n widths */
621
/* next three parameters are post-clip */
622
int n; /* number of spans to fill */
623
DDXPointPtr ppt; /* pointer to list of start points */
624
int *pwidth; /* pointer to list of n widths */
625
CfbBits *src; /* pointer to bits in stipple, if needed */
626
int stippleHeight; /* height of the stipple */
629
int nlwDst; /* width in longwords of the dest pixmap */
630
int x,y,w; /* current span */
633
register CfbBits *dst; /* pointer to bits we're writing */
638
CfbBits *pbits; /* pointer to start of pixmap */
639
register CfbBits xor;
640
register CfbBits mask;
641
register CfbBits bits; /* bits from stipple */
644
int *pwidthFree; /* copies of the pointers to free */
646
cfbPrivGCPtr devPriv;
648
devPriv = cfbGetGCPrivate(pGC);
649
cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask);
650
n = nInit * miFindMaxBand(pGC->pCompositeClip);
653
pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
654
pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
655
if(!pptFree || !pwidthFree)
657
if (pptFree) DEALLOCATE_LOCAL(pptFree);
658
if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
663
n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit,
664
ppt, pwidth, fSorted);
666
stipple = pGC->pRotatedPixmap;
667
src = (CfbBits *)stipple->devPrivate.ptr;
668
stippleHeight = stipple->drawable.height;
670
cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits)
678
dst = pbits + (y * nlwDst) + (x >> PWSH);
679
if (((x & PIM) + w) <= PPW)
681
maskpartialbits(x, w, startmask);
687
maskbits (x, w, startmask, endmask, nlw);
689
bits = src[y % stippleHeight];
690
RotBitsLeft (bits, (x & ((PGSZ-1) & ~PIM)));
692
if (cfb8StippleRRop == GXcopy)
699
mask = cfb8PixelMasks[GetBitGroup(bits)];
700
*dst = (*dst & ~(mask & startmask)) |
701
(xor & (mask & startmask));
703
RotBitsLeft (bits, PGSZB);
707
WriteBitGroup (dst,xor,GetBitGroup(bits))
709
RotBitsLeft (bits, PGSZB);
713
mask = cfb8PixelMasks[GetBitGroup(bits)];
714
*dst = (*dst & ~(mask & endmask)) |
715
(xor & (mask & endmask));
719
{ /* XXX constants probably not OK here */
720
wEnd = 7 - (nlw & 7);
721
nlw = (nlw >> 3) + 1;
726
mask = cfb8PixelMasks[GetBitGroup(bits)];
727
*dstTmp = (*dstTmp & ~(mask & startmask)) |
728
(xor & (mask & startmask));
730
RotBitsLeft (bits, PGSZB);
738
#if defined(__GNUC__) && defined(mc68020)
739
mask = cfb8PixelMasks[GetBitGroup(bits)];
744
*dst = (*dst & mask) | xor;
749
#define SwitchBitsLoop(body) \
755
SwitchBitGroup(dst, xor, GetBitGroup(bits));
756
#undef SwitchBitsLoop
764
mask = cfb8PixelMasks[GetBitGroup(bits)];
765
dst = dstTmp + (nlwTmp << 3);
766
*dst = (*dst & ~(mask & endmask)) |
767
(xor & (mask & endmask));
774
#if defined(__GNUC__) && defined(mc68020)
775
mask = cfb8PixelMasks[GetBitGroup(bits)];
780
*dst = (*dst & mask) | xor;
785
#define SwitchBitsLoop(body) \
791
SwitchBitGroup(dst, xor, GetBitGroup(bits));
792
#undef SwitchBitsLoop
799
#endif /* PPW == 4 */
803
xor = GetBitGroup(bits);
804
*dst = MaskRRopPixels(*dst, xor, startmask);
806
RotBitsLeft (bits, PGSZB);
810
RRopBitGroup(dst, GetBitGroup(bits));
812
RotBitsLeft (bits, PGSZB);
816
xor = GetBitGroup(bits);
817
*dst = MaskRRopPixels(*dst, xor, endmask);
821
DEALLOCATE_LOCAL(pptFree);
822
DEALLOCATE_LOCAL(pwidthFree);
826
cfb8OpaqueStipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
827
DrawablePtr pDrawable;
829
int nInit; /* number of spans to fill */
830
DDXPointPtr pptInit; /* pointer to list of start points */
831
int *pwidthInit; /* pointer to list of n widths */
834
/* next three parameters are post-clip */
835
int n; /* number of spans to fill */
836
DDXPointPtr ppt; /* pointer to list of start points */
837
int *pwidth; /* pointer to list of n widths */
838
CfbBits *src; /* pointer to bits in stipple, if needed */
839
int stippleHeight; /* height of the stipple */
842
int nlwDst; /* width in longwords of the dest pixmap */
843
int x,y,w; /* current span */
846
register CfbBits *dst; /* pointer to bits we're writing */
851
CfbBits *pbits; /* pointer to start of pixmap */
852
register CfbBits xor;
853
register CfbBits bits; /* bits from stipple */
856
int *pwidthFree; /* copies of the pointers to free */
858
cfbPrivGCPtr devPriv;
860
devPriv = cfbGetGCPrivate(pGC);
862
cfb8CheckOpaqueStipple(pGC->alu, pGC->fgPixel, pGC->bgPixel, pGC->planemask);
864
n = nInit * miFindMaxBand(pGC->pCompositeClip);
867
pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
868
pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
869
if(!pptFree || !pwidthFree)
871
if (pptFree) DEALLOCATE_LOCAL(pptFree);
872
if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
877
n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit,
878
ppt, pwidth, fSorted);
880
stipple = pGC->pRotatedPixmap;
881
src = (CfbBits *)stipple->devPrivate.ptr;
882
stippleHeight = stipple->drawable.height;
884
cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits)
892
dst = pbits + (y * nlwDst) + (x >> PWSH);
893
if (((x & PIM) + w) <= PPW)
895
maskpartialbits(x, w, startmask);
901
maskbits (x, w, startmask, endmask, nlw);
903
bits = src[y % stippleHeight];
904
RotBitsLeft (bits, (x & ((PGSZ-1) & ~PIM)));
906
if (cfb8StippleRRop == GXcopy)
913
*dst = (*dst & ~startmask) |
914
(GetPixelGroup (bits) & startmask);
916
RotBitsLeft (bits, PGSZB);
920
*dst++ = GetPixelGroup(bits);
921
RotBitsLeft (bits, PGSZB);
925
*dst = (*dst & ~endmask) |
926
(GetPixelGroup (bits) & endmask);
930
{ /* XXX consts probably not OK here */
931
wEnd = 7 - (nlw & 7);
932
nlw = (nlw >> 3) + 1;
937
*dstTmp = (*dstTmp & ~startmask) |
938
(GetPixelGroup (bits) & startmask);
940
RotBitsLeft (bits, PGSZB);
948
xor = GetPixelGroup (bits);
960
dst = dstTmp + (nlwTmp << 3);
961
*dst = (*dst & ~endmask) |
962
(GetPixelGroup (bits) & endmask);
969
xor = GetPixelGroup (bits);
980
#endif /* PPW == 4 */
984
xor = GetBitGroup(bits);
985
*dst = MaskRRopPixels(*dst, xor, startmask);
987
RotBitsLeft (bits, PGSZB);
991
RRopBitGroup(dst, GetBitGroup(bits));
993
RotBitsLeft (bits, PGSZB);
997
xor = GetBitGroup(bits);
998
*dst = MaskRRopPixels(*dst, xor, endmask);
1002
DEALLOCATE_LOCAL(pptFree);
1003
DEALLOCATE_LOCAL(pwidthFree);
1006
#endif /* PSZ == 8 */