support indexed 8bit blits for broadcom-accel (requires recent drivers)
[enigma2.git] / lib / gdi / lcd.h
1 #ifndef __lcd_h
2 #define __lcd_h
3
4 #include <asm/types.h>
5 #include <lib/gdi/esize.h>
6 #include <lib/gdi/erect.h>
7
8 #define LCD_CONTRAST_MIN 0
9 #define LCD_CONTRAST_MAX 63
10 #define LCD_BRIGHTNESS_MIN 0
11 #define LCD_BRIGHTNESS_MAX 255
12
13 class eLCD
14 {
15 #ifdef SWIG
16         eLCD(eSize size);
17         ~eLCD();
18 #else
19 protected:
20         eSize res;
21         unsigned char *_buffer;
22         int lcdfd;
23         int _stride;
24         int locked;
25 #endif
26 public:
27         int lock();
28         void unlock();
29         int islocked() { return locked; }
30         bool detected() { return lcdfd >= 0; }
31 #ifndef SWIG
32         eLCD(eSize size);
33         virtual ~eLCD();
34         __u8 *buffer() { return (__u8*)_buffer; }
35         int stride() { return _stride; }
36         eSize size() { return res; }
37         
38         virtual void update()=0;
39 #endif
40 };
41
42 class eDBoxLCD: public eLCD
43 {
44         static eDBoxLCD *instance;
45         unsigned char inverted;
46         int is_oled;
47 #ifdef SWIG
48         eDBoxLCD();
49         ~eDBoxLCD();
50 #endif
51 public:
52 #ifndef SWIG
53         eDBoxLCD();
54         ~eDBoxLCD();
55 #endif
56         static eDBoxLCD *getInstance();
57         int setLCDContrast(int contrast);
58         int setLCDBrightness(int brightness);
59         void setInverted( unsigned char );
60         bool isOled() const { return !!is_oled; }
61         void update();
62 };
63
64 #endif