1 /************************************************************
2 Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
6 Permission to use, copy, modify, and distribute this
7 software and its documentation for any purpose and without
8 fee is hereby granted, provided that the above copyright no-
9 tice appear in all copies and that both that copyright no-
10 tice and this permission notice appear in supporting docu-
11 mentation, and that the names of Sun or The Open Group
12 not be used in advertising or publicity pertaining to
13 distribution of the software without specific prior
14 written permission. Sun and The Open Group make no
15 representations about the suitability of this software for
16 any purpose. It is provided "as is" without any express or
19 SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
20 INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
21 NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
22 ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
23 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
24 PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
25 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
26 THE USE OR PERFORMANCE OF THIS SOFTWARE.
28 ********************************************************/
30 /***********************************************************
32 Copyright 1987, 1998 The Open Group
34 Permission to use, copy, modify, distribute, and sell this software and its
35 documentation for any purpose is hereby granted without fee, provided that
36 the above copyright notice appear in all copies and that both that
37 copyright notice and this permission notice appear in supporting
40 The above copyright notice and this permission notice shall be included in
41 all copies or substantial portions of the Software.
43 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
44 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
45 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
46 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
47 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
48 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
50 Except as contained in this notice, the name of The Open Group shall not be
51 used in advertising or otherwise to promote the sale, use or other dealings
52 in this Software without prior written authorization from The Open Group.
55 Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
59 Permission to use, copy, modify, and distribute this software and its
60 documentation for any purpose and without fee is hereby granted,
61 provided that the above copyright notice appear in all copies and that
62 both that copyright notice and this permission notice appear in
63 supporting documentation, and that the name of Digital not be
64 used in advertising or publicity pertaining to distribution of the
65 software without specific, written prior permission.
67 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
68 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
69 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
70 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
71 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
72 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
75 ******************************************************************/
78 #ifdef HAVE_DIX_CONFIG_H
79 #include <dix-config.h>
87 #include "pixmapstr.h"
88 #include "scrnintstr.h"
89 #include "windowstr.h"
92 #include "cfbmskbits.h"
100 #define MFB_CONSTS_ONLY
101 #include "maskbits.h"
106 /* scanline filling for color frame buffer
107 written by drewry, oct 1986 modified by smarks
108 changes for compatibility with Little-endian systems Jul 1987; MIT:yba.
110 these routines all clip. they assume that anything that has called
111 them has already translated the points (i.e. pGC->miTranslate is
112 non-zero, which is howit gets set in cfbCreateGC().)
114 the number of new scnalines created by clipping ==
115 MaxRectsPerBand * nSpans.
117 FillSolid is overloaded to be used for OpaqueStipple as well,
118 if fgPixel == bgPixel.
119 Note that for solids, PrivGC.rop == PrivGC.ropOpStip
122 FillTiled is overloaded to be used for OpaqueStipple, if
123 fgPixel != bgPixel. based on the fill style, it uses
124 {RotatedTile, gc.alu} or {RotatedStipple, PrivGC.ropOpStip}
130 dumpspans(n
, ppt
, pwidth
)
135 fprintf(stderr
,"%d spans\n", n
);
137 fprintf(stderr
, "[%d,%d] %d\n", ppt
->x
, ppt
->y
, *pwidth
);
141 fprintf(stderr
, "\n");
145 /* Fill spans with tiles that aren't 32 bits wide */
147 cfbUnnaturalTileFS(pDrawable
, pGC
, nInit
, pptInit
, pwidthInit
, fSorted
)
148 DrawablePtr pDrawable
;
150 int nInit
; /* number of spans to fill */
151 DDXPointPtr pptInit
; /* pointer to list of start points */
152 int *pwidthInit
; /* pointer to list of n widths */
155 int n
; /* number of spans to fill */
156 register DDXPointPtr ppt
; /* pointer to list of start points */
157 register int *pwidth
; /* pointer to list of n widths */
158 void (*fill
)(DrawablePtr
, int, DDXPointPtr
, int *, PixmapPtr
, int, int, int, unsigned long);
161 if (!(pGC
->planemask
))
165 if (pGC
->tile
.pixmap
->drawable
.width
& 3)
167 if (pGC
->tile
.pixmap
->drawable
.width
& PIM
)
170 fill
= cfbFillSpanTileOddGeneral
;
171 if ((pGC
->planemask
& PMSK
) == PMSK
)
173 if (pGC
->alu
== GXcopy
)
174 fill
= cfbFillSpanTileOddCopy
;
179 fill
= cfbFillSpanTile32sGeneral
;
180 if ((pGC
->planemask
& PMSK
) == PMSK
)
182 if (pGC
->alu
== GXcopy
)
183 fill
= cfbFillSpanTile32sCopy
;
186 n
= nInit
* miFindMaxBand( cfbGetCompositeClip(pGC
) );
189 pwidth
= (int *)ALLOCATE_LOCAL(n
* sizeof(int));
190 ppt
= (DDXPointRec
*)ALLOCATE_LOCAL(n
* sizeof(DDXPointRec
));
193 if (ppt
) DEALLOCATE_LOCAL(ppt
);
194 if (pwidth
) DEALLOCATE_LOCAL(pwidth
);
197 n
= miClipSpans( cfbGetCompositeClip(pGC
),
198 pptInit
, pwidthInit
, nInit
,
199 ppt
, pwidth
, fSorted
);
201 xrot
= pDrawable
->x
+ pGC
->patOrg
.x
;
202 yrot
= pDrawable
->y
+ pGC
->patOrg
.y
;
204 (*fill
) (pDrawable
, n
, ppt
, pwidth
, pGC
->tile
.pixmap
, xrot
, yrot
, pGC
->alu
, pGC
->planemask
);
206 DEALLOCATE_LOCAL(ppt
);
207 DEALLOCATE_LOCAL(pwidth
);
213 cfbUnnaturalStippleFS(pDrawable
, pGC
, nInit
, pptInit
, pwidthInit
, fSorted
)
214 DrawablePtr pDrawable
;
216 int nInit
; /* number of spans to fill */
217 DDXPointPtr pptInit
; /* pointer to list of start points */
218 int *pwidthInit
; /* pointer to list of n widths */
221 /* next three parameters are post-clip */
222 int n
; /* number of spans to fill */
223 DDXPointPtr ppt
; /* pointer to list of start points */
224 int *pwidth
; /* pointer to list of n widths */
225 int *pwidthFree
;/* copies of the pointers to free */
227 CfbBits
*pdstBase
; /* pointer to start of bitmap */
228 int nlwDst
; /* width in longwords of bitmap */
229 register CfbBits
*pdst
; /* pointer to current word in bitmap */
230 PixmapPtr pStipple
; /* pointer to stipple we want to fill with */
232 int x
, y
, w
, xrem
, xSrc
, ySrc
;
233 int stwidth
, stippleWidth
;
235 register CfbBits bits
, inputBits
;
236 register int partBitsLeft
;
238 int bitsLeft
, bitsWhole
;
239 CfbBits
*srcTemp
, *srcStart
;
241 CfbBits startmask
, endmask
;
243 if (pGC
->fillStyle
== FillStippled
)
244 cfb8CheckStipple (pGC
->alu
, pGC
->fgPixel
, pGC
->planemask
);
246 cfb8CheckOpaqueStipple (pGC
->alu
, pGC
->fgPixel
, pGC
->bgPixel
, pGC
->planemask
);
248 if (cfb8StippleRRop
== GXnoop
)
251 n
= nInit
* miFindMaxBand( cfbGetCompositeClip(pGC
) );
254 pwidthFree
= (int *)ALLOCATE_LOCAL(n
* sizeof(int));
255 pptFree
= (DDXPointRec
*)ALLOCATE_LOCAL(n
* sizeof(DDXPointRec
));
256 if(!pptFree
|| !pwidthFree
)
258 if (pptFree
) DEALLOCATE_LOCAL(pptFree
);
259 if (pwidthFree
) DEALLOCATE_LOCAL(pwidthFree
);
265 n
= miClipSpans( cfbGetCompositeClip(pGC
),
266 pptInit
, pwidthInit
, nInit
,
267 ppt
, pwidth
, fSorted
);
270 * OK, so what's going on here? We have two Drawables:
274 * Width = stippleWidth
275 * Words per scanline = stwidth
276 * Pointer to pixels = pStipple->devPrivate.ptr
279 pStipple
= pGC
->stipple
;
281 stwidth
= pStipple
->devKind
>> PWSH
;
282 stippleWidth
= pStipple
->drawable
.width
;
283 stippleHeight
= pStipple
->drawable
.height
;
284 psrcBase
= (CfbBits
*) pStipple
->devPrivate
.ptr
;
289 * Width = determined from *pwidth
290 * Words per scanline = nlwDst
291 * Pointer to pixels = addrlBase
294 cfbGetLongWidthAndPointer (pDrawable
, nlwDst
, pdstBase
)
296 /* this replaces rotating the stipple. Instead we just adjust the offset
297 * at which we start grabbing bits from the stipple.
298 * Ensure that ppt->x - xSrc >= 0 and ppt->y - ySrc >= 0,
299 * so that iline and xrem always stay within the stipple bounds.
302 modulus (pGC
->patOrg
.x
, stippleWidth
, xSrc
);
303 xSrc
+= pDrawable
->x
- stippleWidth
;
304 modulus (pGC
->patOrg
.y
, stippleHeight
, ySrc
);
305 ySrc
+= pDrawable
->y
- stippleHeight
;
307 bitsWhole
= stippleWidth
;
315 pdst
= pdstBase
+ y
* nlwDst
+ (x
>> PWSH
);
316 y
= (y
- ySrc
) % stippleHeight
;
317 srcStart
= psrcBase
+ y
* stwidth
;
318 xrem
= ((x
& ~(PGSZB
-1)) - xSrc
) % stippleWidth
;
319 srcTemp
= srcStart
+ (xrem
>> MFB_PWSH
);
320 bitsLeft
= stippleWidth
- (xrem
& ~MFB_PIM
);
322 NextUnnaturalStippleWord
323 if (partBitsLeft
< xrem
)
324 FatalError ("cfbUnnaturalStippleFS bad partBitsLeft %d xrem %d",
326 NextSomeBits (inputBits
, xrem
);
327 partBitsLeft
-= xrem
;
328 if (((x
& PIM
) + w
) <= PPW
)
330 maskpartialbits (x
, w
, startmask
)
331 NextUnnaturalStippleBits
332 *pdst
= MaskRRopPixels(*pdst
,bits
,startmask
);
336 maskbits (x
, w
, startmask
, endmask
, nlw
);
337 nextPartBits
= (x
& (PGSZB
-1)) + w
;
338 if (nextPartBits
< partBitsLeft
)
342 MaskRRopBitGroup(pdst
,GetBitGroup(inputBits
),startmask
)
344 NextBitGroup (inputBits
);
348 RRopBitGroup (pdst
, GetBitGroup (inputBits
));
350 NextBitGroup (inputBits
);
354 MaskRRopBitGroup(pdst
,GetBitGroup(inputBits
),endmask
)
357 else if (bitsLeft
!= bitsWhole
&& nextPartBits
< partBitsLeft
+ bitsLeft
)
359 NextUnnaturalStippleBitsFast
362 *pdst
= MaskRRopPixels(*pdst
,bits
,startmask
);
364 NextUnnaturalStippleBitsFast
368 *pdst
= RRopPixels(*pdst
,bits
);
370 NextUnnaturalStippleBitsFast
373 *pdst
= MaskRRopPixels (*pdst
,bits
,endmask
);
377 NextUnnaturalStippleBits
380 *pdst
= MaskRRopPixels(*pdst
,bits
,startmask
);
382 NextUnnaturalStippleBits
386 *pdst
= RRopPixels(*pdst
,bits
);
388 NextUnnaturalStippleBits
391 *pdst
= MaskRRopPixels(*pdst
,bits
,endmask
);
395 DEALLOCATE_LOCAL(pptFree
);
396 DEALLOCATE_LOCAL(pwidthFree
);
401 /* Fill spans with stipples that aren't 32 bits wide */
403 cfbUnnaturalStippleFS(pDrawable
, pGC
, nInit
, pptInit
, pwidthInit
, fSorted
)
404 DrawablePtr pDrawable
;
406 int nInit
; /* number of spans to fill */
407 DDXPointPtr pptInit
; /* pointer to list of start points */
408 int *pwidthInit
; /* pointer to list of n widths */
411 /* next three parameters are post-clip */
412 int n
; /* number of spans to fill */
413 register DDXPointPtr ppt
; /* pointer to list of start points */
414 register int *pwidth
; /* pointer to list of n widths */
415 int iline
; /* first line of tile to use */
416 CfbBits
*addrlBase
; /* pointer to start of bitmap */
417 int nlwidth
; /* width in longwords of bitmap */
418 register CfbBits
*pdst
; /* pointer to current word in bitmap */
419 PixmapPtr pStipple
; /* pointer to stipple we want to fill with */
421 int width
, x
, xrem
, xSrc
, ySrc
;
422 CfbBits tmpSrc
, tmpDst1
, tmpDst2
;
423 int stwidth
, stippleWidth
;
425 int rop
, stiprop
= 0;
427 int *pwidthFree
; /* copies of the pointers to free */
429 CfbBits fgfill
, bgfill
;
431 if (!(pGC
->planemask
))
434 n
= nInit
* miFindMaxBand( cfbGetCompositeClip(pGC
) );
437 pwidthFree
= (int *)ALLOCATE_LOCAL(n
* sizeof(int));
438 pptFree
= (DDXPointRec
*)ALLOCATE_LOCAL(n
* sizeof(DDXPointRec
));
439 if(!pptFree
|| !pwidthFree
)
441 if (pptFree
) DEALLOCATE_LOCAL(pptFree
);
442 if (pwidthFree
) DEALLOCATE_LOCAL(pwidthFree
);
447 n
= miClipSpans( cfbGetCompositeClip(pGC
),
448 pptInit
, pwidthInit
, nInit
,
449 ppt
, pwidth
, fSorted
);
451 if (pGC
->fillStyle
== FillStippled
) {
464 fgfill
= PFILL(pGC
->fgPixel
);
465 bgfill
= PFILL(pGC
->bgPixel
);
468 * OK, so what's going on here? We have two Drawables:
472 * Width = stippleWidth
473 * Words per scanline = stwidth
474 * Pointer to pixels = pStipple->devPrivate.ptr
476 pStipple
= pGC
->stipple
;
478 stwidth
= pStipple
->devKind
/ PGSZB
;
479 stippleWidth
= pStipple
->drawable
.width
;
480 stippleHeight
= pStipple
->drawable
.height
;
485 * Width = determined from *pwidth
486 * Words per scanline = nlwidth
487 * Pointer to pixels = addrlBase
490 cfbGetLongWidthAndPointer (pDrawable
, nlwidth
, addrlBase
)
492 /* this replaces rotating the stipple. Instead we just adjust the offset
493 * at which we start grabbing bits from the stipple.
494 * Ensure that ppt->x - xSrc >= 0 and ppt->y - ySrc >= 0,
495 * so that iline and xrem always stay within the stipple bounds.
497 modulus (pGC
->patOrg
.x
, stippleWidth
, xSrc
);
498 xSrc
+= pDrawable
->x
- stippleWidth
;
499 modulus (pGC
->patOrg
.y
, stippleHeight
, ySrc
);
500 ySrc
+= pDrawable
->y
- stippleHeight
;
504 iline
= (ppt
->y
- ySrc
) % stippleHeight
;
506 pdst
= addrlBase
+ (ppt
->y
* nlwidth
);
507 psrcS
= (CfbBits
*) pStipple
->devPrivate
.ptr
+ (iline
* stwidth
);
515 #if PSZ != 32 || PPW != 1
518 register CfbBits
*ptemp
;
519 register CfbBits
*pdsttmp
;
521 * Do a stripe through the stipple & destination w pixels
522 * wide. w is not more than:
523 * - the width of the destination
524 * - the width of the stipple
525 * - the distance between x and the next word
526 * boundary in the destination
527 * - the distance between x and the next word
528 * boundary in the stipple
531 /* width of dest/stipple */
532 xrem
= (x
- xSrc
) % stippleWidth
;
536 w
= min((stippleWidth
- xrem
), width
);
537 /* dist to word bound in dest */
538 w
= min(w
, PPW
- (x
& PIM
));
539 /* dist to word bound in stip */
540 w
= min(w
, MFB_PPW
- (x
& MFB_PIM
));
543 xtemp
= (xrem
& MFB_PIM
);
544 ptemp
= (CfbBits
*)(psrcS
+ (xrem
>> MFB_PWSH
));
547 pdsttmp
= pdst
+ ((x
* 3)>>2);
549 #if PSZ != 32 || PPW != 1
552 pdsttmp
= pdst
+ (x
>>PWSH
);
554 switch ( pGC
->fillStyle
) {
555 case FillOpaqueStippled
:
557 getstipplepixels24(ptemp
, xtemp
, 0, &bgfill
, &tmpDst1
, xrem
);
558 getstipplepixels24(ptemp
, xtemp
, 1, &fgfill
, &tmpDst2
, xrem
);
560 getstipplepixels(ptemp
, xtemp
, w
, 0, &bgfill
, &tmpDst1
);
561 getstipplepixels(ptemp
, xtemp
, w
, 1, &fgfill
, &tmpDst2
);
565 /* Fill tmpSrc with the source pixels */
567 getbits24(pdsttmp
, tmpSrc
, x
);
568 getstipplepixels24(ptemp
, xtemp
, 0, &tmpSrc
, &tmpDst1
, xrem
);
570 getbits(pdsttmp
, tmpx
, w
, tmpSrc
);
571 getstipplepixels(ptemp
, xtemp
, w
, 0, &tmpSrc
, &tmpDst1
);
573 if (rop
!= stiprop
) {
575 putbitsrop24(fgfill
, 0, &tmpSrc
, pGC
->planemask
, stiprop
);
577 putbitsrop(fgfill
, 0, w
, &tmpSrc
, pGC
->planemask
, stiprop
);
583 getstipplepixels24(ptemp
, xtemp
, 1, &tmpSrc
, &tmpDst2
, xrem
);
585 getstipplepixels(ptemp
, xtemp
, w
, 1, &tmpSrc
, &tmpDst2
);
591 putbitsrop24(tmpDst2
, tmpx
, pdsttmp
, pGC
->planemask
, rop
);
593 putbitsrop(tmpDst2
, tmpx
, w
, pdsttmp
, pGC
->planemask
, rop
);
602 DEALLOCATE_LOCAL(pptFree
);
603 DEALLOCATE_LOCAL(pwidthFree
);
606 #endif /* PSZ == 8 */
611 cfb8Stipple32FS (pDrawable
, pGC
, nInit
, pptInit
, pwidthInit
, fSorted
)
612 DrawablePtr pDrawable
;
614 int nInit
; /* number of spans to fill */
615 DDXPointPtr pptInit
; /* pointer to list of start points */
616 int *pwidthInit
; /* pointer to list of n widths */
619 /* next three parameters are post-clip */
620 int n
; /* number of spans to fill */
621 DDXPointPtr ppt
; /* pointer to list of start points */
622 int *pwidth
; /* pointer to list of n widths */
623 CfbBits
*src
; /* pointer to bits in stipple, if needed */
624 int stippleHeight
; /* height of the stipple */
627 int nlwDst
; /* width in longwords of the dest pixmap */
628 int x
,y
,w
; /* current span */
631 register CfbBits
*dst
; /* pointer to bits we're writing */
636 CfbBits
*pbits
; /* pointer to start of pixmap */
637 register CfbBits
xor;
638 register CfbBits mask
;
639 register CfbBits bits
; /* bits from stipple */
642 int *pwidthFree
; /* copies of the pointers to free */
644 cfbPrivGCPtr devPriv
;
646 devPriv
= cfbGetGCPrivate(pGC
);
647 cfb8CheckStipple (pGC
->alu
, pGC
->fgPixel
, pGC
->planemask
);
648 n
= nInit
* miFindMaxBand(pGC
->pCompositeClip
);
651 pwidthFree
= (int *)ALLOCATE_LOCAL(n
* sizeof(int));
652 pptFree
= (DDXPointRec
*)ALLOCATE_LOCAL(n
* sizeof(DDXPointRec
));
653 if(!pptFree
|| !pwidthFree
)
655 if (pptFree
) DEALLOCATE_LOCAL(pptFree
);
656 if (pwidthFree
) DEALLOCATE_LOCAL(pwidthFree
);
661 n
= miClipSpans(pGC
->pCompositeClip
, pptInit
, pwidthInit
, nInit
,
662 ppt
, pwidth
, fSorted
);
664 stipple
= pGC
->pRotatedPixmap
;
665 src
= (CfbBits
*)stipple
->devPrivate
.ptr
;
666 stippleHeight
= stipple
->drawable
.height
;
668 cfbGetLongWidthAndPointer (pDrawable
, nlwDst
, pbits
)
676 dst
= pbits
+ (y
* nlwDst
) + (x
>> PWSH
);
677 if (((x
& PIM
) + w
) <= PPW
)
679 maskpartialbits(x
, w
, startmask
);
685 maskbits (x
, w
, startmask
, endmask
, nlw
);
687 bits
= src
[y
% stippleHeight
];
688 RotBitsLeft (bits
, (x
& ((PGSZ
-1) & ~PIM
)));
690 if (cfb8StippleRRop
== GXcopy
)
697 mask
= cfb8PixelMasks
[GetBitGroup(bits
)];
698 *dst
= (*dst
& ~(mask
& startmask
)) |
699 (xor & (mask
& startmask
));
701 RotBitsLeft (bits
, PGSZB
);
705 WriteBitGroup (dst
,xor,GetBitGroup(bits
))
707 RotBitsLeft (bits
, PGSZB
);
711 mask
= cfb8PixelMasks
[GetBitGroup(bits
)];
712 *dst
= (*dst
& ~(mask
& endmask
)) |
713 (xor & (mask
& endmask
));
717 { /* XXX constants probably not OK here */
718 wEnd
= 7 - (nlw
& 7);
719 nlw
= (nlw
>> 3) + 1;
724 mask
= cfb8PixelMasks
[GetBitGroup(bits
)];
725 *dstTmp
= (*dstTmp
& ~(mask
& startmask
)) |
726 (xor & (mask
& startmask
));
728 RotBitsLeft (bits
, PGSZB
);
736 #if defined(__GNUC__) && defined(mc68020)
737 mask
= cfb8PixelMasks
[GetBitGroup(bits
)];
742 *dst
= (*dst
& mask
) | xor;
747 #define SwitchBitsLoop(body) \
753 SwitchBitGroup(dst
, xor, GetBitGroup(bits
));
754 #undef SwitchBitsLoop
762 mask
= cfb8PixelMasks
[GetBitGroup(bits
)];
763 dst
= dstTmp
+ (nlwTmp
<< 3);
764 *dst
= (*dst
& ~(mask
& endmask
)) |
765 (xor & (mask
& endmask
));
772 #if defined(__GNUC__) && defined(mc68020)
773 mask
= cfb8PixelMasks
[GetBitGroup(bits
)];
778 *dst
= (*dst
& mask
) | xor;
783 #define SwitchBitsLoop(body) \
789 SwitchBitGroup(dst
, xor, GetBitGroup(bits
));
790 #undef SwitchBitsLoop
797 #endif /* PPW == 4 */
801 xor = GetBitGroup(bits
);
802 *dst
= MaskRRopPixels(*dst
, xor, startmask
);
804 RotBitsLeft (bits
, PGSZB
);
808 RRopBitGroup(dst
, GetBitGroup(bits
));
810 RotBitsLeft (bits
, PGSZB
);
814 xor = GetBitGroup(bits
);
815 *dst
= MaskRRopPixels(*dst
, xor, endmask
);
819 DEALLOCATE_LOCAL(pptFree
);
820 DEALLOCATE_LOCAL(pwidthFree
);
824 cfb8OpaqueStipple32FS (pDrawable
, pGC
, nInit
, pptInit
, pwidthInit
, fSorted
)
825 DrawablePtr pDrawable
;
827 int nInit
; /* number of spans to fill */
828 DDXPointPtr pptInit
; /* pointer to list of start points */
829 int *pwidthInit
; /* pointer to list of n widths */
832 /* next three parameters are post-clip */
833 int n
; /* number of spans to fill */
834 DDXPointPtr ppt
; /* pointer to list of start points */
835 int *pwidth
; /* pointer to list of n widths */
836 CfbBits
*src
; /* pointer to bits in stipple, if needed */
837 int stippleHeight
; /* height of the stipple */
840 int nlwDst
; /* width in longwords of the dest pixmap */
841 int x
,y
,w
; /* current span */
844 register CfbBits
*dst
; /* pointer to bits we're writing */
849 CfbBits
*pbits
; /* pointer to start of pixmap */
850 register CfbBits
xor;
851 register CfbBits bits
; /* bits from stipple */
854 int *pwidthFree
; /* copies of the pointers to free */
856 cfbPrivGCPtr devPriv
;
858 devPriv
= cfbGetGCPrivate(pGC
);
860 cfb8CheckOpaqueStipple(pGC
->alu
, pGC
->fgPixel
, pGC
->bgPixel
, pGC
->planemask
);
862 n
= nInit
* miFindMaxBand(pGC
->pCompositeClip
);
865 pwidthFree
= (int *)ALLOCATE_LOCAL(n
* sizeof(int));
866 pptFree
= (DDXPointRec
*)ALLOCATE_LOCAL(n
* sizeof(DDXPointRec
));
867 if(!pptFree
|| !pwidthFree
)
869 if (pptFree
) DEALLOCATE_LOCAL(pptFree
);
870 if (pwidthFree
) DEALLOCATE_LOCAL(pwidthFree
);
875 n
= miClipSpans(pGC
->pCompositeClip
, pptInit
, pwidthInit
, nInit
,
876 ppt
, pwidth
, fSorted
);
878 stipple
= pGC
->pRotatedPixmap
;
879 src
= (CfbBits
*)stipple
->devPrivate
.ptr
;
880 stippleHeight
= stipple
->drawable
.height
;
882 cfbGetLongWidthAndPointer (pDrawable
, nlwDst
, pbits
)
890 dst
= pbits
+ (y
* nlwDst
) + (x
>> PWSH
);
891 if (((x
& PIM
) + w
) <= PPW
)
893 maskpartialbits(x
, w
, startmask
);
899 maskbits (x
, w
, startmask
, endmask
, nlw
);
901 bits
= src
[y
% stippleHeight
];
902 RotBitsLeft (bits
, (x
& ((PGSZ
-1) & ~PIM
)));
904 if (cfb8StippleRRop
== GXcopy
)
911 *dst
= (*dst
& ~startmask
) |
912 (GetPixelGroup (bits
) & startmask
);
914 RotBitsLeft (bits
, PGSZB
);
918 *dst
++ = GetPixelGroup(bits
);
919 RotBitsLeft (bits
, PGSZB
);
923 *dst
= (*dst
& ~endmask
) |
924 (GetPixelGroup (bits
) & endmask
);
928 { /* XXX consts probably not OK here */
929 wEnd
= 7 - (nlw
& 7);
930 nlw
= (nlw
>> 3) + 1;
935 *dstTmp
= (*dstTmp
& ~startmask
) |
936 (GetPixelGroup (bits
) & startmask
);
938 RotBitsLeft (bits
, PGSZB
);
946 xor = GetPixelGroup (bits
);
958 dst
= dstTmp
+ (nlwTmp
<< 3);
959 *dst
= (*dst
& ~endmask
) |
960 (GetPixelGroup (bits
) & endmask
);
967 xor = GetPixelGroup (bits
);
978 #endif /* PPW == 4 */
982 xor = GetBitGroup(bits
);
983 *dst
= MaskRRopPixels(*dst
, xor, startmask
);
985 RotBitsLeft (bits
, PGSZB
);
989 RRopBitGroup(dst
, GetBitGroup(bits
));
991 RotBitsLeft (bits
, PGSZB
);
995 xor = GetBitGroup(bits
);
996 *dst
= MaskRRopPixels(*dst
, xor, endmask
);
1000 DEALLOCATE_LOCAL(pptFree
);
1001 DEALLOCATE_LOCAL(pwidthFree
);
1004 #endif /* PSZ == 8 */