1 /************************************************************
3 Copyright (c) 1989 X Consortium
5 Permission is hereby granted, free of charge, to any person obtaining a copy
6 of this software and associated documentation files (the "Software"), to deal
7 in the Software without restriction, including without limitation the rights
8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 copies of the Software, and to permit persons to whom the Software is
10 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 THE
18 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 Except as contained in this notice, the name of the X Consortium shall not be
23 used in advertising or otherwise to promote the sale, use or other dealings
24 in this Software without prior written authorization from the X Consortium.
26 ********************************************************/
28 /* GJA -- Took mfb code and modified it. */
30 #ifdef HAVE_XORG_CONFIG_H
31 #include <xorg-config.h>
35 #include "OScompiler.h"
40 #include "mifillarc.h"
43 #include "xf86str.h" /* for pScrn->vtSema */
44 extern ScrnInfoPtr
*xf86Screens
;
54 int yk
, xk
, ym
, xm
, dx
, dy
, xorg
, yorg
;
62 int startmask
, endmask
, nlmiddle
;
64 if (pDraw
->type
== DRAWABLE_WINDOW
)
67 (((PixmapPtr
)(pDraw
->pScreen
->devPrivate
))->devPrivate
.ptr
);
69 (((PixmapPtr
)(pDraw
->pScreen
->devPrivate
))->devKind
) >> 2;
73 addrlt
= (int *)(((PixmapPtr
)pDraw
)->devPrivate
.ptr
);
74 nlwidth
= (int)(((PixmapPtr
)pDraw
)->devKind
) >> 2;
77 miFillArcSetup(arc
, &info
);
82 addrlt
+= nlwidth
* (yorg
- y
);
83 addrlb
+= nlwidth
* (yorg
+ y
+ dy
);
92 addrl
= addrlt
+ (xpos
>> PWSH
);
93 if (((xpos
& PIM
) + slw
) < PPW
)
95 maskpartialbits(xpos
, slw
, startmask
);
96 UPDRW(addrl
,startmask
);
97 if (miFillArcLower(slw
))
99 addrl
= addrlb
+ (xpos
>> PWSH
);
100 UPDRW(addrl
,startmask
);
104 maskbits(xpos
, slw
, startmask
, endmask
, nlmiddle
);
107 UPDRW(addrl
,startmask
); addrl
++;
111 UPDRW(addrl
,~0); addrl
++;
115 UPDRW(addrl
,endmask
);
117 if (!miFillArcLower(slw
))
119 addrl
= addrlb
+ (xpos
>> PWSH
);
122 UPDRW(addrl
,startmask
); addrl
++;
126 UPDRW(addrl
,~0); addrl
++;
130 UPDRW(addrl
,endmask
);
135 #define FILLSPAN(xl,xr,addr) \
138 width = xr - xl + 1; \
139 addrl = addr + (xl >> PWSH); \
140 if (((xl & PIM) + width) < PPW) \
142 maskpartialbits(xl, width, startmask); \
143 UPDRW(addrl,startmask); \
147 maskbits(xl, width, startmask, endmask, nlmiddle); \
150 UPDRW(addrl,startmask); addrl++; \
154 UPDRW(addrl,~0); addrl++; \
158 UPDRW(addrl,endmask); \
163 #define FILLSLICESPANS(flip,addr) \
166 FILLSPAN(xl, xr, addr); \
171 FILLSPAN(xc, xr, addr); \
173 FILLSPAN(xl, xc, addr); \
177 v16FillArcSliceSolidCopy
186 int yk
, xk
, ym
, xm
, dx
, dy
, xorg
, yorg
, slw
;
187 register int x
, y
, e
;
191 int *addrlt
, *addrlb
;
194 int startmask
, endmask
, nlmiddle
;
196 if (pDraw
->type
== DRAWABLE_WINDOW
)
199 (((PixmapPtr
)(pDraw
->pScreen
->devPrivate
))->devPrivate
.ptr
);
201 (((PixmapPtr
)(pDraw
->pScreen
->devPrivate
))->devKind
) >> 2;
205 addrlt
= (int *)(((PixmapPtr
)pDraw
)->devPrivate
.ptr
);
206 nlwidth
= (int)(((PixmapPtr
)pDraw
)->devKind
) >> 2;
209 miFillArcSetup(arc
, &info
);
210 miFillArcSliceSetup(arc
, &slice
, pGC
);
215 addrlt
+= nlwidth
* (yorg
- y
);
216 addrlb
+= nlwidth
* (yorg
+ y
+ dy
);
217 slice
.edge1
.x
+= pDraw
->x
;
218 slice
.edge2
.x
+= pDraw
->x
;
224 MIARCSLICESTEP(slice
.edge1
);
225 MIARCSLICESTEP(slice
.edge2
);
226 if (miFillSliceUpper(slice
))
228 MIARCSLICEUPPER(xl
, xr
, slice
, slw
);
229 FILLSLICESPANS(slice
.flip_top
, addrlt
);
231 if (miFillSliceLower(slice
))
233 MIARCSLICELOWER(xl
, xr
, slice
, slw
);
234 FILLSLICESPANS(slice
.flip_bot
, addrlb
);
240 xf4bppPolyFillArcSolid
242 register DrawablePtr pDraw
,
256 priv
= (mfbPrivGC
*) pGC
->devPrivates
[mfbGetGCPrivateIndex()].ptr
;
258 if ((rop
== RROP_NOP
) || !(pGC
->planemask
& 1))
260 if ( !(pGC
->planemask
& 0x0F))
263 cclip
= pGC
->pCompositeClip
;
264 for (arc
= parcs
, i
= narcs
; --i
>= 0; arc
++)
266 if (miFillArcEmpty(arc
))
268 if (miCanFillArc(arc
))
270 box
.x1
= arc
->x
+ pDraw
->x
;
271 box
.y1
= arc
->y
+ pDraw
->y
;
272 box
.x2
= box
.x1
+ (int)arc
->width
+ 1;
273 box
.y2
= box
.y1
+ (int)arc
->height
+ 1;
274 if (RECT_IN_REGION(pDraw
->pScreen
, cclip
, &box
) == rgnIN
)
276 if ((arc
->angle2
>= FULLCIRCLE
) ||
277 (arc
->angle2
<= -FULLCIRCLE
))
278 DO_WM3(pGC
,v16FillEllipseSolid(pDraw
, arc
))
280 DO_WM3(pGC
,v16FillArcSliceSolidCopy(pDraw
, pGC
, arc
))
284 miPolyFillArc(pDraw
, pGC
, 1, arc
);
289 xf4bppPolyFillArc(pDraw
, pGC
, narcs
, parcs
)
290 register DrawablePtr pDraw
;
295 if ( !xf86Screens
[pDraw
->pScreen
->myNum
]->vtSema
|| (pGC
->fillStyle
!= FillSolid
) ) {
296 miPolyFillArc(pDraw
, pGC
, narcs
, parcs
);
298 xf4bppPolyFillArcSolid(pDraw
, pGC
, narcs
, parcs
);