diff options
author | Jens Arnold <amiconn@rockbox.org> | 2005-11-15 23:37:21 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2005-11-15 23:37:21 +0000 |
commit | 3be6cf15742083b9786fba52d40f61e5803db840 (patch) | |
tree | 0813b8c21260c62b916f1fe99f76e1bf30e1f21a /uisimulator/win32 | |
parent | 2691d760737c591cf368e9c4e90b1f96b973cfcc (diff) | |
download | rockbox-3be6cf15742083b9786fba52d40f61e5803db840.tar.gz rockbox-3be6cf15742083b9786fba52d40f61e5803db840.zip |
16bit colour support (H300) for the win32 simulator.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7898 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator/win32')
-rw-r--r-- | uisimulator/win32/UI-h300.bmp | bin | 0 -> 334712 bytes | |||
-rw-r--r-- | uisimulator/win32/lcd-win32.c | 96 | ||||
-rw-r--r-- | uisimulator/win32/lcd-win32.h | 8 | ||||
-rw-r--r-- | uisimulator/win32/uisw32.h | 16 |
4 files changed, 109 insertions, 11 deletions
diff --git a/uisimulator/win32/UI-h300.bmp b/uisimulator/win32/UI-h300.bmp new file mode 100644 index 0000000000..2af6070884 --- /dev/null +++ b/uisimulator/win32/UI-h300.bmp | |||
Binary files differ | |||
diff --git a/uisimulator/win32/lcd-win32.c b/uisimulator/win32/lcd-win32.c index 40f74ee2d6..49c490e1f4 100644 --- a/uisimulator/win32/lcd-win32.c +++ b/uisimulator/win32/lcd-win32.c | |||
@@ -23,8 +23,72 @@ | |||
23 | #include "lcd.h" | 23 | #include "lcd.h" |
24 | #include "lcd-playersim.h" | 24 | #include "lcd-playersim.h" |
25 | 25 | ||
26 | char bitmap[LCD_HEIGHT][LCD_WIDTH]; /* the ui display */ | 26 | #if LCD_DEPTH >= 16 |
27 | unsigned long bitmap[LCD_HEIGHT][LCD_WIDTH]; /* the ui display */ | ||
27 | 28 | ||
29 | BITMAPINFO256 bmi = | ||
30 | { | ||
31 | {sizeof (BITMAPINFOHEADER), | ||
32 | LCD_WIDTH, -LCD_HEIGHT, 1, 32, | ||
33 | BI_RGB, 0, 0, 0, 216, 216, | ||
34 | }, /* colour lookup table for 8bit displays (standard web palette) */ | ||
35 | {{0x00,0x00,0x00,0}, {0x33,0x00,0x00,0}, {0x66,0x00,0x00,0}, {0x99,0x00,0x00,0}, | ||
36 | {0xcc,0x00,0x00,0}, {0xff,0x00,0x00,0}, {0x00,0x33,0x00,0}, {0x33,0x33,0x00,0}, | ||
37 | {0x66,0x33,0x00,0}, {0x99,0x33,0x00,0}, {0xcc,0x33,0x00,0}, {0xff,0x33,0x00,0}, | ||
38 | {0x00,0x66,0x00,0}, {0x33,0x66,0x00,0}, {0x66,0x66,0x00,0}, {0x99,0x66,0x00,0}, | ||
39 | {0xcc,0x66,0x00,0}, {0xff,0x66,0x00,0}, {0x00,0x99,0x00,0}, {0x33,0x99,0x00,0}, | ||
40 | {0x66,0x99,0x00,0}, {0x99,0x99,0x00,0}, {0xcc,0x99,0x00,0}, {0xff,0x99,0x00,0}, | ||
41 | {0x00,0xcc,0x00,0}, {0x33,0xcc,0x00,0}, {0x66,0xcc,0x00,0}, {0x99,0xcc,0x00,0}, | ||
42 | {0xcc,0xcc,0x00,0}, {0xff,0xcc,0x00,0}, {0x00,0xff,0x00,0}, {0x33,0xff,0x00,0}, | ||
43 | {0x66,0xff,0x00,0}, {0x99,0xff,0x00,0}, {0xcc,0xff,0x00,0}, {0xff,0xff,0x00,0}, | ||
44 | {0x00,0x00,0x33,0}, {0x33,0x00,0x33,0}, {0x66,0x00,0x33,0}, {0x99,0x00,0x33,0}, | ||
45 | {0xcc,0x00,0x33,0}, {0xff,0x00,0x33,0}, {0x00,0x33,0x33,0}, {0x33,0x33,0x33,0}, | ||
46 | {0x66,0x33,0x33,0}, {0x99,0x33,0x33,0}, {0xcc,0x33,0x33,0}, {0xff,0x33,0x33,0}, | ||
47 | {0x00,0x66,0x33,0}, {0x33,0x66,0x33,0}, {0x66,0x66,0x33,0}, {0x99,0x66,0x33,0}, | ||
48 | {0xcc,0x66,0x33,0}, {0xff,0x66,0x33,0}, {0x00,0x99,0x33,0}, {0x33,0x99,0x33,0}, | ||
49 | {0x66,0x99,0x33,0}, {0x99,0x99,0x33,0}, {0xcc,0x99,0x33,0}, {0xff,0x99,0x33,0}, | ||
50 | {0x00,0xcc,0x33,0}, {0x33,0xcc,0x33,0}, {0x66,0xcc,0x33,0}, {0x99,0xcc,0x33,0}, | ||
51 | {0xcc,0xcc,0x33,0}, {0xff,0xcc,0x33,0}, {0x00,0xff,0x33,0}, {0x33,0xff,0x33,0}, | ||
52 | {0x66,0xff,0x33,0}, {0x99,0xff,0x33,0}, {0xcc,0xff,0x33,0}, {0xff,0xff,0x33,0}, | ||
53 | {0x00,0x00,0x66,0}, {0x33,0x00,0x66,0}, {0x66,0x00,0x66,0}, {0x99,0x00,0x66,0}, | ||
54 | {0xcc,0x00,0x66,0}, {0xff,0x00,0x66,0}, {0x00,0x33,0x66,0}, {0x33,0x33,0x66,0}, | ||
55 | {0x66,0x33,0x66,0}, {0x99,0x33,0x66,0}, {0xcc,0x33,0x66,0}, {0xff,0x33,0x66,0}, | ||
56 | {0x00,0x66,0x66,0}, {0x33,0x66,0x66,0}, {0x66,0x66,0x66,0}, {0x99,0x66,0x66,0}, | ||
57 | {0xcc,0x66,0x66,0}, {0xff,0x66,0x66,0}, {0x00,0x99,0x66,0}, {0x33,0x99,0x66,0}, | ||
58 | {0x66,0x99,0x66,0}, {0x99,0x99,0x66,0}, {0xcc,0x99,0x66,0}, {0xff,0x99,0x66,0}, | ||
59 | {0x00,0xcc,0x66,0}, {0x33,0xcc,0x66,0}, {0x66,0xcc,0x66,0}, {0x99,0xcc,0x66,0}, | ||
60 | {0xcc,0xcc,0x66,0}, {0xff,0xcc,0x66,0}, {0x00,0xff,0x66,0}, {0x33,0xff,0x66,0}, | ||
61 | {0x66,0xff,0x66,0}, {0x99,0xff,0x66,0}, {0xcc,0xff,0x66,0}, {0xff,0xff,0x66,0}, | ||
62 | {0x00,0x00,0x99,0}, {0x33,0x00,0x99,0}, {0x66,0x00,0x99,0}, {0x99,0x00,0x99,0}, | ||
63 | {0xcc,0x00,0x99,0}, {0xff,0x00,0x99,0}, {0x00,0x33,0x99,0}, {0x33,0x33,0x99,0}, | ||
64 | {0x66,0x33,0x99,0}, {0x99,0x33,0x99,0}, {0xcc,0x33,0x99,0}, {0xff,0x33,0x99,0}, | ||
65 | {0x00,0x66,0x99,0}, {0x33,0x66,0x99,0}, {0x66,0x66,0x99,0}, {0x99,0x66,0x99,0}, | ||
66 | {0xcc,0x66,0x99,0}, {0xff,0x66,0x99,0}, {0x00,0x99,0x99,0}, {0x33,0x99,0x99,0}, | ||
67 | {0x66,0x99,0x99,0}, {0x99,0x99,0x99,0}, {0xcc,0x99,0x99,0}, {0xff,0x99,0x99,0}, | ||
68 | {0x00,0xcc,0x99,0}, {0x33,0xcc,0x99,0}, {0x66,0xcc,0x99,0}, {0x99,0xcc,0x99,0}, | ||
69 | {0xcc,0xcc,0x99,0}, {0xff,0xcc,0x99,0}, {0x00,0xff,0x99,0}, {0x33,0xff,0x99,0}, | ||
70 | {0x66,0xff,0x99,0}, {0x99,0xff,0x99,0}, {0xcc,0xff,0x99,0}, {0xff,0xff,0x99,0}, | ||
71 | {0x00,0x00,0xcc,0}, {0x33,0x00,0xcc,0}, {0x66,0x00,0xcc,0}, {0x99,0x00,0xcc,0}, | ||
72 | {0xcc,0x00,0xcc,0}, {0xff,0x00,0xcc,0}, {0x00,0x33,0xcc,0}, {0x33,0x33,0xcc,0}, | ||
73 | {0x66,0x33,0xcc,0}, {0x99,0x33,0xcc,0}, {0xcc,0x33,0xcc,0}, {0xff,0x33,0xcc,0}, | ||
74 | {0x00,0x66,0xcc,0}, {0x33,0x66,0xcc,0}, {0x66,0x66,0xcc,0}, {0x99,0x66,0xcc,0}, | ||
75 | {0xcc,0x66,0xcc,0}, {0xff,0x66,0xcc,0}, {0x00,0x99,0xcc,0}, {0x33,0x99,0xcc,0}, | ||
76 | {0x66,0x99,0xcc,0}, {0x99,0x99,0xcc,0}, {0xcc,0x99,0xcc,0}, {0xff,0x99,0xcc,0}, | ||
77 | {0x00,0xcc,0xcc,0}, {0x33,0xcc,0xcc,0}, {0x66,0xcc,0xcc,0}, {0x99,0xcc,0xcc,0}, | ||
78 | {0xcc,0xcc,0xcc,0}, {0xff,0xcc,0xcc,0}, {0x00,0xff,0xcc,0}, {0x33,0xff,0xcc,0}, | ||
79 | {0x66,0xff,0xcc,0}, {0x99,0xff,0xcc,0}, {0xcc,0xff,0xcc,0}, {0xff,0xff,0xcc,0}, | ||
80 | {0x00,0x00,0xff,0}, {0x33,0x00,0xff,0}, {0x66,0x00,0xff,0}, {0x99,0x00,0xff,0}, | ||
81 | {0xcc,0x00,0xff,0}, {0xff,0x00,0xff,0}, {0x00,0x33,0xff,0}, {0x33,0x33,0xff,0}, | ||
82 | {0x66,0x33,0xff,0}, {0x99,0x33,0xff,0}, {0xcc,0x33,0xff,0}, {0xff,0x33,0xff,0}, | ||
83 | {0x00,0x66,0xff,0}, {0x33,0x66,0xff,0}, {0x66,0x66,0xff,0}, {0x99,0x66,0xff,0}, | ||
84 | {0xcc,0x66,0xff,0}, {0xff,0x66,0xff,0}, {0x00,0x99,0xff,0}, {0x33,0x99,0xff,0}, | ||
85 | {0x66,0x99,0xff,0}, {0x99,0x99,0xff,0}, {0xcc,0x99,0xff,0}, {0xff,0x99,0xff,0}, | ||
86 | {0x00,0xcc,0xff,0}, {0x33,0xcc,0xff,0}, {0x66,0xcc,0xff,0}, {0x99,0xcc,0xff,0}, | ||
87 | {0xcc,0xcc,0xff,0}, {0xff,0xcc,0xff,0}, {0x00,0xff,0xff,0}, {0x33,0xff,0xff,0}, | ||
88 | {0x66,0xff,0xff,0}, {0x99,0xff,0xff,0}, {0xcc,0xff,0xff,0}, {0xff,0xff,0xff,0}} | ||
89 | }; /* bitmap information */ | ||
90 | #else | ||
91 | unsigned char bitmap[LCD_HEIGHT][LCD_WIDTH]; /* the ui display */ | ||
28 | RGBQUAD color_zero = {UI_LCD_BGCOLORLIGHT, 0}; | 92 | RGBQUAD color_zero = {UI_LCD_BGCOLORLIGHT, 0}; |
29 | RGBQUAD color_max = {0, 0, 0, 0}; | 93 | RGBQUAD color_max = {0, 0, 0, 0}; |
30 | 94 | ||
@@ -36,12 +100,12 @@ BITMAPINFO256 bmi = | |||
36 | }, | 100 | }, |
37 | {} /* colour lookup table gets filled later */ | 101 | {} /* colour lookup table gets filled later */ |
38 | }; /* bitmap information */ | 102 | }; /* bitmap information */ |
103 | #endif | ||
39 | 104 | ||
40 | #ifdef HAVE_LCD_BITMAP | 105 | #ifdef HAVE_LCD_BITMAP |
41 | 106 | ||
42 | #ifdef HAVE_REMOTE_LCD | 107 | #ifdef HAVE_REMOTE_LCD |
43 | char remote_bitmap[LCD_REMOTE_HEIGHT][LCD_REMOTE_WIDTH]; | 108 | unsigned char remote_bitmap[LCD_REMOTE_HEIGHT][LCD_REMOTE_WIDTH]; |
44 | |||
45 | RGBQUAD remote_color_zero = {UI_REMOTE_BGCOLORLIGHT, 0}; | 109 | RGBQUAD remote_color_zero = {UI_REMOTE_BGCOLORLIGHT, 0}; |
46 | RGBQUAD remote_color_max = {0, 0, 0, 0}; | 110 | RGBQUAD remote_color_max = {0, 0, 0, 0}; |
47 | 111 | ||
@@ -55,12 +119,6 @@ BITMAPINFO256 remote_bmi = | |||
55 | }; | 119 | }; |
56 | #endif | 120 | #endif |
57 | 121 | ||
58 | #if LCD_DEPTH == 1 | ||
59 | extern unsigned char lcd_framebuffer[LCD_HEIGHT/8][LCD_WIDTH]; /* the display */ | ||
60 | #elif LCD_DEPTH == 2 | ||
61 | extern unsigned char lcd_framebuffer[LCD_HEIGHT/4][LCD_WIDTH]; /* the display */ | ||
62 | #endif | ||
63 | |||
64 | void lcd_update(void) | 122 | void lcd_update(void) |
65 | { | 123 | { |
66 | int x, y; | 124 | int x, y; |
@@ -71,11 +129,19 @@ void lcd_update(void) | |||
71 | 129 | ||
72 | for (x = 0; x < LCD_WIDTH; x++) | 130 | for (x = 0; x < LCD_WIDTH; x++) |
73 | for (y = 0; y < LCD_HEIGHT; y++) | 131 | for (y = 0; y < LCD_HEIGHT; y++) |
132 | { | ||
74 | #if LCD_DEPTH == 1 | 133 | #if LCD_DEPTH == 1 |
75 | bitmap[y][x] = ((lcd_framebuffer[y/8][x] >> (y & 7)) & 1); | 134 | bitmap[y][x] = ((lcd_framebuffer[y/8][x] >> (y & 7)) & 1); |
76 | #elif LCD_DEPTH == 2 | 135 | #elif LCD_DEPTH == 2 |
77 | bitmap[y][x] = ((lcd_framebuffer[y/4][x] >> (2 * (y & 3))) & 3); | 136 | bitmap[y][x] = ((lcd_framebuffer[y/4][x] >> (2 * (y & 3))) & 3); |
137 | #elif LCD_DEPTH == 16 | ||
138 | fb_data pixel = lcd_framebuffer[y][x]; | ||
139 | unsigned red = ((pixel >> 8) & 0xf8) | (pixel >> 13); | ||
140 | unsigned green = ((pixel >> 3) & 0xfc) | ((pixel >> 9) & 0x03); | ||
141 | unsigned blue = ((pixel << 3) & 0xf8) | ((pixel >> 2) & 0x07); | ||
142 | bitmap[y][x] = (red << 16) | (green << 8) | blue; | ||
78 | #endif | 143 | #endif |
144 | } | ||
79 | 145 | ||
80 | /* Invalidate only the window part that actually did change */ | 146 | /* Invalidate only the window part that actually did change */ |
81 | GetClientRect (hGUIWnd, &r); | 147 | GetClientRect (hGUIWnd, &r); |
@@ -106,11 +172,19 @@ void lcd_update_rect(int x_start, int y_start, | |||
106 | 172 | ||
107 | for (x = x_start; x < xmax; x++) | 173 | for (x = x_start; x < xmax; x++) |
108 | for (y = y_start; y < ymax; y++) | 174 | for (y = y_start; y < ymax; y++) |
175 | { | ||
109 | #if LCD_DEPTH == 1 | 176 | #if LCD_DEPTH == 1 |
110 | bitmap[y][x] = ((lcd_framebuffer[y/8][x] >> (y & 7)) & 1); | 177 | bitmap[y][x] = ((lcd_framebuffer[y/8][x] >> (y & 7)) & 1); |
111 | #elif LCD_DEPTH == 2 | 178 | #elif LCD_DEPTH == 2 |
112 | bitmap[y][x] = ((lcd_framebuffer[y/4][x] >> (2 * (y & 3))) & 3); | 179 | bitmap[y][x] = ((lcd_framebuffer[y/4][x] >> (2 * (y & 3))) & 3); |
180 | #elif LCD_DEPTH == 16 | ||
181 | fb_data pixel = lcd_framebuffer[y][x]; | ||
182 | unsigned red = ((pixel >> 8) & 0xf8) | (pixel >> 13); | ||
183 | unsigned green = ((pixel >> 3) & 0xfc) | ((pixel >> 9) & 0x03); | ||
184 | unsigned blue = ((pixel << 3) & 0xf8) | ((pixel >> 2) & 0x07); | ||
185 | bitmap[y][x] = (red << 16) | (green << 8) | blue; | ||
113 | #endif | 186 | #endif |
187 | } | ||
114 | 188 | ||
115 | /* Invalidate only the window part that actually did change */ | 189 | /* Invalidate only the window part that actually did change */ |
116 | GetClientRect (hGUIWnd, &r); | 190 | GetClientRect (hGUIWnd, &r); |
@@ -272,6 +346,7 @@ void lcd_backlight (bool on) | |||
272 | } | 346 | } |
273 | #endif | 347 | #endif |
274 | 348 | ||
349 | #if LCD_DEPTH <= 8 | ||
275 | /* set a range of bitmap indices to a gradient from startcolour to endcolour */ | 350 | /* set a range of bitmap indices to a gradient from startcolour to endcolour */ |
276 | void lcdcolors(int index, int count, RGBQUAD *start, RGBQUAD *end) | 351 | void lcdcolors(int index, int count, RGBQUAD *start, RGBQUAD *end) |
277 | { | 352 | { |
@@ -291,6 +366,7 @@ void lcdcolors(int index, int count, RGBQUAD *start, RGBQUAD *end) | |||
291 | + (end->rgbBlue - start->rgbBlue) * i / count; | 366 | + (end->rgbBlue - start->rgbBlue) * i / count; |
292 | } | 367 | } |
293 | } | 368 | } |
369 | #endif | ||
294 | 370 | ||
295 | #ifdef HAVE_REMOTE_LCD | 371 | #ifdef HAVE_REMOTE_LCD |
296 | /* set a range of bitmap indices to a gradient from startcolour to endcolour */ | 372 | /* set a range of bitmap indices to a gradient from startcolour to endcolour */ |
@@ -317,7 +393,9 @@ void lcdremotecolors(int index, int count, RGBQUAD *start, RGBQUAD *end) | |||
317 | /* initialise simulator lcd driver */ | 393 | /* initialise simulator lcd driver */ |
318 | void simlcdinit(void) | 394 | void simlcdinit(void) |
319 | { | 395 | { |
396 | #if LCD_DEPTH <= 8 | ||
320 | lcdcolors(0, (1<<LCD_DEPTH), &color_zero, &color_max); | 397 | lcdcolors(0, (1<<LCD_DEPTH), &color_zero, &color_max); |
398 | #endif | ||
321 | #ifdef HAVE_REMOTE_LCD | 399 | #ifdef HAVE_REMOTE_LCD |
322 | lcdremotecolors(0, (1<<LCD_REMOTE_DEPTH), &remote_color_zero, &remote_color_max); | 400 | lcdremotecolors(0, (1<<LCD_REMOTE_DEPTH), &remote_color_zero, &remote_color_max); |
323 | #endif | 401 | #endif |
diff --git a/uisimulator/win32/lcd-win32.h b/uisimulator/win32/lcd-win32.h index ca9c9da3ee..5aa4982c2b 100644 --- a/uisimulator/win32/lcd-win32.h +++ b/uisimulator/win32/lcd-win32.h | |||
@@ -30,11 +30,15 @@ typedef struct | |||
30 | RGBQUAD bmiColors[256]; | 30 | RGBQUAD bmiColors[256]; |
31 | } BITMAPINFO256; | 31 | } BITMAPINFO256; |
32 | 32 | ||
33 | extern char bitmap[LCD_HEIGHT][LCD_WIDTH]; // the ui display | 33 | #if LCD_DEPTH >= 16 |
34 | extern unsigned long bitmap[LCD_HEIGHT][LCD_WIDTH]; // the ui display | ||
35 | #else | ||
36 | extern unsigned char bitmap[LCD_HEIGHT][LCD_WIDTH]; // the ui display | ||
37 | #endif | ||
34 | extern BITMAPINFO256 bmi; // bitmap information | 38 | extern BITMAPINFO256 bmi; // bitmap information |
35 | 39 | ||
36 | #ifdef HAVE_REMOTE_LCD | 40 | #ifdef HAVE_REMOTE_LCD |
37 | extern char remote_bitmap[LCD_REMOTE_HEIGHT][LCD_REMOTE_WIDTH]; | 41 | extern unsigned char remote_bitmap[LCD_REMOTE_HEIGHT][LCD_REMOTE_WIDTH]; |
38 | extern BITMAPINFO256 remote_bmi; // bitmap information | 42 | extern BITMAPINFO256 remote_bmi; // bitmap information |
39 | #endif | 43 | #endif |
40 | 44 | ||
diff --git a/uisimulator/win32/uisw32.h b/uisimulator/win32/uisw32.h index c4ce761c80..7cbaa6ce47 100644 --- a/uisimulator/win32/uisw32.h +++ b/uisimulator/win32/uisw32.h | |||
@@ -93,6 +93,22 @@ typedef unsigned short wchar_t; | |||
93 | #define UI_REMOTE_WIDTH 128 | 93 | #define UI_REMOTE_WIDTH 128 |
94 | #define UI_REMOTE_HEIGHT 64 | 94 | #define UI_REMOTE_HEIGHT 64 |
95 | 95 | ||
96 | #elif defined(IRIVER_H300_SERIES) | ||
97 | #define UI_TITLE "iriver H300" | ||
98 | #define UI_WIDTH 288 // width of GUI window | ||
99 | #define UI_HEIGHT 581 // height of GUI window | ||
100 | /* high-colour */ | ||
101 | #define UI_LCD_POSX 26 // x position of lcd | ||
102 | #define UI_LCD_POSY 36 // y position of lcd | ||
103 | #define UI_LCD_WIDTH 220 | ||
104 | #define UI_LCD_HEIGHT 176 | ||
105 | #define UI_REMOTE_BGCOLOR 90, 145, 90 // bkgnd of remote lcd (no bklight) | ||
106 | #define UI_REMOTE_BGCOLORLIGHT 250, 180, 130 // bkgnd of remote lcd (bklight) | ||
107 | #define UI_REMOTE_POSX 12 // x position of remote lcd | ||
108 | #define UI_REMOTE_POSY 478 // y position of remote lcd | ||
109 | #define UI_REMOTE_WIDTH 128 | ||
110 | #define UI_REMOTE_HEIGHT 64 | ||
111 | |||
96 | #elif defined(ARCHOS_GMINI120) | 112 | #elif defined(ARCHOS_GMINI120) |
97 | #define UI_TITLE "Gmini 120" | 113 | #define UI_TITLE "Gmini 120" |
98 | #define UI_WIDTH 370 // width of GUI window | 114 | #define UI_WIDTH 370 // width of GUI window |