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

📄 fb_mfbs.c

📁 早期freebsd实现
💻 C
📖 第 1 页 / 共 5 页
字号:
	} \}#define	Duff_single(nlw, addr, op) { \	(addr) += (nlw) & 7; \	switch ((nlw) & 7) { \	case 7: \		(addr)[-7] op; \	case 6: \		(addr)[-6] op; \	case 5: \		(addr)[-5] op; \	case 4: \		(addr)[-4] op; \	case 3: \		(addr)[-3] op; \	case 2: \		(addr)[-2] op; \	case 1: \		(addr)[-1] op; \	} \	while (((nlw) -= 8) >= 0) { \		(addr) += 8; \		(addr)[-8] op; \		(addr)[-7] op; \		(addr)[-6] op; \		(addr)[-5] op; \		(addr)[-4] op; \		(addr)[-3] op; \		(addr)[-2] op; \		(addr)[-1] op; \	} \}#endif /* mc68020 */voidmfb_copy_area32(addrSrc, addrDst, widthSrc, widthDst, sr, dp)u_int	*addrSrc;u_int	*addrDst;u_int	widthSrc;u_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 = (*pdst & ~startmask |						 *psrc & startmask);					psrc++;					pdst++;				}				nl = nlMiddle;				Duff_plus(nl, pdst, psrc, =);				if (endmask) {					*pdst = (*pdst & ~endmask |						 *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 = (*pdst & ~startmask |						 bits1 & startmask);					pdst++;				}				nl = nlMiddle;				bits1 = bits;				Duff_shift_plus(nl, pdst, psrc, =);				if (endmask) {					bits1 = bits << leftShift;					if (endmask << rightShift) {						bits1 |= *psrc >> rightShift;					}					*pdst = (*pdst & ~endmask |						 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--;					*pdst = (*pdst & ~endmask |						 *psrc & endmask);				}				nl = nlMiddle;				Duff_minus(nl, pdst, psrc, =);				if (startmask) {					--pdst;					--psrc;					*pdst = (*pdst & ~startmask |						 *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--;					*pdst = (*pdst & ~endmask |						 bits1 & endmask);				}				nl = nlMiddle;				bits1 = bits;				Duff_shift_minus(nl, pdst, psrc, =);				if (startmask) {					bits1 = (bits >> rightShift);					if (startmask >> leftShift) {						bits1 |= *--psrc << leftShift;					}					--pdst;					*pdst = (*pdst & ~startmask |						 bits1 & startmask);				}			}		}	}}voidmfb_copyinv_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 = (*pdst & ~startmask |						 ~*psrc & startmask);					psrc++;					pdst++;				}				nl = nlMiddle;				Duff_plus(nl, pdst, psrc, = ~);				if (endmask) {					*pdst = (*pdst & ~endmask |						 ~*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;				psrcLine += widthSrc;				pdstLine += widthDst;				bits = 0;				if (xoffSrc > xoffDst)					bits = *psrc++;				if (startmask) {					bits1 = bits << leftShift;					bits = *psrc++;					bits1 |= bits >> rightShift;					*pdst = (*pdst & ~startmask |						 ~bits1 & startmask);					pdst++;				}				nl = nlMiddle;				bits1 = bits;				Duff_shift_plus(nl, pdst, psrc, = ~);				if (endmask) {					bits1 = bits << leftShift;					if (endmask << rightShift) {						bits1 |= *psrc >> rightShift;					}					*pdst = (*pdst & ~endmask |						 ~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--;					*pdst = (*pdst & ~endmask |						 ~*psrc & endmask);				}				nl = nlMiddle;				Duff_minus(nl, pdst, psrc, = ~);				if (startmask) {					--pdst;					--psrc;					*pdst = (*pdst & ~startmask |						 ~*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--;					*pdst = (*pdst & ~endmask |						 ~bits1 & endmask);				}				nl = nlMiddle;				bits1 = bits;				Duff_shift_minus(nl, pdst, psrc, = ~);				if (startmask) {					bits1 = (bits >> rightShift);					if (startmask >> leftShift) {						bits1 |= *--psrc << leftShift;					}					--pdst;

⌨️ 快捷键说明

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