X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/f557ecfc2e3ad520c3e53ebb94f55d0fb7895990..6ae5817707cf77c29ff070e76791cc4816946ec4:/lib/gdi/gpixmap.cpp diff --git a/lib/gdi/gpixmap.cpp b/lib/gdi/gpixmap.cpp index e44ee0fa..d0eff03f 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,6 +175,38 @@ 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; istride; } } else - eFatal("cannot blit %dbpp from %dbpp", surface->bpp, src.surface->bpp); + eWarning("cannot blit %dbpp from %dbpp", surface->bpp, src.surface->bpp); } } @@ -506,13 +538,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); }