X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/22143de3c8c4780166beeb1e0a1575768c76bfe4..1c242c0a654a5c4048ba4219a0982f8ba8a85246:/lib/gdi/gpixmap.cpp diff --git a/lib/gdi/gpixmap.cpp b/lib/gdi/gpixmap.cpp index 3e07bca0..855cb8b2 100644 --- a/lib/gdi/gpixmap.cpp +++ b/lib/gdi/gpixmap.cpp @@ -106,7 +106,7 @@ gSurface::gSurface(eSize size, int _bpp, int accel) clut.data = 0; if (!data) - data = malloc(y * stride); + data = new unsigned char [y * stride]; type = 1; } @@ -118,9 +118,9 @@ gSurface::~gSurface() if (data_phys) gAccel::getInstance()->accelFree(data_phys); else - free(data); + delete [] (unsigned char*)data; - delete[] clut.data; + delete [] clut.data; } } @@ -175,32 +175,61 @@ void gPixmap::fill(const gRegion ®ion, const gColor &color) } } +void gPixmap::fill(const gRegion ®ion, const gRGB &color) +{ + unsigned int i; + for (i=0; ibpp == 32) + { + __u32 col; + + col = color.argb(); + col^=0xFF000000; + + if (surface->data_phys && gAccel::getInstance()) + if (!gAccel::getInstance()->fill(surface, area, col)) + continue; + + for (int y=area.top(); ydata)+y*surface->stride+area.left()*surface->bypp); + int x=area.width(); + while (x--) + *dst++=col; + } + } else + eWarning("couldn't rgbfill %d bpp", surface->bpp); + } +} + void gPixmap::blit(const gPixmap &src, ePoint pos, const gRegion &clip, int flag) { for (unsigned int i=0; idata_phys && src.surface->data_phys) && (gAccel::getInstance())) if (!gAccel::getInstance()->blit(surface, src.surface, area.topLeft(), srcarea, flag)) continue; - flag &= ~ blitAlphaBlend; - + if ((surface->bpp == 8) && (src.surface->bpp==8)) { __u8 *srcptr=(__u8*)src.surface->data; __u8 *dstptr=(__u8*)surface->data; - + srcptr+=srcarea.left()*src.surface->bypp+srcarea.top()*src.surface->stride; dstptr+=area.left()*surface->bypp+area.top()*surface->stride; for (int y=0; ydata; __u32 *dstptr=(__u32*)surface->data; - + srcptr+=srcarea.left()+srcarea.top()*src.surface->stride/4; dstptr+=area.left()+area.top()*surface->stride/4; for (int y=0; ybypp+srcarea.top()*src.surface->stride; dstptr+=area.left()*surface->bypp+area.top()*surface->stride; for (int y=0; ystride; } } else - eFatal("cannot blit %dbpp from %dbpp", surface->bpp, src.surface->bpp); + eWarning("cannot blit %dbpp from %dbpp", surface->bpp, src.surface->bpp); } } @@ -381,7 +410,7 @@ void gPixmap::line(const gRegion &clip, ePoint start, ePoint dst, gColor color) if (clip.rects.empty()) return; - __u32 col; + __u32 col = 0; if (surface->bpp == 8) { srf8 = (__u8*)surface->data; @@ -440,7 +469,7 @@ void gPixmap::line(const gRegion &clip, ePoint start, ePoint dst, gColor color) do { ++a; - if (a == clip.rects.size()) + if ((unsigned int)a == clip.rects.size()) a = 0; if (a == lasthit) { @@ -508,13 +537,17 @@ DEFINE_REF(gPixmap); gPixmap::~gPixmap() { + if (must_delete_surface) + delete surface; } -gPixmap::gPixmap(gSurface *surface): surface(surface) +gPixmap::gPixmap(gSurface *surface) + :surface(surface), must_delete_surface(false) { } gPixmap::gPixmap(eSize size, int bpp, int accel) + :must_delete_surface(true) { surface = new gSurface(size, bpp, accel); }