📄 icbltone.c
字号:
} } } if (!w) break; /* * Load another set and reset number of available units */ LoadBits; n = unitsPerSrc; if (n > w) n = w; } } /* * Consume stipple bits for endmask */ if (endmask) { if (endNeedsLoad) { LoadBits; }#if FB_UNIT > 32 if (pixelsPerDst == 16) mask = FbStipple16Bits(FbLeftStipBits(bits,16)); else#endif mask = fbBits[FbLeftStipBits(bits,pixelsPerDst)];#ifndef FBNOPIXADDR if (fbLane) { fbTransparentSpan (dst, mask & endmask, fgxor, 1); } else#endif { if (mask || !transparent) FbDoRightMaskByteStippleRRop (dst, mask, fgand, fgxor, bgand, bgxor, endbyte, endmask); } } dst += dstStride; src += srcStride; }}#ifdef FB_24BIT/* * Crufty macros to initialize the mask array, most of this * is to avoid compile-time warnings about shift overflow */#if BITMAP_BIT_ORDER == MSBFirst#define Mask24Pos(x,r) ((x)*24-(r))#else#define Mask24Pos(x,r) ((x)*24-((r) ? 24 - (r) : 0))#endif#define Mask24Neg(x,r) (Mask24Pos(x,r) < 0 ? -Mask24Pos(x,r) : 0)#define Mask24Check(x,r) (Mask24Pos(x,r) < 0 ? 0 : \ Mask24Pos(x,r) >= FB_UNIT ? 0 : Mask24Pos(x,r))#define Mask24(x,r) (Mask24Pos(x,r) < FB_UNIT ? \ (Mask24Pos(x,r) < 0 ? \ 0xffffff >> Mask24Neg (x,r) : \ 0xffffff << Mask24Check(x,r)) : 0)#define SelMask24(b,n,r) ((((b) >> n) & 1) * Mask24(n,r))/* * Untested for MSBFirst or FB_UNIT == 32 */#if FB_UNIT == 64#define C4_24(b,r) \ (SelMask24(b,0,r) | \ SelMask24(b,1,r) | \ SelMask24(b,2,r) | \ SelMask24(b,3,r))#define FbStip24New(rot) (2 + (rot != 0))#define FbStip24Len 4static const FbBits fbStipple24Bits[3][1 << FbStip24Len] = { /* rotate 0 */ { C4_24( 0, 0), C4_24( 1, 0), C4_24( 2, 0), C4_24( 3, 0), C4_24( 4, 0), C4_24( 5, 0), C4_24( 6, 0), C4_24( 7, 0), C4_24( 8, 0), C4_24( 9, 0), C4_24(10, 0), C4_24(11, 0), C4_24(12, 0), C4_24(13, 0), C4_24(14, 0), C4_24(15, 0), }, /* rotate 8 */ { C4_24( 0, 8), C4_24( 1, 8), C4_24( 2, 8), C4_24( 3, 8), C4_24( 4, 8), C4_24( 5, 8), C4_24( 6, 8), C4_24( 7, 8), C4_24( 8, 8), C4_24( 9, 8), C4_24(10, 8), C4_24(11, 8), C4_24(12, 8), C4_24(13, 8), C4_24(14, 8), C4_24(15, 8), }, /* rotate 16 */ { C4_24( 0,16), C4_24( 1,16), C4_24( 2,16), C4_24( 3,16), C4_24( 4,16), C4_24( 5,16), C4_24( 6,16), C4_24( 7,16), C4_24( 8,16), C4_24( 9,16), C4_24(10,16), C4_24(11,16), C4_24(12,16), C4_24(13,16), C4_24(14,16), C4_24(15,16), }};#endif#if FB_UNIT == 32#define C2_24(b,r) \ (SelMask24(b,0,r) | \ SelMask24(b,1,r))#define FbStip24Len 2#if BITMAP_BIT_ORDER == MSBFirst#define FbStip24New(rot) (1 + (rot == 0))#else#define FbStip24New(rot) (1 + (rot == 8))#endifstatic const FbBits fbStipple24Bits[3][1 << FbStip24Len] = { /* rotate 0 */ { C2_24( 0, 0), C2_24 ( 1, 0), C2_24 ( 2, 0), C2_24 ( 3, 0), }, /* rotate 8 */ { C2_24( 0, 8), C2_24 ( 1, 8), C2_24 ( 2, 8), C2_24 ( 3, 8), }, /* rotate 16 */ { C2_24( 0,16), C2_24 ( 1,16), C2_24 ( 2,16), C2_24 ( 3,16), }};#endif#if BITMAP_BIT_ORDER == LSBFirst#define FbMergeStip24Bits(left, right, new) \ (FbStipLeft (left, new) | FbStipRight ((right), (FbStip24Len - (new))))#define FbMergePartStip24Bits(left, right, llen, rlen) \ (left | FbStipRight(right, llen))#else#define FbMergeStip24Bits(left, right, new) \ ((FbStipLeft (left, new) & ((1 << FbStip24Len) - 1)) | right)#define FbMergePartStip24Bits(left, right, llen, rlen) \ (FbStipLeft(left, rlen) | right)#endif#define fbFirstStipBits(len,stip) {\ int __len = (len); \ if (len <= remain) { \ stip = FbLeftStipBits(bits, len); \ } else { \ stip = FbLeftStipBits(bits, remain); \ bits = *src++; \ __len = (len) - remain; \ stip = FbMergePartStip24Bits(stip, FbLeftStipBits(bits, __len), \ remain, __len); \ remain = FB_STIP_UNIT; \ } \ bits = FbStipLeft (bits, __len); \ remain -= __len; \}#define fbInitStipBits(offset,len,stip) {\ bits = FbStipLeft (*src++,offset); \ remain = FB_STIP_UNIT - offset; \ fbFirstStipBits(len,stip); \ stip = FbMergeStip24Bits (0, stip, len); \}#define fbNextStipBits(rot,stip) {\ int __new = FbStip24New(rot); \ FbStip __right; \ fbFirstStipBits(__new, __right); \ stip = FbMergeStip24Bits (stip, __right, __new); \ rot = FbNext24Rot (rot); \}/* * Use deep mask tables that incorporate rotation, pull * a variable number of bits out of the stipple and * reuse the right bits as needed for the next write * * Yes, this is probably too much code, but most 24-bpp screens * have no acceleration so this code is used for stipples, copyplane * and text */voidfbBltOne24 (FbStip *srcLine, FbStride srcStride, /* FbStip units per scanline */ int srcX, /* bit position of source */ FbBits *dst, FbStride dstStride, /* FbBits units per scanline */ int dstX, /* bit position of dest */ int dstBpp, /* bits per destination unit */ int width, /* width in bits of destination */ int height, /* height in scanlines */ FbBits fgand, /* rrop values */ FbBits fgxor, FbBits bgand, FbBits bgxor){ FbStip *src; FbBits leftMask, rightMask, mask; int nlMiddle, nl; FbStip stip, bits; int remain; int dstS; int firstlen; int rot0, rot; int nDst; srcLine += srcX >> FB_STIP_SHIFT; dst += dstX >> FB_SHIFT; srcX &= FB_STIP_MASK; dstX &= FB_MASK; rot0 = FbFirst24Rot (dstX); FbMaskBits (dstX, width, leftMask, nlMiddle, rightMask); dstS = (dstX + 23) / 24; firstlen = FbStip24Len - dstS; nDst = nlMiddle; if (leftMask) nDst++; dstStride -= nDst; /* opaque copy */ if (bgand == 0 && fgand == 0) { while (height--) { rot = rot0; src = srcLine; srcLine += srcStride; fbInitStipBits (srcX,firstlen, stip); if (leftMask) { mask = fbStipple24Bits[rot >> 3][stip]; *dst = (*dst & ~leftMask) | (FbOpaqueStipple (mask, FbRot24(fgxor, rot), FbRot24(bgxor, rot)) & leftMask); dst++; fbNextStipBits(rot,stip); } nl = nlMiddle; while (nl--) { mask = fbStipple24Bits[rot>>3][stip]; *dst = FbOpaqueStipple (mask, FbRot24(fgxor, rot), FbRot24(bgxor, rot)); dst++; fbNextStipBits(rot,stip); } if (rightMask) { mask = fbStipple24Bits[rot >> 3][stip]; *dst = (*dst & ~rightMask) | (FbOpaqueStipple (mask, FbRot24(fgxor, rot), FbRot24(bgxor, rot)) & rightMask); } dst += dstStride; src += srcStride; } } /* transparent copy */ else if (bgand == FB_ALLONES && bgxor == 0 && fgand == 0) { while (height--) { rot = rot0; src = srcLine; srcLine += srcStride; fbInitStipBits (srcX, firstlen, stip); if (leftMask) { if (stip) { mask = fbStipple24Bits[rot >> 3][stip] & leftMask; *dst = (*dst & ~mask) | (FbRot24(fgxor, rot) & mask); } dst++; fbNextStipBits (rot, stip); } nl = nlMiddle; while (nl--) { if (stip) { mask = fbStipple24Bits[rot>>3][stip]; *dst = (*dst & ~mask) | (FbRot24(fgxor,rot) & mask); } dst++; fbNextStipBits (rot, stip); } if (rightMask) { if (stip) { mask = fbStipple24Bits[rot >> 3][stip] & rightMask; *dst = (*dst & ~mask) | (FbRot24(fgxor, rot) & mask); } } dst += dstStride; } } else { while (height--) { rot = rot0; src = srcLine; srcLine += srcStride; fbInitStipBits (srcX, firstlen, stip); if (leftMask) { mask = fbStipple24Bits[rot >> 3][stip]; *dst = FbStippleRRopMask (*dst, mask, FbRot24(fgand, rot), FbRot24(fgxor, rot), FbRot24(bgand, rot), FbRot24(bgxor, rot), leftMask); dst++; fbNextStipBits(rot,stip); } nl = nlMiddle; while (nl--) { mask = fbStipple24Bits[rot >> 3][stip]; *dst = FbStippleRRop (*dst, mask, FbRot24(fgand, rot), FbRot24(fgxor, rot), FbRot24(bgand, rot), FbRot24(bgxor, rot)); dst++; fbNextStipBits(rot,stip); } if (rightMask) { mask = fbStipple24Bits[rot >> 3][stip]; *dst = FbStippleRRopMask (*dst, mask, FbRot24(fgand, rot), FbRot24(fgxor, rot), FbRot24(bgand, rot), FbRot24(bgxor, rot), rightMask); } dst += dstStride; } }}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -