diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2006-05-11 00:13:26 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2006-05-11 00:13:26 +0000 |
| commit | b887d75af86b430552cc28ea5e37bf58bd557d4b (patch) | |
| tree | f9107dd0824ec984a88fd9332806ef15400aa203 /lib | |
| parent | b21236226ec3c6a49d3594ac0ccad20906228238 (diff) | |
| download | enigma2-b887d75af86b430552cc28ea5e37bf58bd557d4b.tar.gz enigma2-b887d75af86b430552cc28ea5e37bf58bd557d4b.zip | |
use rgb values whenever possible
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/gdi/gpixmap.cpp | 32 | ||||
| -rw-r--r-- | lib/gdi/gpixmap.h | 9 | ||||
| -rw-r--r-- | lib/gdi/grc.cpp | 30 | ||||
| -rw-r--r-- | lib/gdi/grc.h | 4 |
4 files changed, 66 insertions, 9 deletions
diff --git a/lib/gdi/gpixmap.cpp b/lib/gdi/gpixmap.cpp index 3ebd9a02..c3d2cc31 100644 --- a/lib/gdi/gpixmap.cpp +++ b/lib/gdi/gpixmap.cpp @@ -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; i<region.rects.size(); ++i) + { + const eRect &area = region.rects[i]; + if ((area.height()<=0) || (area.width()<=0)) + continue; + + if (surface->bpp == 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(); y<area.bottom(); y++) + { + __u32 *dst=(__u32*)(((__u8*)surface->data)+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; i<clip.rects.size(); ++i) diff --git a/lib/gdi/gpixmap.h b/lib/gdi/gpixmap.h index 732ebf9a..7158e269 100644 --- a/lib/gdi/gpixmap.h +++ b/lib/gdi/gpixmap.h @@ -35,6 +35,12 @@ struct gRGB gRGB(): b(0), g(0), r(0), a(0) { } + + unsigned long argb() const + { + return (a<<24)|(r<<16)|(g<<8)|b; + } + void operator=(unsigned long val) { b = val&0xFF; @@ -123,11 +129,12 @@ public: virtual ~gPixmap(); eSize size() const { return eSize(surface->x, surface->y); } - + inline bool needClut() const { return surface && surface->bpp <= 8; } private: #ifndef SWIG friend class gDC; void fill(const gRegion &clip, const gColor &color); + void fill(const gRegion &clip, const gRGB &color); void blit(const gPixmap &src, ePoint pos, const gRegion &clip, int flags=0); diff --git a/lib/gdi/grc.cpp b/lib/gdi/grc.cpp index 19a32b62..a9bac4af 100644 --- a/lib/gdi/grc.cpp +++ b/lib/gdi/grc.cpp @@ -506,18 +506,24 @@ void gDC::exec(gOpcode *o) { case gOpcode::setBackgroundColor: m_background_color = o->parm.setColor->color; + m_background_color_rgb = getRGB(m_background_color); delete o->parm.setColor; break; case gOpcode::setForegroundColor: m_foreground_color = o->parm.setColor->color; + m_background_color_rgb = getRGB(m_foreground_color); delete o->parm.setColor; break; case gOpcode::setBackgroundColorRGB: - m_background_color = m_pixmap->surface->clut.findColor(o->parm.setColorRGB->color); + if (m_pixmap->needClut()) + m_background_color = m_pixmap->surface->clut.findColor(o->parm.setColorRGB->color); + m_background_color_rgb = o->parm.setColorRGB->color; delete o->parm.setColorRGB; break; case gOpcode::setForegroundColorRGB: - m_foreground_color = m_pixmap->surface->clut.findColor(o->parm.setColorRGB->color); + if (m_pixmap->needClut()) + m_foreground_color = m_pixmap->surface->clut.findColor(o->parm.setColorRGB->color); + m_foreground_color_rgb = o->parm.setColorRGB->color; delete o->parm.setColorRGB; break; case gOpcode::setFont: @@ -549,13 +555,14 @@ void gDC::exec(gOpcode *o) int correction = vcentered_top - bbox.top(); offset += ePoint(0, correction); } - para->blit(*this, offset, getRGB(m_background_color), getRGB(m_foreground_color)); + + para->blit(*this, offset, m_background_color_rgb, m_foreground_color_rgb); delete o->parm.renderText; break; } case gOpcode::renderPara: { - o->parm.renderPara->textpara->blit(*this, o->parm.renderPara->offset + m_current_offset, getRGB(m_background_color), getRGB(m_foreground_color)); + o->parm.renderPara->textpara->blit(*this, o->parm.renderPara->offset + m_current_offset, m_background_color_rgb, m_foreground_color_rgb); o->parm.renderPara->textpara->Release(); delete o->parm.renderPara; break; @@ -565,7 +572,10 @@ void gDC::exec(gOpcode *o) eRect area = o->parm.fill->area; area.moveBy(m_current_offset); gRegion clip = m_current_clip & area; - m_pixmap->fill(clip, m_foreground_color); + if (m_pixmap->needClut()) + m_pixmap->fill(clip, m_foreground_color); + else + m_pixmap->fill(clip, m_foreground_color_rgb); delete o->parm.fill; break; } @@ -573,12 +583,18 @@ void gDC::exec(gOpcode *o) { o->parm.fillRegion->region.moveBy(m_current_offset); gRegion clip = m_current_clip & o->parm.fillRegion->region; - m_pixmap->fill(clip, m_foreground_color); + if (m_pixmap->needClut()) + m_pixmap->fill(clip, m_foreground_color); + else + m_pixmap->fill(clip, m_foreground_color_rgb); delete o->parm.fillRegion; break; } case gOpcode::clear: - m_pixmap->fill(m_current_clip, m_background_color); + if (m_pixmap->needClut()) + m_pixmap->fill(m_current_clip, m_background_color); + else + m_pixmap->fill(m_current_clip, m_background_color_rgb); delete o->parm.fill; break; case gOpcode::blit: diff --git a/lib/gdi/grc.h b/lib/gdi/grc.h index a5974972..58371e79 100644 --- a/lib/gdi/grc.h +++ b/lib/gdi/grc.h @@ -1,6 +1,7 @@ #ifndef __grc_h #define __grc_h +// #define SYNC_PAINT /* gPainter ist die high-level version. die highlevel daten werden zu low level opcodes ueber die gRC-queue geschickt und landen beim gDC der hardwarespezifisch ist, meist aber auf einen @@ -185,7 +186,7 @@ class gPainter public: gPainter(gDC *dc, eRect rect=eRect()); virtual ~gPainter(); - + void setBackgroundColor(const gColor &color); void setForegroundColor(const gColor &color); @@ -252,6 +253,7 @@ protected: ePtr<gPixmap> m_pixmap; gColor m_foreground_color, m_background_color; + gRGB m_foreground_color_rgb, m_background_color_rgb; ePtr<gFont> m_current_font; ePoint m_current_offset; |
