From: Felix Domke Date: Thu, 31 Mar 2005 19:55:46 +0000 (+0000) Subject: - fixed blit in gRC X-Git-Tag: 2.6.0~5914 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/77c45c9d2cabd3c1dc028c41d26573ac62147a34?ds=sidebyside - fixed blit in gRC - enable use of loadPNG trough python (something is still broken, sorry) - add ePixmap - dummy widgets now possible as pixmaps --- diff --git a/lib/gdi/epng.h b/lib/gdi/epng.h index 244019f3..09f30233 100644 --- a/lib/gdi/epng.h +++ b/lib/gdi/epng.h @@ -1,7 +1,7 @@ #ifndef __png_h #define __png_h -#include "grc.h" +#include int loadPNG(ePtr &pixmap, const char *filename); int savePNG(const char *filename, gPixmap *pixmap); diff --git a/lib/gdi/gpixmap.cpp b/lib/gdi/gpixmap.cpp index c2c75e7a..fe0c0a1f 100644 --- a/lib/gdi/gpixmap.cpp +++ b/lib/gdi/gpixmap.cpp @@ -147,7 +147,7 @@ void gPixmap::blit(const gPixmap &src, ePoint pos, const gRegion &clip, int flag eRect srcarea=area; srcarea.moveBy(-pos.x(), -pos.y()); - + if ((surface->bpp == 8) && (src.surface->bpp==8)) { __u8 *srcptr=(__u8*)src.surface->data; diff --git a/lib/gdi/gpixmap.h b/lib/gdi/gpixmap.h index e549787c..f29a0fe7 100644 --- a/lib/gdi/gpixmap.h +++ b/lib/gdi/gpixmap.h @@ -128,4 +128,6 @@ public: virtual ~gPixmap(); }; +TEMPLATE_TYPEDEF(ePtr, gPixmapPtr); + #endif diff --git a/lib/gdi/grc.cpp b/lib/gdi/grc.cpp index e7748967..3b5476a2 100644 --- a/lib/gdi/grc.cpp +++ b/lib/gdi/grc.cpp @@ -188,7 +188,7 @@ void gPainter::clear() void gPainter::blit(gPixmap *pixmap, ePoint pos, const eRect &clip, int flags) { gOpcode o; - + o.opcode=gOpcode::blit; o.dc = m_dc.grabRef(); pixmap->AddRef(); @@ -398,11 +398,16 @@ void gDC::exec(gOpcode *o) case gOpcode::blit: { gRegion clip; - if (!o->parm.blit->clip.valid()) + // this code should be checked again but i'm too tired now + + o->parm.blit->position += m_current_offset; + + if (o->parm.blit->clip.valid()) { clip.intersect(gRegion(o->parm.blit->clip), clip); } else clip = m_current_clip; + m_pixmap->blit(*o->parm.blit->pixmap, o->parm.blit->position, clip, o->parm.blit->flags); o->parm.blit->pixmap->Release(); delete o->parm.blit; diff --git a/lib/gui/Makefile.am b/lib/gui/Makefile.am index 375a9469..076ee36a 100644 --- a/lib/gui/Makefile.am +++ b/lib/gui/Makefile.am @@ -6,6 +6,7 @@ noinst_LIBRARIES = libenigma_gui.a libenigma_gui_a_SOURCES = \ ebutton.cpp elabel.cpp eslider.cpp ewidget.cpp ewidgetdesktop.cpp \ - ewindow.cpp ewindowstyle.cpp elistbox.cpp elistboxcontent.cpp + ewindow.cpp ewindowstyle.cpp elistbox.cpp elistboxcontent.cpp \ + epixmap.cpp diff --git a/lib/gui/epixmap.cpp b/lib/gui/epixmap.cpp new file mode 100644 index 00000000..a0655aa9 --- /dev/null +++ b/lib/gui/epixmap.cpp @@ -0,0 +1,37 @@ +#include + +ePixmap::ePixmap(eWidget *parent): eWidget(parent) +{ +} + +void ePixmap::setPixmap(gPixmap *pixmap) +{ + m_pixmap = pixmap; + event(evtChangedPixmap); +} + +int ePixmap::event(int event, void *data, void *data2) +{ + switch (event) + { + case evtPaint: + { + ePtr style; + + getStyle(style); + + eWidget::event(event, data, data2); + + gPainter &painter = *(gPainter*)data2; + if (m_pixmap) + painter.blit(m_pixmap, ePoint(0, 0)); + + return 0; + } + case evtChangedPixmap: + invalidate(); + return 0; + default: + return eWidget::event(event, data, data2); + } +} diff --git a/lib/gui/epixmap.h b/lib/gui/epixmap.h new file mode 100644 index 00000000..8a12e2e9 --- /dev/null +++ b/lib/gui/epixmap.h @@ -0,0 +1,22 @@ +#ifndef __lib_gui_epximap_h +#define __lib_gui_epixmap_h + +#include + +class ePixmap: public eWidget +{ +public: + ePixmap(eWidget *parent); + + void setPixmap(gPixmap *pixmap); +protected: + ePtr m_pixmap; + int event(int event, void *data=0, void *data2=0); +private: + enum eLabelEvent + { + evtChangedPixmap = evtUserWidget, + }; +}; + +#endif diff --git a/lib/python/enigma_python.i b/lib/python/enigma_python.i index 59133cc5..7369b646 100644 --- a/lib/python/enigma_python.i +++ b/lib/python/enigma_python.i @@ -44,8 +44,11 @@ is usually caused by not marking PSignals as immutable. #include #include +#include + #include #include +#include #include #include #include @@ -59,6 +62,7 @@ is usually caused by not marking PSignals as immutable. #include #include #include +#include extern void runMainloop(); extern void quitMainloop(); @@ -90,12 +94,16 @@ extern PSignal1 &keyPressedSignal(); %immutable eComponentScan::statusChanged; %immutable pNavigation::m_event; + +%include + %include %include %include %include %include %include +%include %include %include %include @@ -108,6 +116,7 @@ extern PSignal1 &keyPressedSignal(); %include %include %include +%include /************** eptr **************/ diff --git a/skin.py b/skin.py index 0367b60f..51433bd7 100644 --- a/skin.py +++ b/skin.py @@ -31,6 +31,7 @@ dom = xml.dom.minidom.parseString( + @@ -88,6 +89,11 @@ def applyAttributes(guiObject, node): guiObject.setText(value) elif attrib == 'font': guiObject.setFont(parseFont(value)) + elif attrib == "pixmap": + ptr = gPixmapPtr() + if loadPNG(ptr, value): + raise "loading PNG failed!" + guiObject.setPixmap(ptr.__deref__()) elif attrib == "valign": try: guiObject.setVAlign( @@ -147,8 +153,10 @@ def applyGUIskin(screen, skin, name): for widget in elementsWithTag(myscreen.childNodes, lambda x: x != "widget"): if widget.tagName == "eLabel": guiObject = eLabel(screen.instance) + elif widget.tagName == "ePixmap": + guiObject = ePixmap(screen.instance) else: - raise "unsupported stuff : %s" % widget.tagName + raise str("unsupported stuff : %s" % widget.tagName) applyAttributes(guiObject, widget) guiObject.thisown = 0