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