- new GUI lib
[enigma2.git] / lib / gdi / glcddc.cpp
1 #ifndef DISABLE_LCD
2
3 #include <lib/gdi/glcddc.h>
4
5 gLCDDC *gLCDDC::instance;
6
7 gLCDDC::gLCDDC(eLCD *lcd): lcd(lcd)
8 {
9         instance=this;
10         
11         update=1;
12
13         surface.x=lcd->size().width();
14         surface.y=lcd->size().height();
15         surface.bpp=8;
16         surface.bypp=1;
17         surface.stride=lcd->stride();
18         surface.data=lcd->buffer();
19
20         surface.clut.colors=256;
21         surface.clut.data=0;
22         m_pixmap = new gPixmap(&surface);
23 }
24
25 gLCDDC::~gLCDDC()
26 {
27         instance=0;
28 }
29
30 void gLCDDC::exec(gOpcode *o)
31 {
32         switch (o->opcode)
33         {
34 //      case gOpcode::flush:
35         case gOpcode::end:
36                 if (update)
37                         lcd->update();
38         default:
39                 gDC::exec(o);
40                 break;
41         }
42 }
43
44 gLCDDC *gLCDDC::getInstance()
45 {
46         return instance;
47 }
48
49 void gLCDDC::setUpdate(int u)
50 {
51         update=u;
52 }
53
54 #endif //DISABLE_LCD