Merge branch 'master' of git.opendreambox.org:/git/enigma2
authorghost <andreas.monzner@multimedia-labs.de>
Mon, 22 Jun 2009 23:05:14 +0000 (01:05 +0200)
committerghost <andreas.monzner@multimedia-labs.de>
Mon, 22 Jun 2009 23:05:14 +0000 (01:05 +0200)
lib/dvb/subtitle.cpp
lib/gdi/accel.cpp
lib/gdi/bcm.cpp
lib/gdi/erect.h
lib/gdi/gpixmap.cpp

index b6c5b7189dd1fe7400b6cb01329bd1084f6c7cd1..87dadba5e232b6776008df7ff3a715b5dcaec2b4 100644 (file)
@@ -491,6 +491,7 @@ int eDVBSubtitleParser::subtitle_process_segment(__u8 *segment)
                processed_length += 2;
 
                region->region_buffer = new gPixmap(eSize(region->region_width, region->region_height), 8, 1);
+               memset(region->region_buffer->surface->data, 0, region->region_height * region->region_buffer->surface->stride);
                //eDebug("new region_buffer %p", &(*region->region_buffer));
 
                int region_level_of_compatibility, region_depth;
index bf9a5a44d26f3039aa908f67f3c382f36e879dde..5e489eb338d04f8fdc4c6644ce52c12d5fc3f5ae 100644 (file)
@@ -28,10 +28,11 @@ extern void ati_accel_fill(
 extern int bcm_accel_init(void);
 extern void bcm_accel_close(void);
 extern void bcm_accel_blit(
-               int src_addr, int src_width, int src_height, int src_stride,
+               int src_addr, int src_width, int src_height, int src_stride, int src_format,
                int dst_addr, int dst_width, int dst_height, int dst_stride,
                int src_x, int src_y, int width, int height,
-               int dst_x, int dst_y, int dwidth, int dheight);
+               int dst_x, int dst_y, int dwidth, int dheight,
+               int pal_addr);
 extern void bcm_accel_fill(
                int dst_addr, int dst_width, int dst_height, int dst_stride,
                int x, int y, int width, int height,
@@ -97,11 +98,31 @@ int gAccel::blit(gSurface *dst, const gSurface *src, const eRect &p, const eRect
 #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 < 256; ++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->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());
+                       p.x(), p.y(), p.width(), p.height(),
+                       pal_addr);
                return 0;
        }
 #endif
index bd820913482d492f0fafb627f3e503eda1face73..3beb6772019849e73692031f364fa954a170c26f 100644 (file)
@@ -60,10 +60,11 @@ static int exec_list(void)
 }
 
 void bcm_accel_blit(
-               int src_addr, int src_width, int src_height, int src_stride,
+               int src_addr, int src_width, int src_height, int src_stride, int src_format,
                int dst_addr, int dst_width, int dst_height, int dst_stride,
                int src_x, int src_y, int width, int height,
-               int dst_x, int dst_y, int dwidth, int dheight)
+               int dst_x, int dst_y, int dwidth, int dheight,
+               int pal_addr)
 {
        C(0x43); // reset source
        C(0x53); // reset dest
@@ -75,7 +76,18 @@ void bcm_accel_blit(
        P(0x1, src_stride);  // set source pitch
        P(0x2, src_width); // source width
        P(0x3, src_height); // height
-       P(0x4, 0x7e48888); // format: ARGB 8888
+       switch (src_format)
+       {
+       case 0:
+               P(0x4, 0x7e48888); // format: ARGB 8888
+               break;
+       case 1:
+               P(0x4, 0x12e40008); // indexed 8bit
+               P(0x78, 256);
+               P(0x79, pal_addr);
+               P(0x7a, 0x7e48888);
+               break;
+       }
 
        C(0x5); // set source surface (based on last parameters)
 
index 839814035c28e09e2db3c583da3e71eae752338d..34713ab40f2a5724907b1f8aa43e9d1055085166 100644 (file)
@@ -151,7 +151,7 @@ inline eRect::eRect( int left, int top, int width, int height )
 }
 
 inline bool eRect::empty() const
-{ return x1 == x2 || y1 == y2; }
+{ return x1 >= x2 || y1 >= y2; }
 
 inline bool eRect::valid() const
 { return x1 <= x2 && y1 <= y2; }
index 6f741d8563f2f606b1b74efe786423f8dd6c9748..3e64310865ff2683340ff0584607ef9caa8a0ddd 100644 (file)
@@ -98,8 +98,12 @@ gSurface::gSurface(eSize size, int _bpp, int accel)
                stride += 63;
                stride &=~63;
                
+               int pal_size = 0;
+               if (bpp == 8)
+                       pal_size = 256 * 4;
+               
                if (gAccel::getInstance())
-                       eDebug("accel memory: %d", gAccel::getInstance()->accelAlloc(data, data_phys, y * stride));
+                       eDebug("accel memory: %d", gAccel::getInstance()->accelAlloc(data, data_phys, y * stride + pal_size));
                else
                        eDebug("no accel available");
        }
@@ -143,7 +147,7 @@ void gPixmap::fill(const gRegion &region, const gColor &color)
        for (i=0; i<region.rects.size(); ++i)
        {
                const eRect &area = region.rects[i];
-               if ((area.height()<=0) || (area.width()<=0))
+               if (area.empty())
                        continue;
 
                if (surface->bpp == 8)
@@ -159,8 +163,8 @@ void gPixmap::fill(const gRegion &region, const gColor &color)
                        else
                                col=0x10101*color;
                        
-                       col^=0xFF000000;                        
-
+                       col^=0xFF000000;
+                       
                        if (surface->data_phys && gAccel::getInstance())
                                if (!gAccel::getInstance()->fill(surface,  area, col))
                                        continue;
@@ -183,7 +187,7 @@ void gPixmap::fill(const gRegion &region, const gRGB &color)
        for (i=0; i<region.rects.size(); ++i)
        {
                const eRect &area = region.rects[i];
-               if ((area.height()<=0) || (area.width()<=0))
+               if (area.empty())
                        continue;
 
                if (surface->bpp == 32)
@@ -292,7 +296,7 @@ void gPixmap::blit(const gPixmap &src, const eRect &_pos, const gRegion &clip, i
                area&=clip.rects[i];
                area&=eRect(ePoint(0, 0), size());
 
-               if ((area.width()<0) || (area.height()<0))
+               if (area.empty())
                        continue;
 
                eRect srcarea = area;