summaryrefslogtreecommitdiff
path: root/cfb/cfbply1rct.c
diff options
context:
space:
mode:
Diffstat (limited to 'cfb/cfbply1rct.c')
-rw-r--r--cfb/cfbply1rct.c70
1 files changed, 53 insertions, 17 deletions
diff --git a/cfb/cfbply1rct.c b/cfb/cfbply1rct.c
index b1e5c8ff1..e75708b96 100644
--- a/cfb/cfbply1rct.c
+++ b/cfb/cfbply1rct.c
@@ -25,6 +25,7 @@ in this Software without prior written authorization from The Open Group.
*
* Author: Keith Packard, MIT X Consortium
*/
+/* $XFree86: xc/programs/Xserver/cfb/cfbply1rct.c,v 3.9 2001/12/14 19:59:24 dawes Exp $ */
#include "X.h"
@@ -50,25 +51,32 @@ RROP_NAME(cfbFillPoly1Rect) (pDrawable, pGC, shape, mode, count, ptsIn)
{
cfbPrivGCPtr devPriv;
int nwidth;
- unsigned long *addrl, *addr;
+ CfbBits *addrl, *addr;
+#if PSZ == 24
+ CfbBits startmask, endmask;
+ register int pidx;
+#else
+#if PPW > 1
+ CfbBits mask, bits = ~((CfbBits)0);
+#endif
+#endif
int maxy;
int origin;
register int vertex1, vertex2;
- int c;
+ int c = 0;
BoxPtr extents;
int clip;
int y;
- int *vertex1p, *vertex2p;
+ int *vertex1p = NULL, *vertex2p;
int *endp;
- int x1, x2;
- int dx1, dx2;
- int dy1, dy2;
- int e1, e2;
- int step1, step2;
- int sign1, sign2;
+ int x1 = 0, x2 = 0;
+ int dx1 = 0, dx2 = 0;
+ int dy1 = 0, dy2 = 0;
+ int e1 = 0, e2 = 0;
+ int step1 = 0, step2 = 0;
+ int sign1 = 0, sign2 = 0;
int h;
int l, r;
- unsigned long mask, bits = ~((unsigned long)0);
int nmiddle;
RROP_DECLARE
@@ -80,7 +88,7 @@ RROP_NAME(cfbFillPoly1Rect) (pDrawable, pGC, shape, mode, count, ptsIn)
devPriv = cfbGetGCPrivate(pGC);
#ifdef NO_ONE_RECT
- if (REGION_NUM_RECTS(devPriv->pCompositeClip) != 1)
+ if (REGION_NUM_RECTS(pGC->pCompositeClip) != 1)
{
miFillPolygon (pDrawable, pGC, shape, mode, count, ptsIn);
return;
@@ -88,7 +96,7 @@ RROP_NAME(cfbFillPoly1Rect) (pDrawable, pGC, shape, mode, count, ptsIn)
#endif
origin = *((int *) &pDrawable->x);
vertex2 = origin - ((origin & 0x8000) << 1);
- extents = &devPriv->pCompositeClip->extents;
+ extents = &pGC->pCompositeClip->extents;
RROP_FETCH_GCPRIV(devPriv);
vertex1 = *((int *) &extents->x1) - vertex2;
vertex2 = *((int *) &extents->x2) - vertex2 - 0x00010001;
@@ -167,9 +175,9 @@ RROP_NAME(cfbFillPoly1Rect) (pDrawable, pGC, shape, mode, count, ptsIn)
return;
}
-#define AddrYPlus(a,y) (unsigned long *) (((unsigned char *) (a)) + (y) * nwidth)
+#define AddrYPlus(a,y) (CfbBits *) (((unsigned char *) (a)) + (y) * nwidth)
- cfbGetTypedWidthAndPointer(pDrawable, nwidth, addrl, unsigned char, unsigned long);
+ cfbGetTypedWidthAndPointer(pDrawable, nwidth, addrl, unsigned char, CfbBits);
addrl = AddrYPlus(addrl,y + pDrawable->y);
origin = intToX(origin);
vertex2p = vertex1p;
@@ -178,7 +186,7 @@ RROP_NAME(cfbFillPoly1Rect) (pDrawable, pGC, shape, mode, count, ptsIn)
vertex2p = (int *) ptsIn;
#define Setup(c,x,vertex,dx,dy,e,sign,step) {\
x = intToX(vertex); \
- if (dy = intToY(c) - y) { \
+ if ((dy = intToY(c) - y)) { \
dx = intToX(c) - x; \
step = 0; \
if (dx >= 0) \
@@ -273,13 +281,40 @@ RROP_NAME(cfbFillPoly1Rect) (pDrawable, pGC, shape, mode, count, ptsIn)
#define LWRD_SHIFT 3
#endif /* PGSZ */
+#if PSZ == 24
+ addr = (CfbBits *)((char *)addrl + ((l * 3) & ~0x03));
+#else /* PSZ == 24 */
#if PWSH > LWRD_SHIFT
l = l >> (PWSH - LWRD_SHIFT);
#endif
#if PWSH < LWRD_SHIFT
l = l << (LWRD_SHIFT - PWSH);
#endif
- addr = (unsigned long *) (((char *) addrl) + l);
+ addr = (CfbBits *) (((char *) addrl) + l);
+#endif /* PSZ == 24 */
+#if PSZ == 24
+ if (nmiddle <= 1){
+ if (nmiddle)
+ RROP_SOLID24(addr, l);
+ } else {
+ maskbits(l, nmiddle, startmask, endmask, nmiddle);
+ pidx = l & 3;
+ if (startmask){
+ RROP_SOLID_MASK(addr, startmask, pidx-1);
+ addr++;
+ if (pidx == 3)
+ pidx = 0;
+ }
+ while (--nmiddle >= 0){
+ RROP_SOLID(addr, pidx);
+ addr++;
+ if (++pidx == 3)
+ pidx = 0;
+ }
+ if (endmask)
+ RROP_SOLID_MASK(addr, endmask, pidx);
+ }
+#else /* PSZ == 24 */
#if PPW > 1
if (c + nmiddle < PPW)
{
@@ -301,10 +336,11 @@ RROP_NAME(cfbFillPoly1Rect) (pDrawable, pGC, shape, mode, count, ptsIn)
RROP_SOLID(addr); addr++;
}
#if PPW > 1
- if (mask = ~SCRRIGHT(bits, r & PIM))
+ if ((mask = ~SCRRIGHT(bits, r & PIM)))
RROP_SOLID_MASK(addr,mask);
}
#endif
+#endif /* PSZ == 24 */
if (!--h)
break;
addrl = AddrYPlus (addrl, 1);