3 * Copyright 1996 The XFree86 Project
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * HARM HANEMAAYER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
20 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26 * Written by Mark Vojkovich. Loosly based on an original version
27 * written by Harm Hanemaayer (H.Hanemaayer@inter.nl.net) which
28 * only did solid rectangles and didn't have trapezoid support.
33 #ifdef HAVE_XORG_CONFIG_H
34 #include <xorg-config.h>
39 #include "xf86_OSproc.h"
42 #include "scrnintstr.h"
43 #include "pixmapstr.h"
52 #define POLY_FULLY_CLIPPED 1
53 #define POLY_IS_EASY 2
56 #define Setup(c,x,vertex,dx,dy,e,sign,step,DX) {\
58 if ((dy = intToY(c) - y)) { \
59 DX = dx = intToX(c) - x; \
85 #define Step(x,dx,dy,e,sign,step) {\
94 #define FixError(x, dx, dy, e, sign, step, h) { \
111 Checks CoordModeOrigin one rect polygons to see if we need
113 Returns: POLY_USE_MI, POLY_FULLY_CLIPPED or POLY_IS_EASY
114 as well as the pointer to the "top" point and the y
124 DDXPointPtr
*topPoint
, /* return */
125 int *topY
, int *bottomY
, /* return */
128 int c
= 0, vertex1
, vertex2
;
133 origin
-= (origin
& 0x8000) << 1;
134 vertex1
= *((int *) &extents
->x1
) - origin
;
135 vertex2
= *((int *) &extents
->x2
) - origin
/* - 0x00010001 */;
136 /* I think this was an error in cfb ^ */
138 if (shape
== Convex
) {
141 if (((c
- vertex1
) | (vertex2
- c
)) & 0x80008000)
150 if (c
> *bottomY
) *bottomY
= c
;
154 int dx2
, dx1
, x1
, x2
;
161 if (((c
- vertex1
) | (vertex2
- c
)) & 0x80008000)
169 if (c
> *bottomY
) *bottomY
= c
;
174 else dx2
= dx1
= (c
- x1
) >> 31;
175 } else if ((c
- x1
) >> 31 != dx1
) {
182 if (x1
!= dx1
) yFlip
++;
183 if (x1
!= dx2
) yFlip
++;
185 if(*topY
== *bottomY
)
186 return POLY_FULLY_CLIPPED
;
191 if (*topY
== *bottomY
)
192 return POLY_FULLY_CLIPPED
;
206 XAAInfoRecPtr infoRec
= GET_XAAINFORECPTR_FROM_GC(pGC
);
207 int origin
, vertex1
, vertex2
;
208 int *vertex1p
, *vertex2p
, *endp
;
210 int dx1
= 0, dx2
= 0, dy1
= 0, dy2
= 0;
211 int DX1
= 0, DX2
= 0, e1
= 0, e2
= 0;
212 int step1
= 0, step2
= 0, sign1
= 0, sign2
= 0;
213 int c
, y
, maxy
, h
, yoffset
;
214 DDXPointPtr topPoint
;
216 if(!REGION_NUM_RECTS(pGC
->pCompositeClip
))
219 if (mode
== CoordModePrevious
) {
220 register DDXPointPtr ppt
= ptsIn
+ 1;
222 for (origin
= 1; origin
< count
; origin
++, ppt
++) {
223 ppt
->x
+= (ppt
-1)->x
;
224 ppt
->y
+= (ppt
-1)->y
;
226 mode
= CoordModeOrigin
;
229 if (REGION_NUM_RECTS(pGC
->pCompositeClip
) != 1) {
230 miFillPolygon (pDraw
, pGC
, shape
, mode
, count
, ptsIn
);
234 origin
= coordToInt(pDraw
->x
, pDraw
->y
);
236 switch( XAAIsEasyPolygon(ptsIn
, count
, &pGC
->pCompositeClip
->extents
,
237 origin
, &topPoint
, &y
, &maxy
, shape
) ) {
239 miFillPolygon (pDraw
, pGC
, shape
, mode
, count
, ptsIn
);
240 case POLY_FULLY_CLIPPED
:
244 endp
= (int*)ptsIn
+ count
;
245 vertex2p
= vertex1p
= (int *)topPoint
;
248 vertex2
= vertex1
= *vertex2p
++;
249 if (vertex2p
== endp
)
250 vertex2p
= (int *) ptsIn
;
252 (*infoRec
->SetupForSolidFill
)(infoRec
->pScrn
, pGC
->fgPixel
, pGC
->alu
,
256 if (y
== intToY(vertex1
)) {
258 if (vertex1p
== (int *) ptsIn
)
261 Setup (c
,x1
,vertex1
,dx1
,dy1
,e1
,sign1
,step1
,DX1
)
262 } while (y
>= intToY(vertex1
));
265 Step(x1
,dx1
,dy1
,e1
,sign1
,step1
)
266 h
= intToY(vertex1
) - y
;
268 if (y
== intToY(vertex2
)) {
271 if (vertex2p
== endp
)
272 vertex2p
= (int *) ptsIn
;
273 Setup (c
,x2
,vertex2
,dx2
,dy2
,e2
,sign2
,step2
,DX2
)
274 } while (y
>= intToY(vertex2
));
278 Step(x2
,dx2
,dy2
,e2
,sign2
,step2
)
279 if ((c
= (intToY(vertex2
) - y
)) < h
)
283 /* fill spans for this segment */
285 if(infoRec
->SubsequentSolidFillTrap
&& (h
> 6)) {
290 Step(x1
,dx1
,dy1
,e1
,sign1
,step1
)
291 Step(x2
,dx2
,dy2
,e2
,sign2
,step2
)
298 (*infoRec
->SubsequentSolidFillTrap
)(infoRec
->pScrn
,
301 x2
- 1, DX2
, dy2
, e2
);
303 (*infoRec
->SubsequentSolidFillTrap
)(infoRec
->pScrn
,
306 x1
- 1, DX1
, dy1
, e1
);
309 FixError(x1
,dx1
,dy1
,e1
,sign1
,step1
,h
);
310 FixError(x2
,dx2
,dy2
,e2
,sign2
,step2
,h
);
316 (*infoRec
->SubsequentSolidFillRect
)(infoRec
->pScrn
,
317 x1
, y
+ yoffset
, x2
- x1
, 1);
319 (*infoRec
->SubsequentSolidFillRect
)(infoRec
->pScrn
,
320 x2
, y
+ yoffset
, x1
- x2
, 1);
323 Step(x1
,dx1
,dy1
,e1
,sign1
,step1
)
324 Step(x2
,dx2
,dy2
,e2
,sign2
,step2
)
329 (*infoRec
->SubsequentSolidFillRect
)(infoRec
->pScrn
,
330 x1
, y
+ yoffset
, x2
- x1
, h
);
332 (*infoRec
->SubsequentSolidFillRect
)(infoRec
->pScrn
,
333 x2
, y
+ yoffset
, x1
- x2
, h
);
338 if (y
== maxy
) break;
340 SET_SYNC_FLAG(infoRec
);
347 XAAFillPolygonHelper(
351 DDXPointPtr topPoint
,
355 RectFuncPtr RectFunc
,
356 TrapFuncPtr TrapFunc
,
359 XAACacheInfoPtr pCache
361 int *vertex1p
, *vertex2p
, *endp
;
362 int vertex1
, vertex2
;
364 int dx1
= 0, dx2
= 0, dy1
= 0, dy2
= 0;
365 int DX1
= 0, DX2
= 0, e1
= 0, e2
= 0;
366 int step1
= 0, step2
= 0, sign1
= 0, sign2
= 0;
370 endp
= (int*)ptsIn
+ count
;
371 vertex2p
= vertex1p
= (int *)topPoint
;
372 yoffset
= intToY(origin
);
373 origin
= intToX(origin
);
374 vertex2
= vertex1
= *vertex2p
++;
375 if (vertex2p
== endp
)
376 vertex2p
= (int *)ptsIn
;
379 if (y
== intToY(vertex1
)) {
381 if (vertex1p
== (int *) ptsIn
)
384 Setup (c
,x1
,vertex1
,dx1
,dy1
,e1
,sign1
,step1
,DX1
)
385 } while (y
>= intToY(vertex1
));
388 Step(x1
,dx1
,dy1
,e1
,sign1
,step1
)
389 h
= intToY(vertex1
) - y
;
391 if (y
== intToY(vertex2
)) {
394 if (vertex2p
== endp
)
395 vertex2p
= (int *) ptsIn
;
396 Setup (c
,x2
,vertex2
,dx2
,dy2
,e2
,sign2
,step2
,DX2
)
397 } while (y
>= intToY(vertex2
));
401 Step(x2
,dx2
,dy2
,e2
,sign2
,step2
)
402 if ((c
= (intToY(vertex2
) - y
)) < h
)
406 /* fill spans for this segment */
408 if(TrapFunc
&& (h
> 6)) {
413 Step(x1
,dx1
,dy1
,e1
,sign1
,step1
)
414 Step(x2
,dx2
,dy2
,e2
,sign2
,step2
)
421 (*TrapFunc
)(pScrn
, y
+ yoffset
, h
,
423 x2
- 1, DX2
, dy2
, e2
, xorg
, yorg
, pCache
);
425 (*TrapFunc
)(pScrn
, y
+ yoffset
, h
,
427 x1
- 1, DX1
, dy1
, e1
, xorg
, yorg
, pCache
);
430 FixError(x1
,dx1
,dy1
,e1
,sign1
,step1
,h
);
431 FixError(x2
,dx2
,dy2
,e2
,sign2
,step2
,h
);
438 x1
, y
+ yoffset
, x2
- x1
, 1, xorg
, yorg
, pCache
);
441 x2
, y
+ yoffset
, x1
- x2
, 1, xorg
, yorg
, pCache
);
444 Step(x1
,dx1
,dy1
,e1
,sign1
,step1
)
445 Step(x2
,dx2
,dy2
,e2
,sign2
,step2
)
451 x1
, y
+ yoffset
, x2
- x1
, h
, xorg
, yorg
, pCache
);
454 x2
, y
+ yoffset
, x1
- x2
, h
, xorg
, yorg
, pCache
);
459 if (y
== maxy
) break;
471 int x1
, int dx1
, int dy1
, int e1
,
472 int x2
, int dx2
, int dy2
, int e2
,
474 XAACacheInfoPtr pCache
476 XAAInfoRecPtr infoRec
= GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn
);
478 (*infoRec
->SubsequentSolidFillTrap
) (pScrn
,
479 y
, h
, x1
, dx1
, dy1
, e1
, x2
, dx2
, dy2
, e2
);
485 int x
, int y
, int w
, int h
,
487 XAACacheInfoPtr pCache
489 XAAInfoRecPtr infoRec
= GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn
);
491 (*infoRec
->SubsequentSolidFillRect
) (pScrn
, x
, y
, w
, h
);
495 /*********************\
496 | Mono 8x8 Patterns |
497 \*********************/
500 Mono8x8PatternTrapHelper_ScreenOrigin(
503 int x1
, int dx1
, int dy1
, int e1
,
504 int x2
, int dx2
, int dy2
, int e2
,
506 XAACacheInfoPtr pCache
508 XAAInfoRecPtr infoRec
= GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn
);
510 (*infoRec
->SubsequentMono8x8PatternFillTrap
) (pScrn
, xorg
, yorg
,
511 y
, h
, x1
, dx1
, dy1
, e1
, x2
, dx2
, dy2
, e2
);
515 Mono8x8PatternRectHelper_ScreenOrigin (
517 int x
, int y
, int w
, int h
,
519 XAACacheInfoPtr pCache
521 XAAInfoRecPtr infoRec
= GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn
);
523 (*infoRec
->SubsequentMono8x8PatternFillRect
) (pScrn
, xorg
, yorg
,
528 Mono8x8PatternRectHelper (
530 int x
, int y
, int w
, int h
,
532 XAACacheInfoPtr pCache
534 XAAInfoRecPtr infoRec
= GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn
);
536 xorg
= (x
- xorg
) & 0x07;
537 yorg
= (y
- yorg
) & 0x07;
539 if(!(infoRec
->Mono8x8PatternFillFlags
&
540 HARDWARE_PATTERN_PROGRAMMED_ORIGIN
)){
541 if(infoRec
->Mono8x8PatternFillFlags
&
542 HARDWARE_PATTERN_PROGRAMMED_BITS
) {
543 int patx
= pCache
->pat0
;
544 int paty
= pCache
->pat1
;
545 XAARotateMonoPattern(&patx
, &paty
, xorg
, yorg
,
546 (infoRec
->Mono8x8PatternFillFlags
&
547 BIT_ORDER_IN_BYTE_MSBFIRST
));
548 xorg
= patx
; yorg
= paty
;
550 int slot
= (yorg
<< 3) + xorg
;
551 xorg
= pCache
->x
+ pCache
->offsets
[slot
].x
;
552 yorg
= pCache
->y
+ pCache
->offsets
[slot
].y
;
557 (*infoRec
->SubsequentMono8x8PatternFillRect
) (pScrn
, xorg
, yorg
,
569 CacheExpandRectHelper (
571 int X
, int Y
, int Width
, int Height
,
573 XAACacheInfoPtr pCache
575 XAAInfoRecPtr infoRec
= GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn
);
576 int x
, phaseY
, phaseX
, skipleft
, w
, blit_w
, blit_h
;
579 cacheWidth
= (pCache
->w
* pScrn
->bitsPerPixel
) /
580 infoRec
->CacheColorExpandDensity
;
582 phaseY
= (Y
- yorg
) % pCache
->orig_h
;
583 if(phaseY
< 0) phaseY
+= pCache
->orig_h
;
584 phaseX
= (X
- xorg
) % pCache
->orig_w
;
585 if(phaseX
< 0) phaseX
+= pCache
->orig_w
;
588 w
= Width
; skipleft
= phaseX
; x
= X
;
589 blit_h
= pCache
->h
- phaseY
;
590 if(blit_h
> Height
) blit_h
= Height
;
593 blit_w
= cacheWidth
- skipleft
;
594 if(blit_w
> w
) blit_w
= w
;
595 (*infoRec
->SubsequentScreenToScreenColorExpandFill
)(
596 pScrn
, x
, Y
, blit_w
, blit_h
,
597 pCache
->x
, pCache
->y
+ phaseY
, skipleft
);
601 skipleft
= (skipleft
+ blit_w
) % pCache
->orig_w
;
606 phaseY
= (phaseY
+ blit_h
) % pCache
->orig_h
;
620 int X
, int Y
, int Width
, int Height
,
622 XAACacheInfoPtr pCache
624 XAAInfoRecPtr infoRec
= GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn
);
625 int x
, phaseY
, phaseX
, skipleft
, w
, blit_w
, blit_h
;
627 phaseY
= (Y
- yorg
) % pCache
->orig_h
;
628 if(phaseY
< 0) phaseY
+= pCache
->orig_h
;
629 phaseX
= (X
- xorg
) % pCache
->orig_w
;
630 if(phaseX
< 0) phaseX
+= pCache
->orig_w
;
633 w
= Width
; skipleft
= phaseX
; x
= X
;
634 blit_h
= pCache
->h
- phaseY
;
635 if(blit_h
> Height
) blit_h
= Height
;
638 blit_w
= pCache
->w
- skipleft
;
639 if(blit_w
> w
) blit_w
= w
;
640 (*infoRec
->SubsequentScreenToScreenCopy
)(pScrn
,
641 pCache
->x
+ skipleft
, pCache
->y
+ phaseY
,
642 x
, Y
, blit_w
, blit_h
);
646 skipleft
= (skipleft
+ blit_w
) % pCache
->orig_w
;
651 phaseY
= (phaseY
+ blit_h
) % pCache
->orig_h
;
656 /**********************\
657 | Stippled Polygons |
658 \**********************/
662 XAAFillPolygonStippled(
670 XAAInfoRecPtr infoRec
= GET_XAAINFORECPTR_FROM_GC(pGC
);
671 XAAPixmapPtr pPriv
= XAA_GET_PIXMAP_PRIVATE(pGC
->stipple
);
672 int origin
, type
, patx
, paty
, fg
, bg
;
673 int y
, maxy
, xorg
, yorg
;
674 DDXPointPtr topPoint
;
675 XAACacheInfoPtr pCache
= NULL
;
676 RectFuncPtr RectFunc
= NULL
;
677 TrapFuncPtr TrapFunc
= NULL
;
679 if(!REGION_NUM_RECTS(pGC
->pCompositeClip
))
682 if (mode
== CoordModePrevious
) {
683 register DDXPointPtr ppt
= ptsIn
+ 1;
685 for (origin
= 1; origin
< count
; origin
++, ppt
++) {
686 ppt
->x
+= (ppt
-1)->x
;
687 ppt
->y
+= (ppt
-1)->y
;
689 mode
= CoordModeOrigin
;
692 if (REGION_NUM_RECTS(pGC
->pCompositeClip
) != 1) {
693 miFillPolygon (pDraw
, pGC
, shape
, mode
, count
, ptsIn
);
698 if(pGC
->fillStyle
== FillStippled
) {
699 type
= (*infoRec
->StippledFillChooser
)(pGC
);
700 fg
= pGC
->fgPixel
; bg
= -1;
702 type
= (*infoRec
->OpaqueStippledFillChooser
)(pGC
);
703 fg
= pGC
->fgPixel
; bg
= pGC
->bgPixel
;
708 (*XAAFallbackOps
.FillPolygon
)(pDraw
, pGC
, shape
, mode
, count
, ptsIn
);
712 if((type
== DO_COLOR_EXPAND
) || (type
== DO_COLOR_8x8
)) {
713 miFillPolygon (pDraw
, pGC
, shape
, mode
, count
, ptsIn
);
717 origin
= *((int *)&pDraw
->x
);
719 switch( XAAIsEasyPolygon(ptsIn
, count
, &pGC
->pCompositeClip
->extents
,
720 origin
, &topPoint
, &y
, &maxy
, shape
) ) {
722 miFillPolygon (pDraw
, pGC
, shape
, mode
, count
, ptsIn
);
723 case POLY_FULLY_CLIPPED
:
727 xorg
= (pDraw
->x
+ pGC
->patOrg
.x
);
728 yorg
= (pDraw
->y
+ pGC
->patOrg
.y
);
731 if((fg
== bg
) && (bg
!= -1) && infoRec
->SetupForSolidFill
) {
733 (*infoRec
->SetupForSolidFill
)(infoRec
->pScrn
, fg
,
734 pGC
->alu
, pGC
->planemask
);
736 RectFunc
= SolidRectHelper
;
737 TrapFunc
= infoRec
->SubsequentSolidFillTrap
? SolidTrapHelper
: NULL
;
741 patx
= pPriv
->pattern0
; paty
= pPriv
->pattern1
;
742 if(infoRec
->Mono8x8PatternFillFlags
&
743 HARDWARE_PATTERN_SCREEN_ORIGIN
) {
744 xorg
= (-xorg
) & 0x07; yorg
= (-yorg
) & 0x07;
745 if(infoRec
->Mono8x8PatternFillFlags
&
746 HARDWARE_PATTERN_PROGRAMMED_BITS
) {
747 if(!(infoRec
->Mono8x8PatternFillFlags
&
748 HARDWARE_PATTERN_PROGRAMMED_ORIGIN
)) {
749 XAARotateMonoPattern(&patx
, &paty
, xorg
, yorg
,
750 (infoRec
->Mono8x8PatternFillFlags
&
751 BIT_ORDER_IN_BYTE_MSBFIRST
));
752 xorg
= patx
; yorg
= paty
;
755 XAACacheInfoPtr pCache
= (*infoRec
->CacheMono8x8Pattern
)(
756 infoRec
->pScrn
, patx
, paty
);
757 patx
= pCache
->x
; paty
= pCache
->y
;
758 if(!(infoRec
->Mono8x8PatternFillFlags
&
759 HARDWARE_PATTERN_PROGRAMMED_ORIGIN
)){
760 int slot
= (yorg
<< 3) + xorg
;
761 patx
+= pCache
->offsets
[slot
].x
;
762 paty
+= pCache
->offsets
[slot
].y
;
763 xorg
= patx
; yorg
= paty
;
766 RectFunc
= Mono8x8PatternRectHelper_ScreenOrigin
;
767 if(infoRec
->SubsequentMono8x8PatternFillTrap
)
768 TrapFunc
= Mono8x8PatternTrapHelper_ScreenOrigin
;
769 } else { /* !HARDWARE_PATTERN_SCREEN_ORIGIN */
770 if(!(infoRec
->Mono8x8PatternFillFlags
&
771 HARDWARE_PATTERN_PROGRAMMED_BITS
)){
772 pCache
= (*infoRec
->CacheMono8x8Pattern
)(
773 infoRec
->pScrn
, patx
, paty
);
774 patx
= pCache
->x
; paty
= pCache
->y
;
776 pCache
= &(infoRec
->ScratchCacheInfoRec
);
780 RectFunc
= Mono8x8PatternRectHelper
;
783 (*infoRec
->SetupForMono8x8PatternFill
)(infoRec
->pScrn
,
784 patx
, paty
, fg
, bg
, pGC
->alu
, pGC
->planemask
);
786 case DO_CACHE_EXPAND
:
787 pCache
= (*infoRec
->CacheMonoStipple
)(infoRec
->pScrn
, pGC
->stipple
);
789 (*infoRec
->SetupForScreenToScreenColorExpandFill
)(
790 infoRec
->pScrn
, fg
, bg
, pGC
->alu
, pGC
->planemask
);
792 RectFunc
= CacheExpandRectHelper
;
795 pCache
= (*infoRec
->CacheStipple
)(infoRec
->pScrn
, pGC
->stipple
,
797 (*infoRec
->SetupForScreenToScreenCopy
)(infoRec
->pScrn
, 1, 1,
798 pGC
->alu
, pGC
->planemask
, pCache
->trans_color
);
800 RectFunc
= CacheBltRectHelper
;
807 XAAFillPolygonHelper(infoRec
->pScrn
, ptsIn
, count
, topPoint
,
808 y
, maxy
, origin
, RectFunc
, TrapFunc
, xorg
, yorg
, pCache
);
810 SET_SYNC_FLAG(infoRec
);
816 /*******************\
818 \*******************/
830 XAAInfoRecPtr infoRec
= GET_XAAINFORECPTR_FROM_GC(pGC
);
831 XAAPixmapPtr pPriv
= XAA_GET_PIXMAP_PRIVATE(pGC
->tile
.pixmap
);
832 int origin
, type
, patx
, paty
;
833 int y
, maxy
, xorg
, yorg
;
834 DDXPointPtr topPoint
;
835 XAACacheInfoPtr pCache
= NULL
;
836 RectFuncPtr RectFunc
= NULL
;
837 TrapFuncPtr TrapFunc
= NULL
;
839 if(!REGION_NUM_RECTS(pGC
->pCompositeClip
))
842 if (mode
== CoordModePrevious
) {
843 register DDXPointPtr ppt
= ptsIn
+ 1;
845 for (origin
= 1; origin
< count
; origin
++, ppt
++) {
846 ppt
->x
+= (ppt
-1)->x
;
847 ppt
->y
+= (ppt
-1)->y
;
849 mode
= CoordModeOrigin
;
852 if (REGION_NUM_RECTS(pGC
->pCompositeClip
) != 1) {
853 miFillPolygon (pDraw
, pGC
, shape
, mode
, count
, ptsIn
);
858 type
= (*infoRec
->TiledFillChooser
)(pGC
);
860 if(!type
|| (type
== DO_IMAGE_WRITE
)) {
861 (*XAAFallbackOps
.FillPolygon
)(pDraw
, pGC
, shape
, mode
, count
, ptsIn
);
865 if(type
== DO_COLOR_8x8
) {
866 miFillPolygon (pDraw
, pGC
, shape
, mode
, count
, ptsIn
);
870 origin
= *((int *)&pDraw
->x
);
872 switch( XAAIsEasyPolygon(ptsIn
, count
, &pGC
->pCompositeClip
->extents
,
873 origin
, &topPoint
, &y
, &maxy
, shape
) ) {
875 miFillPolygon (pDraw
, pGC
, shape
, mode
, count
, ptsIn
);
876 case POLY_FULLY_CLIPPED
:
880 xorg
= (pDraw
->x
+ pGC
->patOrg
.x
);
881 yorg
= (pDraw
->y
+ pGC
->patOrg
.y
);
885 patx
= pPriv
->pattern0
; paty
= pPriv
->pattern1
;
886 if(infoRec
->Mono8x8PatternFillFlags
&
887 HARDWARE_PATTERN_SCREEN_ORIGIN
) {
888 xorg
= (-xorg
) & 0x07; yorg
= (-yorg
) & 0x07;
889 if(infoRec
->Mono8x8PatternFillFlags
&
890 HARDWARE_PATTERN_PROGRAMMED_BITS
) {
891 if(!(infoRec
->Mono8x8PatternFillFlags
&
892 HARDWARE_PATTERN_PROGRAMMED_ORIGIN
)) {
893 XAARotateMonoPattern(&patx
, &paty
, xorg
, yorg
,
894 (infoRec
->Mono8x8PatternFillFlags
&
895 BIT_ORDER_IN_BYTE_MSBFIRST
));
896 xorg
= patx
; yorg
= paty
;
899 XAACacheInfoPtr pCache
= (*infoRec
->CacheMono8x8Pattern
)(
900 infoRec
->pScrn
, patx
, paty
);
901 patx
= pCache
->x
; paty
= pCache
->y
;
902 if(!(infoRec
->Mono8x8PatternFillFlags
&
903 HARDWARE_PATTERN_PROGRAMMED_ORIGIN
)){
904 int slot
= (yorg
<< 3) + xorg
;
905 patx
+= pCache
->offsets
[slot
].x
;
906 paty
+= pCache
->offsets
[slot
].y
;
907 xorg
= patx
; yorg
= paty
;
910 RectFunc
= Mono8x8PatternRectHelper_ScreenOrigin
;
911 if(infoRec
->SubsequentMono8x8PatternFillTrap
)
912 TrapFunc
= Mono8x8PatternTrapHelper_ScreenOrigin
;
913 } else { /* !HARDWARE_PATTERN_SCREEN_ORIGIN */
914 if(!(infoRec
->Mono8x8PatternFillFlags
&
915 HARDWARE_PATTERN_PROGRAMMED_BITS
)){
916 pCache
= (*infoRec
->CacheMono8x8Pattern
)(
917 infoRec
->pScrn
, patx
, paty
);
918 patx
= pCache
->x
; paty
= pCache
->y
;
921 pCache
= &(infoRec
->ScratchCacheInfoRec
);
925 RectFunc
= Mono8x8PatternRectHelper
;
928 (*infoRec
->SetupForMono8x8PatternFill
)(infoRec
->pScrn
,
929 patx
, paty
, pPriv
->fg
, pPriv
->bg
, pGC
->alu
, pGC
->planemask
);
932 pCache
= (*infoRec
->CacheTile
)(infoRec
->pScrn
, pGC
->tile
.pixmap
);
933 (*infoRec
->SetupForScreenToScreenCopy
)(infoRec
->pScrn
, 1, 1,
934 pGC
->alu
, pGC
->planemask
, -1);
936 RectFunc
= CacheBltRectHelper
;
939 pCache
= &(infoRec
->ScratchCacheInfoRec
);
940 pCache
->x
= pPriv
->offscreenArea
->box
.x1
;
941 pCache
->y
= pPriv
->offscreenArea
->box
.y1
;
942 pCache
->w
= pCache
->orig_w
=
943 pPriv
->offscreenArea
->box
.x2
- pCache
->x
;
944 pCache
->h
= pCache
->orig_h
=
945 pPriv
->offscreenArea
->box
.y2
- pCache
->y
;
947 (*infoRec
->SetupForScreenToScreenCopy
)(infoRec
->pScrn
, 1, 1,
948 pGC
->alu
, pGC
->planemask
, -1);
950 RectFunc
= CacheBltRectHelper
;
956 XAAFillPolygonHelper(infoRec
->pScrn
, ptsIn
, count
, topPoint
,
957 y
, maxy
, origin
, RectFunc
, TrapFunc
, xorg
, yorg
, pCache
);
959 SET_SYNC_FLAG(infoRec
);