Add abstract class gMainDC as an interface for gFBDC and gSDLDC
[enigma2.git] / lib / gdi / glcddc.cpp
index 1a5e03fa0671d95e1fd0cf9b9327eadb70153bf2..bade53ba88c7533e74ca86237eec52978d5b9e65 100644 (file)
@@ -1,39 +1,41 @@
-#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;
 
        surface.x=lcd->size().width();
        surface.y=lcd->size().height();
-       surface.bpp=8;
-       surface.bypp=1;
        surface.stride=lcd->stride();
+       surface.bypp=surface.stride / surface.x;
+       surface.bpp=surface.bypp*8;
        surface.data=lcd->buffer();
-
-       surface.clut.colors=256;
+       surface.clut.colors=0;
        surface.clut.data=0;
+
        m_pixmap = new gPixmap(&surface);
 }
 
 gLCDDC::~gLCDDC()
 {
+       delete lcd;
        instance=0;
 }
 
-void gLCDDC::exec(gOpcode *o)
+void gLCDDC::exec(const gOpcode *o)
 {
        switch (o->opcode)
        {
-//     case gOpcode::flush:
-       case gOpcode::end:
-               if (update)
+       case gOpcode::flush:
+//             if (update)
                        lcd->update();
        default:
                gDC::exec(o);
@@ -41,14 +43,9 @@ void gLCDDC::exec(gOpcode *o)
        }
 }
 
-gLCDDC *gLCDDC::getInstance()
-{
-       return instance;
-}
-
 void gLCDDC::setUpdate(int u)
 {
        update=u;
 }
 
-#endif //DISABLE_LCD
+eAutoInitPtr<gLCDDC> init_gLCDDC(eAutoInitNumbers::graphic-1, "gLCDDC");