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

📄 fblin8.c

📁 在ecos 下mingui 的移植开发
💻 C
📖 第 1 页 / 共 2 页
字号:
#endif	dst += dstx + dsty * dlinelen;	src += srcx + srcy * slinelen;	DRAWON;	while(--h >= 0) {		/* a _fast_ memcpy is a _must_ in this routine*/		memcpy(dst, src, w);		dst += dlinelen;		src += slinelen;	}	DRAWOFF;}/*do clip*/static void linear8_putbox ( PSD psd, int x, int y, int w, int h, void *buf){	gal_uint8	*src = (gal_uint8*) buf;	int srcwidth = w;	gal_uint8 *dst;	int dstwidth = psd->linelen;//	syslog(LOG_INFO,"fblin16:putbox 1: x:%d,y:%d,w:%d,h:%d",x,y,w,h);//	syslog(LOG_INFO,"fb16:psd->doclip:%d",psd->doclip);//	syslog(LOG_INFO,"fb16:psd->clipminx:%d,psd->clipmaxx:%d",psd->clipminx,psd->clipmaxx);//	syslog(LOG_INFO,"fb16:psd->clipminy:%d,psd->clipmaxy:%d",psd->clipminy,psd->clipmaxy);#ifndef NDEBUG	assert (w > 0);	assert (h > 0);	assert (buf);	if (psd->doclip) {		assert ((x + w - 1 >= psd->clipminx) && (x < psd->clipmaxx));		assert ((y + h - 1 >= psd->clipminy) && (y < psd->clipmaxy));	} else {		assert ((x + w - 1 >= 0) && (x < psd->xres));		assert ((y + h - 1 >= 0) && (y < psd->yres));	}#endif	if (psd->doclip) {			if (y < psd->clipminy) {			h -= psd->clipminy - y;			src += (psd->clipminy - y) * srcwidth;			y = psd->clipminy;		}		if (x < psd->clipminx) {			w -= psd->clipminx - x;			src += psd->clipminx - x;			x = psd->clipminx;		}				if (y + h - 1 >= psd->clipmaxy) 			h =  psd->clipmaxy- y;		if (x + w - 1 >= psd->clipmaxx) 			w =  psd->clipmaxx- x;	}	else {		if ( y < 0 ) {			h += y;			src -= y * srcwidth;			y = 0;		}		if ( x < 0 ) {			w += x;			src -= x;			x = 0;		}				if ( y + h  -1 >= psd->yres) 			h = psd->yres - y ;		if ( x + w  -1 >= psd->xres) 			w = psd->xres - x ;	}//	syslog(LOG_INFO,"fblin16:putbox 2: x:%d,y:%d,w:%d,h:%d",x,y,w,h);	dst = (gal_uint8 *)(psd->addr) + y*dstwidth + x;	DRAWON;	/* Optimized full-width case */	if (w == dstwidth && x == 0) {		memcpy(dst, src, w*h);		return;	}		while (h > 0) {		memcpy(dst, src, w);		dst += dstwidth;		src += srcwidth;		h--;	}	DRAWOFF;}/*clip to screen*/static void linear8_getbox ( PSD psd, int x, int y, int w, int h, void* buf ){	gal_uint8 *dst = (gal_uint8*) buf;	int dstwidth = w;	gal_uint8 *src;	int srcwidth = psd->linelen;//	syslog(LOG_INFO,"fblin16:getbox 1: x:%d,y:%d,w:%d,h:%d",x,y,w,h);//	syslog(LOG_INFO,"psd->xres:%d,psd->yres:%d",psd->xres,psd->yres);#ifndef NDEBUG	assert (w > 0);	assert (h > 0);	assert (buf);	assert ((x + w - 1 >= 0) && (x < psd->xres));	assert ((y + h - 1 >= 0) && (y < psd->yres));#endif	if ( y < 0 ) {		h += y;		dst -= y * dstwidth;		y = 0;	}	if ( x < 0 ) {		w += x;		dst -= x;		x = 0;	}			if ( y + h  -1 >= psd->yres) 		h = psd->yres - y ;	if ( x + w  -1 >= psd->xres) 		w = psd->xres - x ;//	syslog(LOG_INFO,"fblin16:getbox 2: x:%d,y:%d,w:%d,h:%d",x,y,w,h);	src = (gal_uint8 *)(psd->addr) + y*srcwidth + x;	DRAWON;	/* Optimized full-width case */	if (w == srcwidth && x == 0) {		memcpy(dst, src, w * h);		return ;	}		while (h-- > 0) {		memcpy(dst, src, w);		dst += dstwidth;		src += srcwidth;	}	DRAWOFF;}static	void linear8_putboxmask (PSD psd, int x, int y, int w, int h, void *buf){	gal_uint8 *src= (gal_uint8*) buf;	gal_uint8 *src1;	gal_uint8 *dst;	gal_uint8 *endoflinesrc;	int i;	int srcwidth =  w ;	int dstwidth = psd->linelen;#ifndef NDEBUG	assert (w > 0);	assert (h > 0);	assert (buf);	if (psd->doclip) {		assert ((x + w - 1 >= psd->clipminx) && (x < psd->clipmaxx));		assert ((y + h - 1 >= psd->clipminy) && (y < psd->clipmaxy));	} else {		assert ((x + w - 1 >= 0) && (x < psd->xres));		assert ((y + h - 1 >= 0) && (y < psd->yres));	}#endif	if (psd->doclip) {			if (y < psd->clipminy) {			h -= psd->clipminy - y;			src += (psd->clipminy - y) * srcwidth;			y = psd->clipminy;		}		if (x < psd->clipminx) {			w -= psd->clipminx - x;			src += psd->clipminx - x;			x = psd->clipminx;		}				if (y + h - 1 >= psd->clipmaxy) 			h =  psd->clipmaxy- y;		if (x + w - 1 >= psd->clipmaxx) 			w =  psd->clipmaxx- x;	}	else {		if ( y < 0 ) {			h += y;			src -= y * srcwidth;			y = 0;		}		if ( x < 0 ) {			w += x;			src -= x;			x = 0;		}				if ( y + h  -1 >= psd->yres) 			h = psd->yres - y ;		if ( x + w  -1 >= psd->xres) 			w = psd->xres - x ;	}	dst= (gal_uint8 *)(psd->addr) + y*dstwidth + x;	DRAWON;	for (i = 0; i < h; i++) {		src1 = src ; 		endoflinesrc = src +  w;		while (src1 < endoflinesrc - 7) {		    gal_uint32 c2 = *(gal_uint32 *) src1;		    if (c2 & 0xffff)			*(gal_uint16 *) dst = (gal_uint16) c2;		    c2 >>= 16;		    if (c2 & 0xffff)			*(gal_uint16 *) (dst + 2) = (gal_uint16) c2;		    c2 = *(unsigned *) (src1 + 4);		    if (c2 & 0xffff)			*(gal_uint8 *) (dst + 4) = (gal_uint8) c2;		    c2 >>= 16;		    if (c2 & 0xffff)			*(gal_uint8 *) (dst + 6) = (gal_uint8) c2;		    src1 += 8;		    dst += 8;		}		while (src1 < endoflinesrc) {			gal_uint8 c = *(gal_uint8 *) src1;			if (c)				*(gal_uint8 *) dst = c;			src1 ++;			dst ++;		}		dst += psd->linelen  - w ;		src += srcwidth ;	}	DRAWOFF;}static	void linear8_copybox(PSD psd,int x1, int y1, int w, int h, int x2, int y2){	gal_uint8 *svp, *dvp;#ifndef NDEBUG	assert (w > 0);	assert (h > 0);	assert ((x1 >= 0) && (x1 + w - 1 < psd->xres)); 	assert ((y1 >= 0) && (y1 + h - 1 < psd->yres)); 	if (psd->doclip) {		assert ((x2 >= psd->clipminx) && (x2 + w - 1 < psd->clipmaxx)); 		assert ((y2 >= psd->clipminy) && (y2 + h - 1 < psd->clipmaxy)); 	} else {		assert ((x2 >= 0) && (x2 + w -1 < psd->xres)); 		assert ((y2 >= 0) && (y2 + h -1 < psd->xres)); 	}#endif	DRAWON;	if (y1 >= y2) {		if (y1 == y2 && x2 >= x1) {	/* tricky */			int i;			if (x1 == x2)				return;			/* use a temporary buffer to store a line */			/* using reversed movs would be much faster */			svp = (gal_uint8 *) psd->addr + y1 * psd->linelen + x1;			dvp = (gal_uint8 *) psd->addr + y2 * psd->linelen + x2;			for (i = 0; i < h; i++) {				gal_uint8 linebuf[2048];				memcpy (linebuf, svp, w);				memcpy (dvp, linebuf, w);				svp += psd->linelen;				dvp += psd->linelen;			}		} else {		/* copy from top to bottom */			int i;			svp = (gal_uint8 *) psd->addr + y1 * psd->linelen + x1;			dvp = (gal_uint8 *) psd->addr + y2 * psd->linelen + x2;			for (i = 0; i < h; i++) {				memcpy(dvp, svp, w);				svp += psd->linelen;				dvp += psd->linelen;			}		}	} else {			/* copy from bottom to top */		int i;		svp = (gal_uint8 *) psd->addr + (y1 + h) * psd->linelen + x1;		dvp = (gal_uint8 *) psd->addr + (y2 + h) * psd->linelen + x2;		for (i = 0; i < h; i++) {			svp -= psd->linelen;			dvp -= psd->linelen;			memcpy (dvp, svp, w);		}	}	DRAWOFF;}SUBDRIVER fblinear8 = {	linear8_init,	linear8_drawpixel,	linear8_readpixel,	linear8_drawhline,	linear8_puthline,	linear8_gethline,	linear8_drawvline,	linear8_putvline,	linear8_getvline,	linear8_blit,	linear8_putbox,	linear8_getbox,	linear8_putboxmask,	linear8_copybox};/*static int linear8_init (PSD psd)static void linear8_drawpixel (PSD psd, int x, int y, gal_pixel c)static gal_pixel linear8_readpixel (PSD psd, int x, int y)static void linear8_drawhline (PSD psd, int x, int y, int w, gal_pixel c)static void linear8_puthline (PSD psd,int x, int y, int w, void *buf)static void linear8_gethline (PSD psd, int x, int y, int w, void *buf)static void linear8_drawvline(PSD psd, int x, int y, int h, gal_pixel c)static void linear8_putvline (PSD psd,int x, int y, int h, void *buf)static void linear8_getvline (PSD psd, int x, int y, int h, void *buf)static void linear8_blit (PSD dstpsd, int dstx, int dsty, int w, int h,	PSD srcpsd, int srcx, int srcy)static void linear8_putbox ( PSD psd, int x, int y, int w, int h, void *buf)static void linear8_getbox ( PSD psd, int x, int y, int w, int h, void* buf )static	void linear8_putboxmask ( PSD psd, int x, int y, int w, int h, void *buf)static	void linear8_copybox(PSD psd,int x1, int y1, int w, int h, int x2, int y2)*/

⌨️ 快捷键说明

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