コード例 #1
0
ファイル: accel.cpp プロジェクト: OpenPE/Enigma2PC-Old
int gAccel::fill(gSurface *dst, const eRect &area, unsigned long col)
{
#ifdef ATI_ACCEL
	ati_accel_fill(
		dst->data_phys, dst->x, dst->y, dst->stride, 
		area.left(), area.top(), area.width(), area.height(),
		col);
	return 0;
#endif
#ifdef BCM_ACCEL
	if (!m_bcm_accel_state) {
		bcm_accel_fill(
			dst->data_phys, dst->x, dst->y, dst->stride,
			area.left(), area.top(), area.width(), area.height(),
			col);
		return 0;
	}
#endif
	return -1;
}
コード例 #2
0
ファイル: gpixmap.cpp プロジェクト: TitanNit/tdt
// requires 24bit picture!
void gPixmap::FBblitAccel(const gPixmap &src, eRect &fbDst)
{
	fbClass *fb = fbClass::getInstance();
	
	unsigned char *tempSpace = fb->lfb + 1920 * 1080 * 4 + 1280 * 720 * 4;
	
	int lines = 602112 / (src.surface->x * 3); 
	int linesMem = lines * src.surface->x * 3;
	int startLine = 0;
	
	STMFBIO_BLT_DATA  bltData;
	memset(&bltData, 0, sizeof(STMFBIO_BLT_DATA));
    bltData.operation  = BLT_OP_COPY;
    bltData.ulFlags    = BLT_OP_FLAGS_GLOBAL_ALPHA;
	bltData.srcOffset  = 1920 * 1080 * 4 + 1280 * 720 * 4;
	bltData.srcPitch   = src.surface->x * 3;
	bltData.dstOffset  = 1920 * 1080 * 4;
	bltData.dstPitch   = fbDst.width() * 4;
	bltData.src_top    = 0;
	bltData.src_left   = 0;
	bltData.src_right  = src.surface->x;
    bltData.src_bottom = src.surface->y;
    bltData.dst_left   = fbDst.left();
    bltData.dst_right  = fbDst.left() + fbDst.width();
    bltData.srcFormat = SURF_BGR888;
    bltData.dstFormat = SURF_ARGB8888;
    bltData.globalAlpha = 255;
	bool scaleWidth;
	if((float)src.surface->y / src.surface->y > (float)fbDst.height() / fbDst.width())
		scaleWidth = true;
	else
		scaleWidth = false;
		
	unsigned char *dataPt = (unsigned char *)src.surface->data;
	while(startLine < src.surface->y)
	{
		if(src.surface->y - startLine < lines)
		{
			lines = src.surface->y - startLine;
			bltData.src_bottom = lines;
			linesMem = lines * src.surface->x * 3;
		}
		
		memcpy(dataPt, tempSpace, linesMem);
		dataPt += linesMem;
		
		if(scaleWidth)  
		{  
			bltData.dst_top    = (fbDst.width() * startLine) / src.surface->y + fbDst.top();  
			bltData.dst_bottom = (fbDst.width() * (startLine + lines)) / src.surface->y + fbDst.top();  
		}  
		else  
		{  
			bltData.dst_top    = (src.surface->y * startLine) / fbDst.width()  + fbDst.top();  
			bltData.dst_bottom = (src.surface->y * (startLine + lines)) / fbDst.width();  
		}  
		
		fb->directBlit(bltData);
		// In case of concurrency problems sync blitter here
		
		startLine += lines;
	}
	
}
コード例 #3
0
ファイル: accel.cpp プロジェクト: popazerty/e2-dmm
int gAccel::blit(gSurface *dst, const gSurface *src, const eRect &p, const eRect &area, int flags)
{
#ifdef STMFB_ACCEL
	//eDebug( "src: %4d %4d %4d %4d\tdst: %4d %4d %4d %4d\n"
	//		"area: %4d %4d %4d %4d\tp: %4d %4d %4d %4d\n",
	//		src->data_phys, src->x, src->y, src->stride,
	//		dst->data_phys, dst->x, dst->y, dst->stride, 
	//		area.left(), area.top(), area.width(), area.height(),
	//		p.x(), p.y(), p.width(), p.height());

	int src_format = 0;
	void *data = 0;
     	int data_phys = 0;

	if (src->bpp == 32)
		src_format = 0;
	else if ((src->bpp == 8) && (dst->bpp == 32))
	{
		src_format = 1;
        	if(accelAlloc(data, data_phys, area.height() * area.width() * 4))
			return -1;

		__u8 *srcptr=(__u8*)src->data;
		__u8 *dstptr=(__u8*)data;
		__u32 pal[256];

		for (int i=0; i<256; ++i)
		{
			if (src->clut.data && (i<src->clut.colors))
				pal[i]=(src->clut.data[i].a<<24)|(src->clut.data[i].r<<16)|(src->clut.data[i].g<<8)|(src->clut.data[i].b);
			else
				pal[i]=0x010101*i;
			if((pal[i]&0xFF000000) >= 0xE0000000)
				pal[i] = 0xFF000000;
			pal[i]^=0xFF000000;
		}
		srcptr+=area.left()*src->bypp+area.top()*src->stride;

		for (int y=0; y<area.height(); y++)
		{
			int width=area.width();
			unsigned char *psrc=(unsigned char*)srcptr;
			__u32 *pdst=(__u32*)dstptr;

			while (width--)
				*pdst++=pal[*psrc++];

			srcptr+=src->stride;
			dstptr+=area.width() * 4;
		}
	} else {
		if(data_phys)
			accelFree(data_phys);
		return -1;
	}

	if(data_phys)
	{
		stmfb_accel_blit(
			data_phys, 0, 0, area.width() * 4, src_format,
			dst->data_phys, dst->x, dst->y, dst->stride,
			0, 0, area.width(), area.height(),
			p.x(), p.y(), p.width(), p.height());
		accelFree(data_phys);
	} else {
		stmfb_accel_blit(
			src->data_phys, src->x, src->y, src->stride, src_format,
			dst->data_phys, dst->x, dst->y, dst->stride,
			area.left(), area.top(), area.width(), area.height(),
			p.x(), p.y(), p.width(), p.height());
	}
	return 0;
#endif
#ifdef ATI_ACCEL
	ati_accel_blit(
		src->data_phys, src->x, src->y, src->stride,
		dst->data_phys, dst->x, dst->y, dst->stride, 
		area.left(), area.top(), area.width(), area.height(),
		p.x(), p.y());
	return 0;
#endif
#ifdef BCM_ACCEL
	if (!m_bcm_accel_state)
	{
		if (flags & (gPixmap::blitAlphaTest|gPixmap::blitAlphaBlend)) /* unsupported flags */
			return -1;
		unsigned long pal_addr = 0;
		int src_format = 0;
		if (src->bpp == 32)
			src_format = 0;
		else if ((src->bpp == 8) && src->clut.data)
		{
			src_format = 1;
			/* sync pal */
			int i;
			pal_addr = src->stride * src->y;
			unsigned long *pal = (unsigned long*)(((unsigned char*)src->data) + pal_addr);
			pal_addr += src->data_phys;
			for (i = 0; i < src->clut.colors; ++i)
				*pal++ = src->clut.data[i].argb() ^ 0xFF000000;
		} else
			return -1; /* unsupported source format */

		bcm_accel_blit(
			src->data_phys, src->x, src->y, src->stride, src_format,
			dst->data_phys, dst->x, dst->y, dst->stride, 
			area.left(), area.top(), area.width(), area.height(),
			p.x(), p.y(), p.width(), p.height(),
			pal_addr, flags);
		return 0;
	}
#endif
	return -1;
}