Add abstract class gMainDC as an interface for gFBDC and gSDLDC
[enigma2.git] / lib / gdi / glcddc.cpp
1 #include <lib/gdi/glcddc.h>
2 #include <lib/gdi/lcd.h>
3 #include <lib/base/init.h>
4 #include <lib/base/init_num.h>
5
6 gLCDDC *gLCDDC::instance;
7
8 gLCDDC::gLCDDC()
9 {
10         lcd = new eDBoxLCD();
11         instance=this;
12         
13         update=1;
14
15         surface.x=lcd->size().width();
16         surface.y=lcd->size().height();
17         surface.stride=lcd->stride();
18         surface.bypp=surface.stride / surface.x;
19         surface.bpp=surface.bypp*8;
20         surface.data=lcd->buffer();
21         surface.clut.colors=0;
22         surface.clut.data=0;
23
24         m_pixmap = new gPixmap(&surface);
25 }
26
27 gLCDDC::~gLCDDC()
28 {
29         delete lcd;
30         instance=0;
31 }
32
33 void gLCDDC::exec(const gOpcode *o)
34 {
35         switch (o->opcode)
36         {
37         case gOpcode::flush:
38 //              if (update)
39                         lcd->update();
40         default:
41                 gDC::exec(o);
42                 break;
43         }
44 }
45
46 void gLCDDC::setUpdate(int u)
47 {
48         update=u;
49 }
50
51 eAutoInitPtr<gLCDDC> init_gLCDDC(eAutoInitNumbers::graphic-1, "gLCDDC");