📄 fb_mfbs.c
字号:
*pdst = (*pdst & ~startmask | ~bits1 & startmask); } } } }}voidmfb_or_area32(addrSrc, addrDst, widthSrc, widthDst, sr, dp)u_int *addrSrc;u_int *addrDst;int widthSrc;int widthDst;lRectangle *sr; /* source rectangle */lPoint *dp; /* destination point */{ register u_int *psrcLine, *psrc; register u_int *pdstLine, *pdst; int w, h; int xdir, ydir; u_int startmask, endmask; register int nlMiddle; int xoffSrc, xoffDst; register int leftShift, rightShift; u_int bits; u_int bits1; register int nl; if (sr->origin.y < dp->y) { ydir = -1; widthSrc = -widthSrc; widthDst = -widthDst; } else { ydir = 1; } if (sr->origin.x < dp->x) { xdir = -1; } else { xdir = 1; } w = sr->extent.x; h = sr->extent.y; if (ydir == -1) { psrcLine = addrSrc + ((sr->origin.y + h - 1) * -widthSrc); pdstLine = addrDst + ((dp->y + h - 1) * -widthDst); } else { psrcLine = addrSrc + (sr->origin.y * widthSrc); pdstLine = addrDst + (dp->y * widthDst); } if ((dp->x & 0x1f) +w <= 32) { startmask = mfbpartmasks32[dp->x & 0x1f][w & 0x1f]; endmask = 0; nlMiddle = 0; } else { startmask = mfbstarttab32[dp->x & 0x1f]; endmask = mfbendtab32[(dp->x + w) & 0x1f]; if (startmask) { nlMiddle = (w - (32 - (dp->x & 0x1f))) >> 5; } else { nlMiddle = w >> 5; } } if (xdir == 1) { xoffSrc = sr->origin.x & 0x1f; xoffDst = dp->x & 0x1f; pdstLine += (dp->x >> 5); psrcLine += (sr->origin.x >> 5); if (xoffSrc == xoffDst) { while (h--) { psrc = psrcLine; pdst = pdstLine; pdstLine += widthDst; psrcLine += widthSrc; if (startmask) { *pdst++ |= *psrc++ & startmask; } nl = nlMiddle; Duff_plus(nl, pdst, psrc, |=); if (endmask) { *pdst |= *psrc & endmask; } } } else { if (xoffSrc > xoffDst) { leftShift = xoffSrc - xoffDst; rightShift = 32 - leftShift; } else { rightShift = xoffDst - xoffSrc; leftShift = 32 - rightShift; } while (h--) { psrc = psrcLine; pdst = pdstLine; pdstLine += widthDst; psrcLine += widthSrc; bits = 0; if (xoffSrc > xoffDst) bits = *psrc++; if (startmask) { bits1 = bits << leftShift; bits = *psrc++; bits1 |= bits >> rightShift; *pdst++ |= bits1 & startmask; } nl = nlMiddle; bits1 = bits; Duff_shift_plus(nl, pdst, psrc, |=); if (endmask) { bits1 = bits << leftShift; if (endmask << rightShift) { bits1 |= *psrc >> rightShift; } *pdst |= bits1 & endmask; } } } } else { xoffSrc = (sr->origin.x + w - 1) & 0x1f; xoffDst = (dp->x + w - 1) & 0x1f; pdstLine += ((dp->x + w - 1) >> 5) + 1; psrcLine += ((sr->origin.x + w - 1) >> 5) + 1; if (xoffSrc == xoffDst) { while (h--) { psrc = psrcLine; pdst = pdstLine; pdstLine += widthDst; psrcLine += widthSrc; if (endmask) { *--pdst |= *--psrc & endmask; } nl = nlMiddle; Duff_minus(nl, pdst, psrc, |=); if (startmask) { *--pdst |= *--psrc & startmask; } } } else { if (xoffDst > xoffSrc) { rightShift = xoffDst - xoffSrc; leftShift = 32 - rightShift; } else { leftShift = xoffSrc - xoffDst; rightShift = 32 - leftShift; } while (h--) { psrc = psrcLine; pdst = pdstLine; pdstLine += widthDst; psrcLine += widthSrc; bits = 0; if (xoffDst > xoffSrc) bits = *--psrc; if (endmask) { bits1 = bits >> rightShift; bits = *--psrc; bits1 |= (bits << leftShift); *--pdst |= bits1 & endmask; } nl = nlMiddle; bits1 = bits; Duff_shift_minus(nl, pdst, psrc, |=); if (startmask) { bits1 = (bits >> rightShift); if (startmask >> leftShift) { bits1 |= *--psrc << leftShift; } *--pdst |= bits1 & startmask; } } } }}voidmfb_xor_area32(addrSrc, addrDst, widthSrc, widthDst, sr, dp)u_int *addrSrc;u_int *addrDst;int widthSrc;int widthDst;lRectangle *sr; /* source rectangle */lPoint *dp; /* destination point */{ register u_int *psrcLine, *psrc; register u_int *pdstLine, *pdst; int w, h; int xdir, ydir; u_int startmask, endmask; register int nlMiddle; int xoffSrc, xoffDst; register int leftShift, rightShift; u_int bits; u_int bits1; register int nl; if (sr->origin.y < dp->y) { ydir = -1; widthSrc = -widthSrc; widthDst = -widthDst; } else { ydir = 1; } if (sr->origin.x < dp->x) { xdir = -1; } else { xdir = 1; } w = sr->extent.x; h = sr->extent.y; if (ydir == -1) { psrcLine = addrSrc + ((sr->origin.y + h - 1) * -widthSrc); pdstLine = addrDst + ((dp->y + h - 1) * -widthDst); } else { psrcLine = addrSrc + (sr->origin.y * widthSrc); pdstLine = addrDst + (dp->y * widthDst); } if ((dp->x & 0x1f) +w <= 32) { startmask = mfbpartmasks32[dp->x & 0x1f][w & 0x1f]; endmask = 0; nlMiddle = 0; } else { startmask = mfbstarttab32[dp->x & 0x1f]; endmask = mfbendtab32[(dp->x + w) & 0x1f]; if (startmask) { nlMiddle = (w - (32 - (dp->x & 0x1f))) >> 5; } else { nlMiddle = w >> 5; } } if (xdir == 1) { xoffSrc = sr->origin.x & 0x1f; xoffDst = dp->x & 0x1f; pdstLine += (dp->x >> 5); psrcLine += (sr->origin.x >> 5); if (xoffSrc == xoffDst) { while (h--) { psrc = psrcLine; pdst = pdstLine; pdstLine += widthDst; psrcLine += widthSrc; if (startmask) { *pdst++ ^= *psrc++ & startmask; } nl = nlMiddle; Duff_plus(nl, pdst, psrc, ^=); if (endmask) { *pdst ^= *psrc & endmask; } } } else { if (xoffSrc > xoffDst) { leftShift = xoffSrc - xoffDst; rightShift = 32 - leftShift; } else { rightShift = xoffDst - xoffSrc; leftShift = 32 - rightShift; } while (h--) { psrc = psrcLine; pdst = pdstLine; pdstLine += widthDst; psrcLine += widthSrc; bits = 0; if (xoffSrc > xoffDst) bits = *psrc++; if (startmask) { bits1 = bits << leftShift; bits = *psrc++; bits1 |= bits >> rightShift; *pdst++ ^= bits1 & startmask; } nl = nlMiddle; bits1 = bits; Duff_shift_plus(nl, pdst, psrc, ^=); if (endmask) { bits1 = bits << leftShift; if (endmask << rightShift) { bits1 |= *psrc >> rightShift; } *pdst ^= bits1 & endmask; } } } } else { xoffSrc = (sr->origin.x + w - 1) & 0x1f; xoffDst = (dp->x + w - 1) & 0x1f; pdstLine += ((dp->x + w - 1) >> 5) + 1; psrcLine += ((sr->origin.x + w - 1) >> 5) + 1; if (xoffSrc == xoffDst) { while (h--) { psrc = psrcLine; pdst = pdstLine; pdstLine += widthDst; psrcLine += widthSrc; if (endmask) { *--pdst ^= *--psrc & endmask; } nl = nlMiddle; Duff_minus(nl, pdst, psrc, ^=); if (startmask) { *--pdst ^= *--psrc & startmask; } } } else { if (xoffDst > xoffSrc) { rightShift = xoffDst - xoffSrc; leftShift = 32 - rightShift; } else { leftShift = xoffSrc - xoffDst; rightShift = 32 - leftShift; } while (h--) { psrc = psrcLine; pdst = pdstLine; pdstLine += widthDst; psrcLine += widthSrc; bits = 0; if (xoffDst > xoffSrc) bits = *--psrc; if (endmask) { bits1 = bits >> rightShift; bits = *--psrc; bits1 |= (bits << leftShift); *--pdst ^= bits1 & endmask; } nl = nlMiddle; bits1 = bits; Duff_shift_minus(nl, pdst, psrc, ^=); if (startmask) { bits1 = (bits >> rightShift); if (startmask >> leftShift) { bits1 |= *--psrc << leftShift; } *--pdst ^= bits1 & startmask; } } } }}voidmfb_general_area32(func, addrSrc, addrDst, widthSrc, widthDst, sr, dp)int func;u_int *addrSrc;u_int *addrDst;int widthSrc;int widthDst;lRectangle *sr; /* source rectangle */lPoint *dp; /* destination point */{ register u_int *psrcLine, *psrc; register u_int *pdstLine, *pdst; register int leftShift, rightShift; u_int bits; u_int bits1; register int nl; u_int _ca1, _cx1, _ca2, _cx2; u_int startmask, endmask; int w, h; int xdir, ydir; register int nlMiddle; int xoffSrc, xoffDst; _ca1 = mergeRopBits[func].ca1; _cx1 = mergeRopBits[func].cx1; _ca2 = mergeRopBits[func].ca2; _cx2 = mergeRopBits[func].cx2; if (sr->origin.y < dp->y) { ydir = -1; widthSrc = -widthSrc; widthDst = -widthDst; } else { ydir = 1; } if (sr->origin.x < dp->x) { xdir = -1; } else { xdir = 1; } w = sr->extent.x; h = sr->extent.y; if (ydir == -1) { psrcLine = addrSrc + ((sr->origin.y + h - 1) * -widthSrc); pdstLine = addrDst + ((dp->y + h - 1) * -widthDst); } else { psrcLine = addrSrc + (sr->origin.y * widthSrc); pdstLine = addrDst + (dp->y * widthDst); } if ((dp->x & 0x1f) +w <= 32) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -