⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cfbmskbits.h

📁 远程桌面连接工具
💻 H
📖 第 1 页 / 共 2 页
字号:
		break; \	default: \		dstpixel = BitLeft((*(pdst) &cfbmask[idx]), cfb24Shift[idx])| \		BitRight(((*((pdst)+1)) &cfbmask[idx+1]), cfb24Shift[idx+1]); \	}; \    dstpixel &= ~(planemask); \    dstpixel |= (src & planemask); \    *(pdst) &= cfbrmask[idx]; \    switch(idx){ \    	case 0: \		*(pdst) |=  (dstpixel & cfbmask[idx]); \		break; \    	case 2: \    	case 4: \		pdst++;idx++; \		*(pdst) = ((*(pdst))  & cfbrmask[idx]) | \				(BitLeft(dstpixel, cfb24Shift[idx]) & cfbmask[idx]); \		pdst--;idx--; \    	case 6: \		*(pdst) |=  (BitRight(dstpixel, cfb24Shift[idx]) & cfbmask[idx]); \		break; \	}; \}#define putbitsrop24(src, x, pdst, planemask, rop) \{ \    register PixelGroup t1, dstpixel; \    register unsigned int idx; \    switch(idx = (x)<<1){ \    	case 0: \		dstpixel = (*(pdst) &cfbmask[idx]); \		break; \    	case 6: \		dstpixel = BitLeft((*(pdst) &cfbmask[idx]), cfb24Shift[idx]); \		break; \	default: \		dstpixel = BitLeft((*(pdst) &cfbmask[idx]), cfb24Shift[idx])| \		BitRight(((*((pdst)+1)) &cfbmask[idx+1]), cfb24Shift[idx+1]); \	}; \    DoRop(t1, rop, (src), dstpixel); \    dstpixel &= ~planemask; \    dstpixel |= (t1 & planemask); \    *(pdst) &= cfbrmask[idx]; \    switch(idx){ \    	case 0: \		*(pdst) |= (dstpixel & cfbmask[idx]); \		break; \    	case 2: \    	case 4: \		*((pdst)+1) = ((*((pdst)+1))  & cfbrmask[idx+1]) | \				(BitLeft(dstpixel, cfb24Shift[idx+1]) & (cfbmask[idx+1])); \    	case 6: \		*(pdst) |= (BitRight(dstpixel, cfb24Shift[idx]) & cfbmask[idx]); \	}; \}# else  /* PSZ == 24 && PPW == 1 */#define maskbits(x, w, startmask, endmask, nlw) \    startmask = cfbstarttab[(x)&PIM]; \    endmask = cfbendtab[((x)+(w)) & PIM]; \    if (startmask) \	nlw = (((w) - (PPW - ((x)&PIM))) >> PWSH); \    else \	nlw = (w) >> PWSH;#define maskpartialbits(x, w, mask) \    mask = cfbstartpartial[(x) & PIM] & cfbendpartial[((x) + (w)) & PIM];#define mask32bits(x, w, startmask, endmask) \    startmask = cfbstarttab[(x)&PIM]; \    endmask = cfbendtab[((x)+(w)) & PIM];/* FIXME */#define maskbits24(x, w, startmask, endmask, nlw) \    abort()#define getbits24(psrc, dst, index) \    abort()#define putbits24(src, x, w, pdst, planemask, index) \    abort()#define putbitsrop24(src, x, pdst, planemask, rop) \    abort()#endif /* PSZ == 24 && PPW == 1 */#define getbits(psrc, x, w, dst) \if ( ((x) + (w)) <= PPW) \{ \    dst = SCRLEFT(*(psrc), (x)); \} \else \{ \    int m; \    m = PPW-(x); \    dst = (SCRLEFT(*(psrc), (x)) & cfbendtab[m]) | \	  (SCRRIGHT(*((psrc)+1), m) & cfbstarttab[m]); \}#define putbits(src, x, w, pdst, planemask) \if ( ((x)+(w)) <= PPW) \{ \    PixelGroup tmpmask; \    maskpartialbits((x), (w), tmpmask); \    tmpmask &= PFILL(planemask); \    *(pdst) = (*(pdst) & ~tmpmask) | (SCRRIGHT(src, x) & tmpmask); \} \else \{ \    unsigned long m; \    unsigned long n; \    PixelGroup pm = PFILL(planemask); \    m = PPW-(x); \    n = (w) - m; \    *(pdst) = (*(pdst) & (cfbendtab[x] | ~pm)) | \	(SCRRIGHT(src, x) & (cfbstarttab[x] & pm)); \    *((pdst)+1) = (*((pdst)+1) & (cfbstarttab[n] | ~pm)) | \	(SCRLEFT(src, m) & (cfbendtab[n] & pm)); \}#if defined(__GNUC__) && defined(mc68020)#undef getbits#define FASTGETBITS(psrc, x, w, dst) \    asm ("bfextu %3{%1:%2},%0" \	 : "=d" (dst) : "di" (x), "di" (w), "o" (*(char *)(psrc)))#define getbits(psrc,x,w,dst) \{ \    FASTGETBITS(psrc, (x) * PSZ, (w) * PSZ, dst); \    dst = SCRLEFT(dst,PPW-(w)); \}#define FASTPUTBITS(src, x, w, pdst) \    asm ("bfins %3,%0{%1:%2}" \	 : "=o" (*(char *)(pdst)) \	 : "di" (x), "di" (w), "d" (src), "0" (*(char *) (pdst)))#undef putbits#define putbits(src, x, w, pdst, planemask) \{ \    if (planemask != PMSK) { \        PixelGroup _m, _pm; \        FASTGETBITS(pdst, (x) * PSZ , (w) * PSZ, _m); \        PFILL2(planemask, _pm); \        _m &= (~_pm); \        _m |= (SCRRIGHT(src, PPW-(w)) & _pm); \        FASTPUTBITS(_m, (x) * PSZ, (w) * PSZ, pdst); \    } else { \        FASTPUTBITS(SCRRIGHT(src, PPW-(w)), (x) * PSZ, (w) * PSZ, pdst); \    } \}    #endif /* mc68020 */#define putbitsrop(src, x, w, pdst, planemask, rop) \if ( ((x)+(w)) <= PPW) \{ \    PixelGroup tmpmask; \    PixelGroup t1, t2; \    maskpartialbits((x), (w), tmpmask); \    PFILL2(planemask, t1); \    tmpmask &= t1; \    t1 = SCRRIGHT((src), (x)); \    DoRop(t2, rop, t1, *(pdst)); \    *(pdst) = (*(pdst) & ~tmpmask) | (t2 & tmpmask); \} \else \{ \    unsigned long m; \    unsigned long n; \    PixelGroup t1, t2; \    PixelGroup pm; \    PFILL2(planemask, pm); \    m = PPW-(x); \    n = (w) - m; \    t1 = SCRRIGHT((src), (x)); \    DoRop(t2, rop, t1, *(pdst)); \    *(pdst) = (*(pdst) & (cfbendtab[x] | ~pm)) | (t2 & (cfbstarttab[x] & pm));\    t1 = SCRLEFT((src), m); \    DoRop(t2, rop, t1, *((pdst) + 1)); \    *((pdst)+1) = (*((pdst)+1) & (cfbstarttab[n] | ~pm)) | \	(t2 & (cfbendtab[n] & pm)); \}#else /* PSZ == 32 && PPW == 1*//* * These macros can be optimized for 32-bit pixels since there is no * need to worry about left/right edge masking.  These macros were * derived from the above using the following reductions: * *	- x & PIW = 0 	[since PIW = 0] *	- all masking tables are only indexed by 0  [ due to above ] *	- cfbstartab[0] and cfbendtab[0] = 0 	[ no left/right edge masks] *    - cfbstartpartial[0] and cfbendpartial[0] = ~0 [no partial pixel mask] * * Macro reduction based upon constants cannot be performed automatically *       by the compiler since it does not know the contents of the masking *       arrays in cfbmskbits.c. */#define maskbits(x, w, startmask, endmask, nlw) \    startmask = endmask = 0; \    nlw = (w);#define maskpartialbits(x, w, mask) \    mask = 0xFFFFFFFF;#define mask32bits(x, w, startmask, endmask) \    startmask = endmask = 0;/* * For 32-bit operations, getbits(), putbits(), and putbitsrop()  * will only be invoked with x = 0 and w = PPW (1).  The getbits()  * macro is only called within left/right edge logic, which doesn't * happen for 32-bit pixels. */#define getbits(psrc, x, w, dst) (dst) = *(psrc)#define putbits(src, x, w, pdst, planemask) \    *(pdst) = (*(pdst) & ~planemask) | (src & planemask);#define putbitsrop(src, x, w, pdst, planemask, rop) \{ \    PixelGroup t1; \    DoRop(t1, rop, (src), *(pdst)); \    *(pdst) = (*(pdst) & ~planemask) | (t1 & planemask); \}#endif /* PSZ != 32 *//* * Use these macros only when you're using the MergeRop stuff * in ../mfb/mergerop.h *//* useful only when not spanning destination longwords */#if PSZ == 24#define putbitsmropshort24(src,x,w,pdst,index) {\    PixelGroup   _tmpmask; \    PixelGroup   _t1; \    maskpartialbits ((x), (w), _tmpmask); \    _t1 = SCRRIGHT((src), (x)); \    DoMaskMergeRop24(_t1, pdst, _tmpmask, index); \}#endif#define putbitsmropshort(src,x,w,pdst) {\    PixelGroup   _tmpmask; \    PixelGroup   _t1; \    maskpartialbits ((x), (w), _tmpmask); \    _t1 = SCRRIGHT((src), (x)); \    *pdst = DoMaskMergeRop(_t1, *pdst, _tmpmask); \}/* useful only when spanning destination longwords */#define putbitsmroplong(src,x,w,pdst) { \    PixelGroup   _startmask, _endmask; \    int		    _m; \    PixelGroup   _t1; \    _m = PPW - (x); \    _startmask = cfbstarttab[x]; \    _endmask = cfbendtab[(w) - _m]; \    _t1 = SCRRIGHT((src), (x)); \    pdst[0] = DoMaskMergeRop(_t1,pdst[0],_startmask); \    _t1 = SCRLEFT ((src),_m); \    pdst[1] = DoMaskMergeRop(_t1,pdst[1],_endmask); \}#define putbitsmrop(src,x,w,pdst) \if ((x) + (w) <= PPW) {\    putbitsmropshort(src,x,w,pdst); \} else { \    putbitsmroplong(src,x,w,pdst); \}#if GETLEFTBITS_ALIGNMENT == 1#define getleftbits(psrc, w, dst)	dst = *((unsigned int *) psrc)#define getleftbits24(psrc, w, dst, idx){	\	regiseter int index; \	switch(index = ((idx)&3)<<1){ \	case 0: \	dst = (*((unsigned int *) psrc))&cfbmask[index]; \	break; \	case 2: \	case 4: \	dst = BitLeft(((*((unsigned int *) psrc))&cfbmask[index]), cfb24Shift[index]); \	dst |= BitRight(((*((unsigned int *) psrc)+1)&cfbmask[index]), cfb4Shift[index]); \	break; \	case 6: \	dst = BitLeft((*((unsigned int *) psrc)),cfb24Shift[index]); \	break; \	}; \}#endif /* GETLEFTBITS_ALIGNMENT == 1 */#define getglyphbits(psrc, x, w, dst) \{ \    dst = BitLeft((unsigned) *(psrc), (x)); \    if ( ((x) + (w)) > 32) \	dst |= (BitRight((unsigned) *((psrc)+1), 32-(x))); \}#if GETLEFTBITS_ALIGNMENT == 2#define getleftbits(psrc, w, dst) \    { \	if ( ((int)(psrc)) & 0x01 ) \		getglyphbits( ((unsigned int *)(((char *)(psrc))-1)), 8, (w), (dst) ); \	else \		dst = *((unsigned int *) psrc); \    }#endif /* GETLEFTBITS_ALIGNMENT == 2 */#if GETLEFTBITS_ALIGNMENT == 4#define getleftbits(psrc, w, dst) \    { \	int off, off_b; \	off_b = (off = ( ((int)(psrc)) & 0x03)) << 3; \	getglyphbits( \		(unsigned int *)( ((char *)(psrc)) - off), \		(off_b), (w), (dst) \	       ); \    }#endif /* GETLEFTBITS_ALIGNMENT == 4 *//* * getstipplepixels( psrcstip, x, w, ones, psrcpix, destpix ) * * Converts bits to pixels in a reasonable way.  Takes w (1 <= w <= PPW) * bits from *psrcstip, starting at bit x; call this a quartet of bits. * Then, takes the pixels from *psrcpix corresponding to the one-bits (if * ones is TRUE) or the zero-bits (if ones is FALSE) of the quartet * and puts these pixels into destpix. * * Example: * *      getstipplepixels( &(0x08192A3B), 17, 4, 1, &(0x4C5D6E7F), dest ) * * 0x08192A3B = 0000 1000 0001 1001 0010 1010 0011 1011 * * This will take 4 bits starting at bit 17, so the quartet is 0x5 = 0101. * It will take pixels from 0x4C5D6E7F corresponding to the one-bits in this * quartet, so dest = 0x005D007F. * * XXX Works with both byte order. * XXX This works for all values of x and w within a doubleword. */#if (BITMAP_BIT_ORDER == MSBFirst)#define getstipplepixels( psrcstip, x, w, ones, psrcpix, destpix ) \{ \    PixelGroup q; \    int m; \    if ((m = ((x) - ((PPW*PSZ)-PPW))) > 0) { \        q = (*(psrcstip)) << m; \	if ( (x)+(w) > (PPW*PSZ) ) \	    q |= *((psrcstip)+1) >> ((PPW*PSZ)-m); \    } \    else \        q = (*(psrcstip)) >> -m; \    q = QuartetBitsTable[(w)] & ((ones) ? q : ~q); \    *(destpix) = (*(psrcpix)) & QuartetPixelMaskTable[q]; \}#else /* BITMAP_BIT_ORDER == LSB *//*================================================================   BEGIN ORL VNC modification   Only use ldq_u on XFREE86 platforms */#ifdef XFREE86#define getstipplepixels( psrcstip, xt, w, ones, psrcpix, destpix ) \{ \    PixelGroup q; \    q = ldq_u(psrcstip) >> (xt); \    if ( ((xt)+(w)) > (PPW*PSZ) ) \        q |= (ldq_u((psrcstip)+1)) << ((PPW*PSZ)-(xt)); \    q = QuartetBitsTable[(w)] & ((ones) ? q : ~q); \    *(destpix) = (*(psrcpix)) & QuartetPixelMaskTable[q]; \}#else /* XFREE86 */#define getstipplepixels( psrcstip, xt, w, ones, psrcpix, destpix ) \{ \    PixelGroup q; \    q = *(psrcstip) >> (xt); \    if ( ((xt)+(w)) > (PPW*PSZ) ) \        q |= (*((psrcstip)+1)) << ((PPW*PSZ)-(xt)); \    q = QuartetBitsTable[(w)] & ((ones) ? q : ~q); \    *(destpix) = (*(psrcpix)) & QuartetPixelMaskTable[q]; \}#endif /* XFREE86 *//* END ORL VNC modification================================================================*/#if PSZ == 24# if 0#define getstipplepixels24( psrcstip,xt,w,ones,psrcpix,destpix,stipindex,srcindex,dstindex) \{ \    PixelGroup q, srcpix, srcstip; \    unsigned long src; \    register unsigned int sidx; \    register unsigned int didx; \    register unsigned int stipidx; \    sidx = ((srcindex) & 3)<<1; \    didx = ((dstindex) & 3)<<1; \    q = *(psrcstip) >> (xt); \/*    if((srcindex)!=0)*/ \/*    src = (((*(psrcpix)) << cfb24Shift[sidx]) & (cfbmask[sidx])) |*/ \/*	(((*((psrcpix)+1)) << cfb24Shift[sidx+1]) & (cfbmask[sidx+1])); */\/*    else */\	src = (*(psrcpix))&0xFFFFFF; \    if ( ((xt)+(w)) > PGSZ ) \        q |= (*((psrcstip)+1)) << (PGSZ -(xt)); \    q = QuartetBitsTable[(w)] & ((ones) ? q : ~q); \    src &= QuartetPixelMaskTable[q]; \    *(destpix) &= cfbrmask[didx]; \    switch(didx) {\	case 0: \		*(destpix) |= (src &cfbmask[didx]); \		break; \	case 2: \	case 4: \		destpix++;didx++; \		*(destpix) = ((*(destpix)) & (cfbrmask[didx]))| \			(BitLeft(src, cfb24Shift[didx]) & (cfbmask[didx])); \		destpix--; didx--;\	case 6: \		*(destpix) |= (BitRight(src, cfb24Shift[didx]) & cfbmask[didx]); \		break; \	}; \}# else#define getstipplepixels24(psrcstip,xt,ones,psrcpix,destpix,stipindex) \{ \    PixelGroup q, srcpix, srcstip; \    unsigned long src; \    register unsigned int stipidx; \    q = *(psrcstip) >> (xt); \    q = ((ones) ? q : ~q) & 1; \    *(destpix) = (*(psrcpix)) & QuartetPixelMaskTable[q]; \}# endif#endif /* PSZ == 24 */#endifextern PixelGroup cfbstarttab[];extern PixelGroup cfbendtab[];extern PixelGroup cfbstartpartial[];extern PixelGroup cfbendpartial[];extern PixelGroup cfbrmask[];extern PixelGroup cfbmask[];extern PixelGroup QuartetBitsTable[];extern PixelGroup QuartetPixelMaskTable[];#if PSZ == 24extern int cfb24Shift[];#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -