📄 cfbblt.c
字号:
/* you'd think this would be faster -- * a single instruction instead of 6 * but measurements show it to be ~15% slower */ while ((nl -= 6) >= 0) { asm ("moveml %1+,#0x0c0f;moveml#0x0c0f,%0" : "=m" (*(char *)pdst) : "m" (*(char *)psrc) : "d0", "d1", "d2", "d3", "a2", "a3"); pdst += 6; } nl += 6; while (nl--) *pdst++ = *psrc++;#endif DuffL(nl, label1, *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++;)#endif if (endmask) *pdst = MROP_MASK(*psrc, *pdst, endmask); } }#ifndef DO_UNALIGNED_BITBLT else { if (xoffSrc > xoffDst) {#if PSZ == 24 leftShift = (xoffSrc - xoffDst) << 3;#else#if PGSZ == 32 leftShift = (xoffSrc - xoffDst) << (5 - PWSH);#else /* PGSZ == 64 */ leftShift = (xoffSrc - xoffDst) << (6 - PWSH);#endif /* PGSZ */#endif rightShift = PGSZ - leftShift; } else {#if PSZ == 24 rightShift = (xoffDst - xoffSrc) << 3;#else#if PGSZ == 32 rightShift = (xoffDst - xoffSrc) << (5 - PWSH);#else /* PGSZ == 64 */ rightShift = (xoffDst - xoffSrc) << (6 - PWSH);#endif /* PGSZ */#endif leftShift = PGSZ - rightShift; } while (h--) { psrc = psrcLine; pdst = pdstLine; pdstLine += widthDst; psrcLine += widthSrc; bits = 0; if (xoffSrc > xoffDst) bits = *psrc++; if (startmask) { bits1 = BitLeft(bits,leftShift); bits = *psrc++; bits1 |= BitRight(bits,rightShift); *pdst = MROP_MASK(bits1, *pdst, startmask); pdst++; } nl = nlMiddle;#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 if (endmask) { bits1 = BitLeft(bits, leftShift); if (BitLeft(endmask, rightShift)) { bits = *psrc; bits1 |= BitRight(bits, rightShift); } *pdst = MROP_MASK (bits1, *pdst, endmask); } } }#endif /* DO_UNALIGNED_BITBLT */ }#endif /* ! DO_MEMCPY */ else /* xdir == -1 */ {#if PSZ == 24 xoffSrc = (pptSrc->x + w) & 3; xoffDst = pbox->x2 & 3; pdstLine += ((pbox->x2 * 3 - 1) >> 2) + 1; psrcLine += (((pptSrc->x+w) * 3 - 1) >> 2) + 1;#else xoffSrc = (pptSrc->x + w - 1) & PIM; xoffDst = (pbox->x2 - 1) & PIM; pdstLine += ((pbox->x2-1) >> PWSH) + 1; psrcLine += ((pptSrc->x+w - 1) >> PWSH) + 1;#endif#ifdef DO_UNALIGNED_BITBLT#if PSZ == 24 nl = xoffDst - xoffSrc;#else nl = xoffSrc - xoffDst;#endif psrcLine = (unsigned long *) (((unsigned char *) psrcLine) + nl);#else if (xoffSrc == xoffDst)#endif { while (h--) { psrc = psrcLine; pdst = pdstLine; pdstLine += widthDst; psrcLine += widthSrc; if (endmask) { pdst--; psrc--; *pdst = MROP_MASK (*psrc, *pdst, endmask); } nl = nlMiddle;#ifdef LARGE_INSTRUCTION_CACHE#ifdef FAST_CONSTANT_OFFSET_MODE psrc -= nl & (UNROLL - 1); pdst -= nl & (UNROLL - 1);#define BodyOdd(n) pdst[n-1] = MROP_SOLID (psrc[n-1], pdst[n-1]);#define BodyEven(n) BodyOdd(n)#define LoopReset \pdst -= UNROLL;\psrc -= UNROLL;#else#define BodyOdd(n) --pdst; --psrc; *pdst = MROP_SOLID(*psrc, *pdst);#define BodyEven(n) BodyOdd(n)#define LoopReset ;#endif PackedLoop#undef BodyOdd#undef BodyEven#undef LoopReset#else DuffL(nl,label3, --pdst; --psrc; *pdst = MROP_SOLID (*psrc, *pdst);)#endif if (startmask) { --pdst; --psrc; *pdst = MROP_MASK(*psrc, *pdst, startmask); } } }#ifndef DO_UNALIGNED_BITBLT else { if (xoffDst > xoffSrc) {#if PSZ == 24 leftShift = (xoffDst - xoffSrc) << 3; rightShift = PGSZ - leftShift;#else#if PGSZ == 32 rightShift = (xoffDst - xoffSrc) << (5 - PWSH);#else /* PGSZ == 64 */ rightShift = (xoffDst - xoffSrc) << (6 - PWSH);#endif /* PGSZ */ leftShift = PGSZ - rightShift;#endif } else {#if PSZ == 24 rightShift = (xoffSrc - xoffDst) << 3; leftShift = PGSZ - rightShift;#else#if PGSZ == 32 leftShift = (xoffSrc - xoffDst) << (5 - PWSH);#else /* PGSZ == 64 */ leftShift = (xoffSrc - xoffDst) << (6 - PWSH);#endif /* PGSZ */ rightShift = PGSZ - leftShift;#endif } while (h--) { psrc = psrcLine; pdst = pdstLine; pdstLine += widthDst; psrcLine += widthSrc; bits = 0;#if PSZ == 24 if (xoffSrc > xoffDst)#else if (xoffDst > xoffSrc)#endif bits = *--psrc; if (endmask) { bits1 = BitRight(bits, rightShift); bits = *--psrc; bits1 |= BitLeft(bits, leftShift); pdst--; *pdst = MROP_MASK(bits1, *pdst, endmask); } nl = nlMiddle;#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-1]; \pdst[n-1] = MROP_SOLID(BitRight(bits1, rightShift) | BitLeft(bits, leftShift),pdst[n-1]);#define BodyEven(n) \bits1 = psrc[n-1]; \pdst[n-1] = MROP_SOLID(BitRight(bits, rightShift) | BitLeft(bits1, leftShift),pdst[n-1]);#define LoopReset \pdst -= UNROLL; \psrc -= UNROLL;#else#define BodyOdd(n) \bits = *--psrc; --pdst; \*pdst = MROP_SOLID(BitRight(bits1, rightShift) | BitLeft(bits, leftShift),*pdst);#define BodyEven(n) \bits1 = *--psrc; --pdst; \*pdst = MROP_SOLID(BitRight(bits, rightShift) | BitLeft(bits1, leftShift),*pdst);#define LoopReset ;#endif PackedLoop#undef BodyOdd#undef BodyEven#undef LoopReset#else DuffL (nl, label4, bits1 = BitRight(bits, rightShift); bits = *--psrc; --pdst; *pdst = MROP_SOLID(bits1 | BitLeft(bits, leftShift),*pdst); )#endif if (startmask) { bits1 = BitRight(bits, rightShift); if (BitRight (startmask, leftShift)) { bits = *--psrc; bits1 |= BitLeft(bits, leftShift); } --pdst; *pdst = MROP_MASK(bits1, *pdst, startmask); } } }#endif } pbox++; pptSrc++; } if (pboxNew2) { DEALLOCATE_LOCAL(pptNew2); DEALLOCATE_LOCAL(pboxNew2); } if (pboxNew1) { DEALLOCATE_LOCAL(pptNew1); DEALLOCATE_LOCAL(pboxNew1); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -