fix mem bug by changing c strings to cpp strings
[enigma2.git] / lib / gdi / glcddc.cpp
index 3895df9a0c3283b0d619267119c95327d6d83da9..8612c70bb452b8b69baab55651bd4e27b280eab0 100644 (file)
@@ -1,31 +1,32 @@
-#ifndef DISABLE_LCD
-
 #include <lib/gdi/glcddc.h>
 #include <lib/gdi/lcd.h>
+#include <lib/base/init.h>
+#include <lib/base/init_num.h>
 
 gLCDDC *gLCDDC::instance;
 
-gLCDDC::gLCDDC(eLCD *lcd): lcd(lcd)
+gLCDDC::gLCDDC()
 {
+       lcd = new eDBoxLCD();
        instance=this;
        
        update=1;
 
-       pixmap=new gPixmap();
-       pixmap->x=lcd->size().width();
-       pixmap->y=lcd->size().height();
-       pixmap->bpp=8;
-       pixmap->bypp=1;
-       pixmap->stride=lcd->stride();
-       pixmap->data=lcd->buffer();
-       
-       pixmap->clut.colors=256;
-       pixmap->clut.data=0;
+       surface.x=lcd->size().width();
+       surface.y=lcd->size().height();
+       surface.bpp=8;
+       surface.bypp=1;
+       surface.stride=lcd->stride();
+       surface.data=lcd->buffer();
+
+       surface.clut.colors=256;
+       surface.clut.data=0;
+       m_pixmap = new gPixmap(&surface);
 }
 
 gLCDDC::~gLCDDC()
 {
-       delete pixmap;
+       delete lcd;
        instance=0;
 }
 
@@ -34,23 +35,17 @@ void gLCDDC::exec(gOpcode *o)
        switch (o->opcode)
        {
        case gOpcode::flush:
-       case gOpcode::end:
-               if (update)
+//             if (update)
                        lcd->update();
        default:
-               gPixmapDC::exec(o);
+               gDC::exec(o);
                break;
        }
 }
 
-gLCDDC *gLCDDC::getInstance()
-{
-       return instance;
-}
-
 void gLCDDC::setUpdate(int u)
 {
        update=u;
 }
 
-#endif //DISABLE_LCD
+eAutoInitPtr<gLCDDC> init_gLCDDC(eAutoInitNumbers::graphic-1, "gLCDDC");