int gAccel::blit(gSurface *dst, const gSurface *src, const eRect &p, const eRect &area, int flags) { #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; }
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; }