X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fgdi%2Fgpixmap.cpp;h=315c18d130428fe8543788f8d5cacabd6c844e57;hp=855cb8b25518b8aa011df534d6568aafec2d9133;hb=9ccb92fb3eaca35ec60c1a596db9620f9f302044;hpb=1c242c0a654a5c4048ba4219a0982f8ba8a85246 diff --git a/lib/gdi/gpixmap.cpp b/lib/gdi/gpixmap.cpp index 855cb8b..315c18d 100644 --- a/lib/gdi/gpixmap.cpp +++ b/lib/gdi/gpixmap.cpp @@ -207,6 +207,54 @@ void gPixmap::fill(const gRegion ®ion, const gRGB &color) } } +static void blit_8i_to_32(__u32 *dst, __u8 *src, __u32 *pal, int width) +{ + while (width--) + *dst++=pal[*src++]; +} + +static void blit_8i_to_32_at(__u32 *dst, __u8 *src, __u32 *pal, int width) +{ + while (width--) + { + if (!(pal[*src]&0x80000000)) + { + src++; + dst++; + } else + *dst++=pal[*src++]; + } +} + + /* WARNING, this function is not endian safe! */ +static void blit_8i_to_32_ab(__u32 *dst, __u8 *src, __u32 *pal, int width) +{ + while (width--) + { +#define BLEND(x, y, a) (y + (((x-y) * a)>>8)) + __u32 srccol = pal[*src++]; + __u32 dstcol = *dst; + unsigned char sb = srccol & 0xFF; + unsigned char sg = (srccol >> 8) & 0xFF; + unsigned char sr = (srccol >> 16) & 0xFF; + unsigned char sa = (srccol >> 24) & 0xFF; + + unsigned char db = dstcol & 0xFF; + unsigned char dg = (dstcol >> 8) & 0xFF; + unsigned char dr = (dstcol >> 16) & 0xFF; + unsigned char da = (dstcol >> 24) & 0xFF; + + da = BLEND(0xFF, da, sa) & 0xFF; + dr = BLEND(sr, dr, sa) & 0xFF; + dg = BLEND(sg, dg, sa) & 0xFF; + db = BLEND(sb, db, sa) & 0xFF; + +#undef BLEND + *dst++ = db | (dg << 8) | (dr << 16) | (da << 24); + } +} + + void gPixmap::blit(const gPixmap &src, ePoint pos, const gRegion &clip, int flag) { for (unsigned int i=0; ibypp+area.top()*surface->stride; for (int y=0; ybypp+area.top()*surface->stride; for (int y=0; ystride; dstptr+=surface->stride; }