diff options
author | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-14 16:49:22 +0000 |
---|---|---|
committer | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-14 16:49:22 +0000 |
commit | d568221710959cf7d783e6ff0fb80fb43a231124 (patch) | |
tree | 8d6f039393294c6ffac8533639afdebe5d68bfc1 /cfb/cfb8line.c | |
parent | 9508a382f8a9f241dab097d921b6d290c1c3a776 (diff) |
XFree86 4.3.0.1xf86-4_3_0_1PRE_xf86-4_3_0_1
Diffstat (limited to 'cfb/cfb8line.c')
-rw-r--r-- | cfb/cfb8line.c | 619 |
1 files changed, 598 insertions, 21 deletions
diff --git a/cfb/cfb8line.c b/cfb/cfb8line.c index 7a5f1ac5d..f06abe084 100644 --- a/cfb/cfb8line.c +++ b/cfb/cfb8line.c @@ -24,6 +24,9 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * * Author: Keith Packard, MIT X Consortium + * + * $XFree86: xc/programs/Xserver/cfb/cfb8line.c,v 3.18 2002/09/18 17:11:47 tsi Exp $ + * Jeff Anton'x fixes: cfb8line.c 97/02/07 */ #include "X.h" @@ -64,7 +67,8 @@ in this Software without prior written authorization from The Open Group. #ifdef POLYSEGMENT -# ifdef sun +# if (defined(sun) || defined(__bsdi__)) && \ + (defined(sparc) || defined(__sparc__)) # define WIDTH_FAST 1152 # endif @@ -140,6 +144,119 @@ in this Software without prior written authorization from The Open Group. # endif #endif +#if PSZ == 24 +#define PXL2ADR(x) ((x)*3 >> 2) + +#if RROP == GXcopy +#define body_rop \ + addrp = (PixelType *)((unsigned long)addrb & ~0x03); \ + switch((unsigned long)addrb & 3){ \ + case 0: \ + *addrp = (*addrp & 0xFF000000)|(piQxelXor[0] & 0xFFFFFF); \ + break; \ + case 1: \ + *addrp = (*addrp & 0xFF)|(piQxelXor[2] & 0xFFFFFF00); \ + break; \ + case 3: \ + *addrp = (*addrp & 0xFFFFFF)|(piQxelXor[0] & 0xFF000000); \ + *(addrp+1)=(*(addrp+1) & 0xFFFF0000)|(piQxelXor[1] & 0xFFFF); \ + break; \ + case 2: \ + *addrp = (*addrp & 0xFFFF)|(piQxelXor[1] & 0xFFFF0000); \ + *(addrp+1)=(*(addrp+1) & 0xFFFFFF00)|(piQxelXor[2] & 0xFF); \ + break; \ + } +#endif +#if RROP == GXxor +#define body_rop \ + addrp = (PixelType *)((unsigned long)addrb & ~0x03); \ + switch((unsigned long)addrb & 3){ \ + case 0: \ + *addrp ^= piQxelXor[0] & 0xFFFFFF; \ + break; \ + case 1: \ + *addrp ^= piQxelXor[2] & 0xFFFFFF00; \ + break; \ + case 3: \ + *addrp ^= piQxelXor[0] & 0xFF000000; \ + *(addrp+1) ^= piQxelXor[1] & 0xFFFF; \ + break; \ + case 2: \ + *addrp ^= piQxelXor[1] & 0xFFFF0000; \ + *(addrp+1) ^= piQxelXor[2] & 0xFF; \ + break; \ + } +#endif +#if RROP == GXand +#define body_rop \ + addrp = (PixelType *)((unsigned long)addrb & ~0x03); \ + switch((unsigned long)addrb & 3){ \ + case 0: \ + *addrp &= piQxelAnd[0] | 0xFF000000; \ + break; \ + case 1: \ + *addrp &= piQxelAnd[2] | 0xFF; \ + break; \ + case 3: \ + *addrp &= 0xFFFFFF | piQxelAnd[0]; \ + *(addrp+1) &= 0xFFFF0000 | piQxelAnd[1]; \ + break; \ + case 2: \ + *addrp &= 0xFFFF | piQxelAnd[1]; \ + *(addrp+1) &= 0xFFFFFF00 | piQxelAnd[2]; \ + break; \ + } +#endif +#if RROP == GXor +#define body_rop \ + addrp = (PixelType *)((unsigned long)addrb & ~0x03); \ + switch((unsigned long)addrb & 3){ \ + case 0: \ + *addrp |= piQxelOr[0] & 0xFFFFFF; \ + break; \ + case 1: \ + *addrp |= piQxelOr[2] & 0xFFFFFF00; \ + break; \ + case 3: \ + *addrp |= piQxelOr[0] & 0xFF000000; \ + *(addrp+1) |= piQxelOr[1] & 0xFFFF; \ + break; \ + case 2: \ + *addrp |= piQxelOr[1] & 0xFFFF0000; \ + *(addrp+1) |= piQxelOr[2] & 0xFF; \ + break; \ + } +#endif +#if RROP == GXset +#define body_rop \ + addrp = (PixelType *)((unsigned long)addrb & ~0x03); \ + switch((unsigned long)addrb & 3){ \ + case 0: \ + *addrp = (*addrp & (piQxelAnd[0]|0xFF000000)) \ + ^ (piQxelXor[0] & 0xFFFFFF); \ + break; \ + case 1: \ + *addrp = (*addrp & (piQxelAnd[2]|0xFF)) \ + ^ (piQxelXor[2] & 0xFFFFFF00); \ + break; \ + case 3: \ + *addrp = (*addrp & (piQxelAnd[0]|0xFFFFFF)) \ + ^ (piQxelXor[0] & 0xFF000000); \ + *(addrp+1) = (*(addrp+1) & (piQxelAnd[1]|0xFFFF0000)) \ + ^ (piQxelXor[1] & 0xFFFF); \ + break; \ + case 2: \ + *addrp = (*addrp & (piQxelAnd[1]|0xFFFF)) \ + ^ (piQxelXor[1] & 0xFFFF0000); \ + *(addrp+1) = (*(addrp+1) & (piQxelAnd[2]|0xFFFFFF00)) \ + ^ (piQxelXor[2] & 0xFF); \ + break; \ + } +#endif +#endif /* PSZ == 24 */ + +#define BUGFIX_clip + #ifdef INCLUDE_DRAW int @@ -158,7 +275,7 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, int npt; /* number of points */ DDXPointPtr pptInit, pptInitOrig; int *x1p, *y1p, *x2p, *y2p; -#endif /* POLYSEGEMENT */ +#endif /* POLYSEGMENT */ { register long e; register int y1_or_e1; @@ -180,8 +297,8 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, #else register int c2; #endif -#ifndef ORIGIN - register int _x1, _y1, _x2, _y2; /* only used for CoordModePrevious */ +#if !defined(ORIGIN) && !defined(POLYSEGMENT) + register int _x1 = 0, _y1 = 0, _x2 = 0, _y2 = 0; int extents_x1, extents_y1, extents_x2, extents_y2; #endif /* !ORIGIN */ #ifndef PREVIOUS @@ -213,6 +330,16 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, cfbPrivGCPtr devPriv; BoxPtr extents; int *ppt; +#if PSZ == 24 + int xBase; /* x of addr */ + int xOffset; /* x of addrp */ + PixelType *addrLineEnd; + char *addrb; + int stepmajor3, stepminor3, majordx, minordx; +#endif +#ifdef BUGFIX_clip + int ex_x1, ex_y1, ex_x2, ex_y2; +#endif int octant; unsigned int bias = miGetZeroLineBias(pDrawable->pScreen); @@ -221,14 +348,25 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, #ifndef REARRANGE RROP_FETCH_GCPRIV(devPriv); #endif - extents = &devPriv->pCompositeClip->extents; + extents = &pGC->pCompositeClip->extents; #ifndef PREVIOUS c2 = *((int *) &pDrawable->x); c2 -= (c2 & 0x8000) << 1; upperleft = *((int *) &extents->x1) - c2; lowerright = *((int *) &extents->x2) - c2 - 0x00010001; #endif /* !PREVIOUS */ +#ifdef BUGFIX_clip + ex_x1 = extents->x1 - pDrawable->x; + ex_y1 = extents->y1 - pDrawable->y; + ex_x2 = extents->x2 - pDrawable->x; + ex_y2 = extents->y2 - pDrawable->y; +#endif +#if PSZ == 24 + xBase = pDrawable->x; + addr += WIDTH_MUL(pDrawable->y,nwidth); +#else addr = addr + WIDTH_MUL(pDrawable->y,nwidth) + pDrawable->x; +#endif #ifdef POLYSEGMENT capStyle = pGC->capStyle - CapNotLast; ppt = (int *) pSegInit; @@ -256,7 +394,14 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, *y2p = _y1 + _y2; return 1; } +#if PSZ == 24 + addrLineEnd = addr + WIDTH_MUL(_y1, nwidth); + xOffset = xBase + _x1; + addrb = (char *)addrLineEnd + xOffset * 3; + addrp = (PixelType *)((unsigned long)addrb & ~0x03); +#else addrp = addr + WIDTH_MUL(_y1, nwidth) + _x1; +#endif _x2 = _x1; _y2 = _y1; } @@ -275,7 +420,14 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, #ifdef SAVE_X2Y2 intToCoord(c2,x2,y2); #endif +#if PSZ == 24 + addrLineEnd = addr + WIDTH_MUL(Y2, nwidth); + xOffset = xBase + X2; + addrb = (char *)addrLineEnd + xOffset * 3; + addrp = (PixelType *)((unsigned long)addrb & ~0x03); +#else addrp = addr + WIDTH_MUL(Y2, nwidth) + X2; +#endif } #endif /* !PREVIOUS */ while (--npt) @@ -289,7 +441,14 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, break; intToCoord(y1_or_e1,x1_or_len,y1_or_e1); /* compute now to avoid needing x1, y1 later */ +#if PSZ == 24 + addrLineEnd = addr + WIDTH_MUL(y1_or_e1, nwidth); + xOffset = xBase + x1_or_len; + addrb = (char *)addrLineEnd + xOffset * 3; + addrp = (PixelType *)((unsigned long)addrb & ~0x03); +#else addrp = addr + WIDTH_MUL(y1_or_e1, nwidth) + x1_or_len; +#endif #else /* !POLYSEGMENT */ #ifdef EITHER_MODE if (!mode) @@ -304,8 +463,13 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, _x2 = _x1 + _x2; _y2 = _y1 + _y2; +#ifdef BUGFIX_clip + if (_x2 < ex_x1 || _x2 >= ex_x2 || + _y2 < ex_y1 || _y2 >= ex_y2) +#else if (_x2 < extents_x1 || _x2 >= extents_x2 || _y2 < extents_y1 || _y2 >= extents_y2) +#endif { break; } @@ -384,6 +548,32 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, FIXUP_ERROR(e, octant, bias); +#if PSZ == 24 + if (stepmajor == 1 || stepmajor == -1){ + stepmajor3 = stepmajor * 3; + stepminor3 = stepminor * sizeof (CfbBits); + majordx = stepmajor; minordx = 0; + } else { + stepmajor3 = stepmajor * sizeof (CfbBits); + stepminor3 = stepminor * 3; + majordx = 0; minordx = stepminor; + } +#endif + +#if PSZ == 24 +#define body {\ + body_rop \ + addrb += stepmajor3; \ + xOffset += majordx; \ + e += y1_or_e1; \ + if (e >= 0){ \ + addrb += stepminor3; \ + xOffset += minordx; \ + e += e3; \ + } \ + } +#else /* PSZ == 24 */ + #define body {\ RROP_SOLID(addrp); \ addrp += stepmajor; \ @@ -394,6 +584,7 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, e += e3; \ } \ } +#endif /* PSZ == 24 */ #ifdef LARGE_INSTRUCTION_CACHE @@ -447,13 +638,20 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, #endif /* LARGE_INSTRUCTION_CACHE */ #ifdef POLYSEGMENT +#if PSZ == 24 + body_rop +#else RROP_SOLID(addrp); #endif +#endif +#if PSZ == 24 + addrp = (PixelType *)((unsigned long)addrb & ~0x03); +#endif } #undef body #ifdef POLYSEGMENT } - else + else /* Polysegment horizontal line optimization */ { # ifdef REARRANGE register int e3; @@ -462,19 +660,40 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, # endif /* REARRANGE */ if (stepmajor < 0) { +#if PSZ == 24 + xOffset -= x1_or_len; + addrp = addrLineEnd + PXL2ADR(xOffset); +#else addrp -= x1_or_len; +#endif if (capStyle) x1_or_len++; else +#if PSZ == 24 + xOffset++; + addrp = addrLineEnd + PXL2ADR(xOffset); +#else addrp++; +#endif } else { +#if PSZ == 24 + addrp = addrLineEnd + PXL2ADR(xOffset); +#endif if (capStyle) x1_or_len++; } - y1_or_e1 = ((int) addrp) & PIM; +# if PSZ == 24 + y1_or_e1 = xOffset & 3; +# else +# if PGSZ == 64 /* PIM value from <cfbmskbits.h> is not it! (for 16/32 PSZ)*/ + y1_or_e1 = ((long) addrp) & 0x7; addrp = (PixelType *) (((unsigned char *) addrp) - y1_or_e1); +# else + y1_or_e1 = ((long) addrp) & PIM; + addrp = (PixelType *) (((unsigned char *) addrp) - y1_or_e1); +# endif #if PGSZ == 32 # if PWSH != 2 y1_or_e1 >>= (2 - PWSH); @@ -484,12 +703,219 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, y1_or_e1 >>= (3 - PWSH); # endif #endif /* PGSZ */ +# endif /* PSZ == 24 */ +#if PSZ == 24 + { +#if RROP == GXcopy + register int nlmiddle; + int leftIndex = xOffset & 3; + int rightIndex = (xOffset + x1_or_len) & 3; +#else + register int pidx; +#endif + +#if RROP == GXcopy + nlmiddle = x1_or_len; + if(leftIndex){ + nlmiddle -= (4 - leftIndex); + } + if(rightIndex){ + nlmiddle -= rightIndex; + } + + nlmiddle >>= 2; + switch(leftIndex+x1_or_len){ + case 4: + switch(leftIndex){ + case 0: + *addrp++ = piQxelXor[0]; + *addrp++ = piQxelXor[1]; + *addrp = piQxelXor[2]; + break; + case 1: + *addrp = ((*addrp) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); + addrp++; + *addrp = piQxelXor[1]; + addrp++; + *addrp = piQxelXor[2]; + break; + case 2: + *addrp = ((*addrp) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000); + addrp++; + *addrp = piQxelXor[2]; + break; + case 3: + *addrp = ((*addrp) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00); + break; + } + break; + case 3: + switch(leftIndex){ + case 0: + *addrp++ = piQxelXor[0]; + *addrp++ = piQxelXor[1]; + *addrp = ((*addrp) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); + break; + case 1: + *addrp = ((*addrp) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); + addrp++; + *addrp = piQxelXor[1]; + addrp++; + *addrp = ((*addrp) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); + break; + case 2: + *addrp = ((*addrp) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000); + addrp++; + *addrp = ((*addrp) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); + break; + } + break; + case 2: + switch(leftIndex){ +/* + case 2: + *addrp = ((*addrp) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000); + addrp++; + *addrp = ((*addrp) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); + break; +*/ + case 1: + *addrp = ((*addrp) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); + addrp++; + *addrp = ((*addrp) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); + break; + case 0: + *addrp++ = piQxelXor[0]; + *addrp = ((*addrp) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); + break; + } + break; + case 1: /*only if leftIndex = 0 and w = 1*/ + if(x1_or_len){ + *addrp = ((*addrp) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF); + } +/* + else{ + *addrp = ((*addrp) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); + addrp++; + *addrp = ((*addrp) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); + } +*/ + break; + case 0: /*never*/ + break; + default: + { +/* + maskbits(y1_or_e1, x1_or_len, e, e3, x1_or_len) +*/ + switch(leftIndex){ + case 0: + break; + case 1: + *addrp = ((*addrp) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); + addrp++; + *addrp = piQxelXor[1]; + addrp++; + *addrp = piQxelXor[2]; + addrp++; + break; + case 2: + *addrp = ((*addrp) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000); + addrp++; + *addrp = piQxelXor[2]; + addrp++; + break; + case 3: + *addrp = ((*addrp) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00); + addrp++; + break; + } + while(nlmiddle--){ + *addrp++ = piQxelXor[0]; + *addrp++ = piQxelXor[1]; + *addrp++ = piQxelXor[2]; + } + switch(rightIndex++){ + case 0: + break; + case 1: + *addrp = ((*addrp) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF); + break; + case 2: + *addrp++ = piQxelXor[0]; + *addrp = ((*addrp) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); + break; + case 3: + *addrp++ = piQxelXor[0]; + *addrp++ = piQxelXor[1]; + *addrp = ((*addrp) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); + break; + } +/* + if (e3){ + e3 &= 0xFFFFFF; + switch(rightIndex&3){ + case 0: + *addrp = ((*addrp) & (0xFF000000 | ~e3)) + | (piQxelXor[0] & 0xFFFFFF & e3); + break; + case 1: + *addrp = ((*addrp) & (0xFFFFFF | ~(e3<<24))) + + (piQxelXor[0] & 0xFF000000 & (e3<<24)); + addrp++; + *addrp = ((*addrp) & (0xFFFF0000|~(e3 >> 8))) + | (piQxelXor[1] & 0xFFFF & (e3 >> 8)); + break; + case 2: + *addrp = ((*addrp) & (0xFFFF|~(e3 << 16))) + | (piQxelXor[1] & 0xFFFF0000 & (e3 << 16)); + addrp++; + *addrp = ((*addrp) & (0xFFFFFF00|~(e3>>16))) + | (piQxelXor[2] & 0xFF & (e3 >> 16)); + break; + case 3: + *addrp = ((*addrp) & (0xFF|~(e3<<8))) + | (piQxelXor[2] & 0xFFFFFF00 & (e3<<8)); + addrp++; + break; + } + } +*/ + } + } +#else /* GXcopy */ + addrp = (PixelType *)((char *)addrLineEnd + ((xOffset * 3) & ~0x03)); + if (x1_or_len <= 1){ + if (x1_or_len) + RROP_SOLID24(addrp, xOffset); + } else { + maskbits(xOffset, x1_or_len, e, e3, x1_or_len); + pidx = xOffset & 3; + if (e){ + RROP_SOLID_MASK(addrp, e, pidx-1); + addrp++; + if (pidx == 3) + pidx = 0; + } + while (--x1_or_len >= 0){ + RROP_SOLID(addrp, pidx); + addrp++; + if (++pidx == 3) + pidx = 0; + } + if (e3) + RROP_SOLID_MASK(addrp, e3, pidx); + } +#endif /* GXcopy */ + } +#else /* PSZ == 24 */ if (y1_or_e1 + x1_or_len <= PPW) { if (x1_or_len) { maskpartialbits(y1_or_e1, x1_or_len, e) - RROP_SOLID_MASK((unsigned long *) addrp, e); + RROP_SOLID_MASK((CfbBits *) addrp, e); } } else @@ -497,13 +923,14 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, maskbits(y1_or_e1, x1_or_len, e, e3, x1_or_len) if (e) { - RROP_SOLID_MASK((unsigned long *) addrp, e); + RROP_SOLID_MASK((CfbBits *) addrp, e); addrp += PPW; } RROP_SPAN(addrp, x1_or_len) if (e3) - RROP_SOLID_MASK((unsigned long *) addrp, e3); + RROP_SOLID_MASK((CfbBits *) addrp, e3); } +#endif /* PSZ == 24 */ } #endif /* POLYSEGMENT */ } @@ -526,9 +953,7 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, #endif /* !ORIGIN */ return ((DDXPointPtr) ppt - pptInit) - 1; } -#endif /* POLYSEGMENT */ -#ifndef POLYSEGMENT # ifndef ORIGIN # define C2 c2 # else @@ -558,7 +983,100 @@ FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, RROP_FETCH_GCPRIV(devPriv); # endif +#if PSZ == 24 +#if RROP == GXcopy + switch(xOffset & 3){ + case 0: + *addrp = ((*addrp)&0xFF000000)|(piQxelXor[0] & 0xFFFFFF); + break; + case 3: + *addrp = ((*addrp)&0xFF)|(piQxelXor[2] & 0xFFFFFF00); + break; + case 1: + *addrp = ((*addrp)&0xFFFFFF)|(piQxelXor[0] & 0xFF000000); + *(addrp+1) = ((*(addrp+1))&0xFFFF0000)|(piQxelXor[1] & 0xFFFF); + break; + case 2: + *addrp = ((*addrp)&0xFFFF)|(piQxelXor[1] & 0xFFFF0000); + *(addrp+1) = ((*(addrp+1))&0xFFFFFF00)|(piQxelXor[2] & 0xFF); + break; + } +#endif +#if RROP == GXxor + switch(xOffset & 3){ + case 0: + *addrp ^= (piQxelXor[0] & 0xFFFFFF); + break; + case 3: + *addrp ^= (piQxelXor[2] & 0xFFFFFF00); + break; + case 1: + *addrp ^= (piQxelXor[0] & 0xFF000000); + *(addrp+1) ^= (piQxelXor[1] & 0xFFFF); + break; + case 2: + *addrp ^= (piQxelXor[1] & 0xFFFF0000); + *(addrp+1) ^= (piQxelXor[2] & 0xFF); + break; + } +#endif +#if RROP == GXand + switch(xOffset & 3){ + case 0: + *addrp &= (piQxelAnd[0] | 0xFF000000); + break; + case 3: + *addrp &= (piQxelAnd[2] | 0xFF); + break; + case 1: + *addrp &= (0xFFFFFF|piQxelAnd[0]); + *(addrp+1) &= (0xFFFF0000|piQxelAnd[1]); + break; + case 2: + *addrp &= (0xFFFF|piQxelAnd[1]); + *(addrp+1) &= (0xFFFFFF00|piQxelAnd[2]); + break; + } +#endif +#if RROP == GXor + switch(xOffset & 3){ + case 0: + *addrp |= (piQxelOr[0] & 0xFFFFFF); + break; + case 3: + *addrp |= (piQxelOr[2] & 0xFFFFFF00); + break; + case 1: + *addrp |= (piQxelOr[0] & 0xFF000000); + *(addrp+1) |= (piQxelOr[1] & 0xFFFF); + break; + case 2: + *addrp |= (piQxelOr[1] & 0xFFFF0000); + *(addrp+1) |= (piQxelOr[2] & 0xFF); + break; + } +#endif +#if RROP == GXset + switch(xOffset & 3){ + case 0: + *addrp = (((*addrp)&(piQxelAnd[0] |0xFF000000))^(piQxelXor[0] & 0xFFFFFF)); + break; + case 3: + *addrp = (((*addrp)&(piQxelAnd[2]|0xFF))^(piQxelXor[2] & 0xFFFFFF00)); + break; + case 1: + *addrp = (((*addrp)&(piQxelAnd[0]|0xFFFFFF))^(piQxelXor[0] & 0xFF000000)); + *(addrp+1) = (((*(addrp+1))&(piQxelAnd[1]|0xFFFF0000))^(piQxelXor[1] & 0xFFFF)); + break; + case 2: + *addrp = (((*addrp)&(piQxelAnd[1]|0xFFFF))^(piQxelXor[1] & 0xFFFF0000)); + *(addrp+1) = (((*(addrp+1))&(piQxelAnd[2]|0xFFFFFF00))^(piQxelXor[2] & 0xFF)); + break; + } +#endif +#else RROP_SOLID (addrp); +# endif } #endif /* !POLYSEGMENT */ return -1; @@ -578,14 +1096,21 @@ cfb8SegmentSS1Rect (pDrawable, pGC, nseg, pSegInit) int nseg; xSegment *pSegInit; { - int (*func)(); - void (*clip)(); + int (*func)(DrawablePtr, GCPtr, int, xSegment *); + void (*clip)(DrawablePtr, GCPtr, int, int, int, int, BoxPtr, Bool); int drawn; cfbPrivGCPtr devPriv; +#if defined(__arm32__) && PSZ != 8 + /* XXX -JJK */ + /* There is a painting bug when PSZ != 8; I need to track it down! */ + cfbSegmentSS(pDrawable, pGC, nseg, pSegInit); + return; +#endif + devPriv = cfbGetGCPrivate(pGC); #ifdef NO_ONE_RECT - if (REGION_NUM_RECTS(devPriv->pCompositeClip) != 1) + if (REGION_NUM_RECTS(pGC->pCompositeClip) != 1) { cfbSegmentSS(pDrawable, pGC, nseg, pSegInit); return; @@ -618,7 +1143,7 @@ cfb8SegmentSS1Rect (pDrawable, pGC, nseg, pSegInit) (*clip) (pDrawable, pGC, pSegInit[drawn-1].x1, pSegInit[drawn-1].y1, pSegInit[drawn-1].x2, pSegInit[drawn-1].y2, - &devPriv->pCompositeClip->extents, + &pGC->pCompositeClip->extents, pGC->capStyle == CapNotLast); pSegInit += drawn; nseg -= drawn; @@ -635,16 +1160,25 @@ cfb8LineSS1Rect (pDrawable, pGC, mode, npt, pptInit) int npt; DDXPointPtr pptInit; { - int (*func)(); - void (*clip)(); + int (*func)(DrawablePtr, GCPtr, int, int, + DDXPointPtr, DDXPointPtr, + int *, int *, int *, int *); + void (*clip)(DrawablePtr, GCPtr, int, int, int, int, BoxPtr, Bool); int drawn; cfbPrivGCPtr devPriv; int x1, y1, x2, y2; DDXPointPtr pptInitOrig = pptInit; +#if defined(__arm32__) && PSZ != 8 + /* XXX -JJK */ + /* There is a painting bug when PSZ != 8; I need to track it down! */ + cfbLineSS(pDrawable, pGC, mode, npt, pptInit); + return; +#endif + devPriv = cfbGetGCPrivate(pGC); #ifdef NO_ONE_RECT - if (REGION_NUM_RECTS(devPriv->pCompositeClip) != 1) + if (REGION_NUM_RECTS(pGC->pCompositeClip) != 1) { cfbLineSS(pDrawable, pGC, mode, npt, pptInit); return; @@ -678,7 +1212,7 @@ cfb8LineSS1Rect (pDrawable, pGC, mode, npt, pptInit) if (drawn == -1) break; (*clip) (pDrawable, pGC, x1, y1, x2, y2, - &devPriv->pCompositeClip->extents, + &pGC->pCompositeClip->extents, drawn != npt - 1 || pGC->capStyle == CapNotLast); pptInit += drawn; npt -= drawn; @@ -697,7 +1231,7 @@ cfb8LineSS1Rect (pDrawable, pGC, mode, npt, pptInit) (*clip) (pDrawable, pGC, pptInit[drawn-1].x, pptInit[drawn-1].y, pptInit[drawn].x, pptInit[drawn].y, - &devPriv->pCompositeClip->extents, + &pGC->pCompositeClip->extents, drawn != npt - 1 || pGC->capStyle == CapNotLast); pptInit += drawn; npt -= drawn; @@ -729,6 +1263,12 @@ RROP_NAME (cfb8ClippedLine) (pDrawable, pGC, x1, y1, x2, y2, boxp, shorten) int new_x1, new_y1, new_x2, new_y2; Bool pt1_clipped, pt2_clipped; int changex, changey, result; +#if PSZ == 24 + int xOffset; + PixelType *addrLineEnd; + char *addrb; + int stepx3, stepy3; +#endif int octant; unsigned int bias = miGetZeroLineBias(pDrawable->pScreen); @@ -841,12 +1381,32 @@ RROP_NAME (cfb8ClippedLine) (pDrawable, pGC, x1, y1, x2, y2, boxp, shorten) RROP_FETCH_GC(pGC); +#if PSZ == 24 + xOffset = x1; + addrLineEnd = addr + (y1 * nwidth); + addrb = (char *)addrLineEnd + x1 * 3; + if (stepx == 1 || stepx == -1){ + stepx3 = stepx * 3; + stepy3 = stepy * sizeof (CfbBits); + } else { + stepx3 = stepx * sizeof (CfbBits); + stepy3 = stepy * 3; + } +#else addrp = addr + (y1 * nwidth) + x1; +#endif #ifndef REARRANGE if (!ady) { +#if PSZ == 24 +#define body {\ + body_rop \ + addrb += stepx3; \ + } +#else #define body { RROP_SOLID(addrp); addrp += stepx; } +#endif while (len >= PGSZB) { body body body body @@ -867,6 +1427,18 @@ RROP_NAME (cfb8ClippedLine) (pDrawable, pGC, x1, y1, x2, y2, boxp, shorten) else #endif /* !REARRANGE */ { +#if PSZ == 24 +#define body {\ + body_rop \ + addrb += stepx3; \ + e += e1; \ + if (e >= 0) \ + { \ + addrb += stepy3; \ + e += e3; \ + } \ + } +#else #define body {\ RROP_SOLID(addrp); \ addrp += stepx; \ @@ -877,6 +1449,7 @@ RROP_NAME (cfb8ClippedLine) (pDrawable, pGC, x1, y1, x2, y2, boxp, shorten) e += e3; \ } \ } +#endif #ifdef LARGE_INSTRUCTION_CACHE while ((len -= PGSZB) >= 0) @@ -906,7 +1479,11 @@ RROP_NAME (cfb8ClippedLine) (pDrawable, pGC, x1, y1, x2, y2, boxp, shorten) IMPORTANT_END; #endif /* LARGE_INSTRUCTION_CACHE */ } +#if PSZ == 24 + body_rop +#else RROP_SOLID(addrp); +#endif #undef body } } |