aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorghost <andreas.monzner@multimedia-labs.de>2009-06-23 01:05:14 +0200
committerghost <andreas.monzner@multimedia-labs.de>2009-06-23 01:05:14 +0200
commit5960b0d3e89264496a44e21f84da1e057905df53 (patch)
tree3ca2028f746ee5b1c093cccc9b834a1a3580fb0b /lib
parent72ea8cbfab4454adee8aebab4258d054f3e8f32c (diff)
parent88bae399660a892a61882f59251d9359750d3d3b (diff)
downloadenigma2-5960b0d3e89264496a44e21f84da1e057905df53.tar.gz
enigma2-5960b0d3e89264496a44e21f84da1e057905df53.zip
Merge branch 'master' of git.opendreambox.org:/git/enigma2
Diffstat (limited to 'lib')
-rw-r--r--lib/dvb/subtitle.cpp1
-rw-r--r--lib/gdi/accel.cpp29
-rw-r--r--lib/gdi/bcm.cpp18
-rw-r--r--lib/gdi/erect.h2
-rw-r--r--lib/gdi/gpixmap.cpp16
5 files changed, 52 insertions, 14 deletions
diff --git a/lib/dvb/subtitle.cpp b/lib/dvb/subtitle.cpp
index b6c5b718..87dadba5 100644
--- a/lib/dvb/subtitle.cpp
+++ b/lib/dvb/subtitle.cpp
@@ -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;
diff --git a/lib/gdi/accel.cpp b/lib/gdi/accel.cpp
index bf9a5a44..5e489eb3 100644
--- a/lib/gdi/accel.cpp
+++ b/lib/gdi/accel.cpp
@@ -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
diff --git a/lib/gdi/bcm.cpp b/lib/gdi/bcm.cpp
index bd820913..3beb6772 100644
--- a/lib/gdi/bcm.cpp
+++ b/lib/gdi/bcm.cpp
@@ -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)
diff --git a/lib/gdi/erect.h b/lib/gdi/erect.h
index 83981403..34713ab4 100644
--- a/lib/gdi/erect.h
+++ b/lib/gdi/erect.h
@@ -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; }
diff --git a/lib/gdi/gpixmap.cpp b/lib/gdi/gpixmap.cpp
index 6f741d85..3e643108 100644
--- a/lib/gdi/gpixmap.cpp
+++ b/lib/gdi/gpixmap.cpp
@@ -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;