remove test cruft, add possibility for a seperator
[enigma2.git] / lib / gdi / gpixmap.cpp
index a551984f592d85814c83448a860a048e8d100ce0..3ebd9a0296f18f5f2c476ce458857bb64a3238c4 100644 (file)
@@ -182,6 +182,7 @@ void gPixmap::blit(const gPixmap &src, ePoint pos, const gRegion &clip, int flag
                eRect area=eRect(pos, src.size());
                area&=clip.rects[i];
                area&=eRect(ePoint(0, 0), size());
+
                if ((area.width()<0) || (area.height()<0))
                        continue;
 
@@ -191,6 +192,7 @@ void gPixmap::blit(const gPixmap &src, ePoint pos, const gRegion &clip, int flag
                if ((surface->data_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))
                {
@@ -308,7 +310,7 @@ void gPixmap::blit(const gPixmap &src, ePoint pos, const gRegion &clip, int flag
                                                // use duff's device here!
                                        while (width--)
                                        {
-                                               if (!*src)
+                                               if (!(pal[*src]&0x80000000))
                                                {
                                                        src++;
                                                        dst++;
@@ -377,7 +379,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;
@@ -436,7 +438,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)
                                {
@@ -468,6 +470,10 @@ fail:
 
 gColor gPalette::findColor(const gRGB &rgb) const
 {
+               /* grayscale? */
+       if (!data)
+               return (rgb.r + rgb.g + rgb.b) / 3;
+       
        int difference=1<<30, best_choice=0;
        for (int t=0; t<colors; t++)
        {