📄 cfbtileodd.c
字号:
if (rightShift == PGSZ) bits = 0; *pDst = MROP_MASK (BitLeft(tmp, leftShift) | BitRight(bits,rightShift), *pDst, endmask); } ppt++; }}# include "fastblt.h"#define IncSrcPtr psrc++; if (!--srcRemaining) { srcRemaining = widthSrc; psrc = psrcStart; }voidMROP_NAME(cfbFillBoxTile32s) (pDrawable, nBox, pBox, tile, xrot, yrot, alu, planemask) DrawablePtr pDrawable; int nBox; /* number of boxes to fill */ register BoxPtr pBox; /* pointer to list of boxes to fill */ PixmapPtr tile; /* tile */ int xrot, yrot; int alu; unsigned long planemask;{ int tileWidth; /* width of tile */ int tileHeight; /* height of the tile */ int widthSrc; /* width in longwords of the source tile */ int widthDst; /* width in longwords of the dest pixmap */ int w; /* width of current box */ int h; /* height of current box */ unsigned long startmask; unsigned long endmask;/* masks for reggedy bits at either end of line */ int nlMiddle; /* number of longwords between sides of boxes */ register int nl; /* loop version of nlMiddle */ int srcy; /* current tile y position */ int srcx; /* current tile x position */ int srcRemaining; /* number of longwords remaining in source */ int xoffDst, xoffSrc; int srcStart; /* number of longwords source offset at left of box */ int leftShift, rightShift; MROP_DECLARE_REG() unsigned long *pdstBase; /* pointer to start of dest */ unsigned long *pdstLine; /* poitner to start of dest box */ unsigned long *psrcBase; /* pointer to start of source */ unsigned long *psrcLine; /* pointer to fetch point of source */ unsigned long *psrcStart; /* pointer to start of source line */ register unsigned long *pdst; register unsigned long *psrc; register unsigned long bits, bits1; register int nlTemp; MROP_INITIALIZE (alu, planemask) psrcBase = (unsigned long *)tile->devPrivate.ptr; tileHeight = tile->drawable.height; tileWidth = tile->drawable.width;#if PSZ == 24 widthSrc = tile->devKind / PGSZB;#else widthSrc = tileWidth >> PWSH;#endif cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase) while (nBox--) { w = pBox->x2 - pBox->x1; h = pBox->y2 - pBox->y1; /* set up source */ modulus (pBox->x1 - xrot, tileWidth, srcx); modulus (pBox->y1 - yrot, tileHeight, srcy);#if PSZ == 24 xoffSrc = (4 - srcx) & 3; srcStart = (srcx * 3) >> 2;#else xoffSrc = srcx & PIM; srcStart = (srcx >> PWSH);#endif psrcStart = psrcBase + (srcy * widthSrc); psrcLine = psrcStart + srcStart; /* set up dest */#if PSZ == 24 xoffDst = (4 - pBox->x1) & 3; pdstLine = pdstBase + (pBox->y1 * widthDst) + ((pBox->x1*3) >> 2);#else xoffDst = pBox->x1 & PIM; pdstLine = pdstBase + (pBox->y1 * widthDst) + (pBox->x1 >> PWSH);#endif /* set up masks */#if PSZ == 24 if (w == 1 && (xoffDst == 0 || xoffDst == 1))#else if (xoffDst + w < PPW)#endif { maskpartialbits(pBox->x1, w, startmask); endmask = 0; nlMiddle = 0; } else { maskbits (pBox->x1, w, startmask, endmask, nlMiddle) } if (xoffSrc == xoffDst) { while (h--) { psrc = psrcLine; pdst = pdstLine; srcRemaining = widthSrc - srcStart; if (startmask) { *pdst = MROP_MASK (*psrc, *pdst, startmask); pdst++; IncSrcPtr } nlTemp = nlMiddle; while (nlTemp) { nl = nlTemp; if (nl > srcRemaining) nl = srcRemaining; nlTemp -= nl; srcRemaining -= nl;#if MROP == Mcopy#ifdef LARGE_INSTRUCTION_CACHE#ifdef FAST_CONSTANT_OFFSET_MODE psrc += nl & (UNROLL-1); pdst += nl & (UNROLL-1);#define BodyOdd(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]);#define BodyEven(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]);#define LoopReset \pdst += UNROLL; \psrc += UNROLL;#else#define BodyOdd(n) *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++;#define BodyEven(n) BodyOdd(n)#define LoopReset ;#endif PackedLoop#undef BodyOdd#undef BodyEven#undef LoopReset#else DuffL(nl, label1, *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++;)#endif#else while (nl--) { *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++; }#endif if (!srcRemaining) { srcRemaining = widthSrc; psrc = psrcStart; } } if (endmask) { *pdst = MROP_MASK (*psrc, *pdst, endmask); } pdstLine += widthDst; psrcLine += widthSrc; psrcStart += widthSrc; if (++srcy == tileHeight) { psrcStart = psrcBase; psrcLine = psrcStart + srcStart; srcy = 0; } } } else { if (xoffSrc > xoffDst) { leftShift = (xoffSrc - xoffDst) << LEFTSHIFT_AMT; rightShift = PGSZ - leftShift; } else { rightShift = (xoffDst - xoffSrc) << LEFTSHIFT_AMT; leftShift = PGSZ - rightShift; } while (h--) { psrc = psrcLine; pdst = pdstLine; bits = 0; srcRemaining = widthSrc - srcStart; if (xoffSrc > xoffDst) { bits = *psrc; IncSrcPtr } if (startmask) { bits1 = BitLeft(bits,leftShift); bits = *psrc; IncSrcPtr bits1 |= BitRight(bits,rightShift); *pdst = MROP_MASK(bits1, *pdst, startmask); pdst++; } nlTemp = nlMiddle; while (nlTemp) { nl = nlTemp; if (nl > srcRemaining) nl = srcRemaining; nlTemp -= nl; srcRemaining -= nl; #if MROP == Mcopy#ifdef LARGE_INSTRUCTION_CACHE bits1 = bits; #ifdef FAST_CONSTANT_OFFSET_MODE psrc += nl & (UNROLL-1); pdst += nl & (UNROLL-1); #define BodyOdd(n) \ bits = psrc[-n]; \ pdst[-n] = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), pdst[-n]); #define BodyEven(n) \ bits1 = psrc[-n]; \ pdst[-n] = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), pdst[-n]); #define LoopReset \ pdst += UNROLL; \ psrc += UNROLL; #else #define BodyOdd(n) \ bits = *psrc++; \ *pdst = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), *pdst); \ pdst++; #define BodyEven(n) \ bits1 = *psrc++; \ *pdst = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), *pdst); \ pdst++; #define LoopReset ; #endif /* !FAST_CONSTANT_OFFSET_MODE */ PackedLoop #undef BodyOdd#undef BodyEven#undef LoopReset #else DuffL (nl,label2, bits1 = BitLeft(bits, leftShift); bits = *psrc++; *pdst = MROP_SOLID (bits1 | BitRight(bits, rightShift), *pdst); pdst++; )#endif#else while (nl--) { bits1 = BitLeft(bits, leftShift); bits = *psrc++; *pdst = MROP_SOLID (bits1 | BitRight(bits, rightShift), *pdst); pdst++; }#endif if (!srcRemaining) { srcRemaining = widthSrc; psrc = psrcStart; } } if (endmask) { bits1 = BitLeft(bits, leftShift); if (BitLeft(endmask, rightShift)) { bits = *psrc; bits1 |= BitRight(bits, rightShift); } *pdst = MROP_MASK (bits1, *pdst, endmask); } pdstLine += widthDst; psrcLine += widthSrc; psrcStart += widthSrc; if (++srcy == tileHeight) { psrcStart = psrcBase; psrcLine = psrcStart + srcStart; srcy = 0; } } } pBox++; }}voidMROP_NAME(cfbFillSpanTile32s) (pDrawable, n, ppt, pwidth, tile, xrot, yrot, alu, planemask) DrawablePtr pDrawable; int n; DDXPointPtr ppt; int *pwidth; PixmapPtr tile; int xrot, yrot; int alu; unsigned long planemask;{ int tileWidth; /* width of tile */ int tileHeight; /* height of the tile */ int widthSrc; /* width in longwords of the source tile */ int widthDst; /* width in longwords of the dest pixmap */ int w; /* width of current box */ unsigned long startmask; unsigned long endmask;/* masks for reggedy bits at either end of line */ int nlMiddle; /* number of longwords between sides of boxes */ register int nl; /* loop version of nlMiddle */ int srcy; /* current tile y position */ int srcx; /* current tile x position */ int srcRemaining; /* number of longwords remaining in source */ int xoffDst, xoffSrc; int srcStart; /* number of longwords source offset at left of box */ int leftShift, rightShift; MROP_DECLARE_REG() unsigned long *pdstBase; /* pointer to start of dest */ unsigned long *pdstLine; /* poitner to start of dest box */ unsigned long *psrcBase; /* pointer to start of source */ unsigned long *psrcLine; /* pointer to fetch point of source */ unsigned long *psrcStart; /* pointer to start of source line */ register unsigned long *pdst; register unsigned long *psrc; register unsigned long bits, bits1; register int nlTemp; MROP_INITIALIZE (alu, planemask) psrcBase = (unsigned long *)tile->devPrivate.ptr; tileHeight = tile->drawable.height; tileWidth = tile->drawable.width;#if PSZ == 24 widthSrc = tile->devKind / PGSZB;#else widthSrc = tileWidth >> PWSH;#endif cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase) while (n--) { w = *pwidth++; /* set up source */ modulus (ppt->x - xrot, tileWidth, srcx); modulus (ppt->y - yrot, tileHeight, srcy);#if PSZ == 24 xoffSrc = (4 - srcx) & 3; srcStart = (srcx * 3) >> 2;#else xoffSrc = srcx & PIM; srcStart = (srcx >> PWSH);#endif psrcStart = psrcBase + (srcy * widthSrc); psrcLine = psrcStart + srcStart; /* set up dest */#if PSZ == 24 xoffDst = (4 - ppt->x) & 3; pdstLine = pdstBase + (ppt->y * widthDst) + ((ppt->x *3) >> 2); /* set up masks */ if (w == 1 && (xoffDst == 0 || xoffDst == 1))#else xoffDst = ppt->x & PIM; pdstLine = pdstBase + (ppt->y * widthDst) + (ppt->x >> PWSH); /* set up masks */ if (xoffDst + w < PPW)#endif { maskpartialbits(ppt->x, w, startmask); endmask = 0; nlMiddle = 0; } else { maskbits (ppt->x, w, startmask, endmask, nlMiddle) } if (xoffSrc == xoffDst) { psrc = psrcLine; pdst = pdstLine; srcRemaining = widthSrc - srcStart; if (startmask) { *pdst = MROP_MASK (*psrc, *pdst, startmask); pdst++; IncSrcPtr } nlTemp = nlMiddle; while (nlTemp) { nl = nlTemp; if (nl > srcRemaining) nl = srcRemaining; nlTemp -= nl; srcRemaining -= nl;#if MROP == Mcopy#ifdef LARGE_INSTRUCTION_CACHE#ifdef FAST_CONSTANT_OFFSET_MODE psrc += nl & (UNROLL-1); pdst += nl & (UNROLL-1);#define BodyOdd(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]);#define BodyEven(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]);#define LoopReset \pdst += UNROLL; \psrc += UNROLL;#else#define BodyOdd(n) *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++;#define BodyEven(n) BodyOdd(n)#define LoopReset ;#endif PackedLoop#undef BodyOdd#undef BodyEven#undef LoopReset#else DuffL(nl, label1, *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++;)#endif#else while (nl--) { *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++; }#endif if (!srcRemaining) { srcRemaining = widthSrc; psrc = psrcStart; } } if (endmask) { *pdst = MROP_MASK (*psrc, *pdst, endmask); } } else { if (xoffSrc > xoffDst) { leftShift = (xoffSrc - xoffDst) << LEFTSHIFT_AMT; rightShift = PGSZ - leftShift; } else { rightShift = (xoffDst - xoffSrc) << LEFTSHIFT_AMT; leftShift = PGSZ - rightShift; } psrc = psrcLine; pdst = pdstLine; bits = 0; srcRemaining = widthSrc - srcStart; if (xoffSrc > xoffDst) { bits = *psrc; IncSrcPtr } if (startmask) { bits1 = BitLeft(bits,leftShift); bits = *psrc; IncSrcPtr bits1 |= BitRight(bits,rightShift); *pdst = MROP_MASK(bits1, *pdst, startmask); pdst++; } nlTemp = nlMiddle; while (nlTemp) { nl = nlTemp; if (nl > srcRemaining) nl = srcRemaining; nlTemp -= nl; srcRemaining -= nl;#if MROP == Mcopy#ifdef LARGE_INSTRUCTION_CACHE bits1 = bits;#ifdef FAST_CONSTANT_OFFSET_MODE psrc += nl & (UNROLL-1); pdst += nl & (UNROLL-1);#define BodyOdd(n) \bits = psrc[-n]; \pdst[-n] = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), pdst[-n]);#define BodyEven(n) \bits1 = psrc[-n]; \pdst[-n] = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), pdst[-n]);#define LoopReset \pdst += UNROLL; \psrc += UNROLL;#else#define BodyOdd(n) \bits = *psrc++; \*pdst = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), *pdst); \pdst++; #define BodyEven(n) \bits1 = *psrc++; \*pdst = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), *pdst); \pdst++;#define LoopReset ;#endif /* !FAST_CONSTANT_OFFSET_MODE */ PackedLoop#undef BodyOdd#undef BodyEven#undef LoopReset#else DuffL (nl,label2, bits1 = BitLeft(bits, leftShift); bits = *psrc++; *pdst = MROP_SOLID (bits1 | BitRight(bits, rightShift), *pdst); pdst++; )#endif#else while (nl--) { bits1 = BitLeft(bits,leftShift); bits = *psrc++; *pdst = MROP_SOLID(bits1|BitRight(bits,rightShift), *pdst); pdst++; }#endif if (!srcRemaining) { srcRemaining = widthSrc; psrc = psrcStart; } } if (endmask) { bits1 = BitLeft(bits, leftShift); if (BitLeft(endmask, rightShift)) { bits = *psrc; bits1 |= BitRight(bits, rightShift); } *pdst = MROP_MASK (bits1, *pdst, endmask); } } ppt++; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -