diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2007-12-13 00:16:09 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2007-12-13 00:16:09 +0000 |
| commit | 1c242c0a654a5c4048ba4219a0982f8ba8a85246 (patch) | |
| tree | 2a96e46084f96098f358193ce6f8033b3bac76b6 /lib | |
| parent | ff8117ea103cfa3a8f28f6b45d49adc65919a3a9 (diff) | |
| download | enigma2-1c242c0a654a5c4048ba4219a0982f8ba8a85246.tar.gz enigma2-1c242c0a654a5c4048ba4219a0982f8ba8a85246.zip | |
re-enable alphablend
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/gdi/gpixmap.cpp | 17 | ||||
| -rw-r--r-- | lib/gdi/grc.h | 3 | ||||
| -rw-r--r-- | lib/gui/epixmap.cpp | 19 | ||||
| -rw-r--r-- | lib/gui/epixmap.h | 4 |
4 files changed, 26 insertions, 17 deletions
diff --git a/lib/gdi/gpixmap.cpp b/lib/gdi/gpixmap.cpp index d0eff03f..855cb8b2 100644 --- a/lib/gdi/gpixmap.cpp +++ b/lib/gdi/gpixmap.cpp @@ -220,17 +220,16 @@ void gPixmap::blit(const gPixmap &src, ePoint pos, const gRegion &clip, int flag eRect srcarea=area; srcarea.moveBy(-pos.x(), -pos.y()); - + 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)) { __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; y<area.height(); y++) @@ -260,7 +259,7 @@ void gPixmap::blit(const gPixmap &src, ePoint pos, const gRegion &clip, int flag { __u32 *srcptr=(__u32*)src.surface->data; __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; y<area.height(); y++) @@ -283,7 +282,7 @@ void gPixmap::blit(const gPixmap &src, ePoint pos, const gRegion &clip, int flag } else if (flag & blitAlphaBlend) { // uh oh. this is only until hardware accel is working. - + int width=area.width(); // ARGB color space! unsigned char *src=(unsigned char*)srcptr; @@ -301,12 +300,12 @@ void gPixmap::blit(const gPixmap &src, ePoint pos, const gRegion &clip, int flag unsigned char dr = dst[2]; unsigned char dg = dst[1]; unsigned char db = dst[0]; - + dst[3] = BLEND(0xFF, da, sa); dst[2] = BLEND(sr, dr, sa); dst[1] = BLEND(sg, dg, sa); dst[0] = BLEND(sb, db, sa); - + src += 4; dst += 4; } } else @@ -328,7 +327,7 @@ void gPixmap::blit(const gPixmap &src, ePoint pos, const gRegion &clip, int flag pal[i]=0x010101*i; pal[i]^=0xFF000000; } - + srcptr+=srcarea.left()*src.surface->bypp+srcarea.top()*src.surface->stride; dstptr+=area.left()*surface->bypp+area.top()*surface->stride; for (int y=0; y<area.height(); y++) diff --git a/lib/gdi/grc.h b/lib/gdi/grc.h index 84f8ad6c..478ca46c 100644 --- a/lib/gdi/grc.h +++ b/lib/gdi/grc.h @@ -230,7 +230,8 @@ public: enum { - BT_ALPHATEST = 1 + BT_ALPHATEST = 1, + BT_ALPHABLEND = 2 }; void blit(gPixmap *pixmap, ePoint pos, const eRect &what=eRect(), int flags=0); diff --git a/lib/gui/epixmap.cpp b/lib/gui/epixmap.cpp index 69da944c..84fec323 100644 --- a/lib/gui/epixmap.cpp +++ b/lib/gui/epixmap.cpp @@ -7,7 +7,7 @@ ePixmap::ePixmap(eWidget *parent) { } -void ePixmap::setAlphatest(bool alphatest) +void ePixmap::setAlphatest(int alphatest) { m_alphatest = alphatest; setTransparent(alphatest); @@ -62,14 +62,23 @@ int ePixmap::event(int event, void *data, void *data2) getStyle(style); // we don't clear the background before because of performance reasons. -// when the pixmap is too small to fix the whole widget area, the widget is +// when the pixmap is too small to fit the whole widget area, the widget is // transparent anyway, so the background is already painted. // eWidget::event(event, data, data2); - + gPainter &painter = *(gPainter*)data2; if (m_pixmap) - painter.blit(m_pixmap, ePoint(0, 0), eRect(), m_alphatest?gPainter::BT_ALPHATEST:0); - + { + int flags = 0; + if (m_alphatest == 0) + flags = 0; + else if (m_alphatest == 1) + flags = gPainter::BT_ALPHATEST; + else if (m_alphatest == 2) + flags = gPainter::BT_ALPHABLEND; + painter.blit(m_pixmap, ePoint(0, 0), eRect(), flags); + } + return 0; } case evtChangedPixmap: diff --git a/lib/gui/epixmap.h b/lib/gui/epixmap.h index 1be68097..1c4a97c8 100644 --- a/lib/gui/epixmap.h +++ b/lib/gui/epixmap.h @@ -5,14 +5,14 @@ class ePixmap: public eWidget { - bool m_alphatest; + int m_alphatest; public: ePixmap(eWidget *parent); void setPixmap(gPixmap *pixmap); void setPixmap(ePtr<gPixmap> &pixmap); void setPixmapFromFile(const char *filename); - void setAlphatest(bool alphatest); + void setAlphatest(int alphatest); /* 1 for alphatest, 2 for alphablend */ protected: ePtr<gPixmap> m_pixmap; int event(int event, void *data=0, void *data2=0); |
