summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--uisimulator/win32/lcd-win32.c121
-rw-r--r--uisimulator/win32/lcd-win32.h6
2 files changed, 13 insertions, 114 deletions
diff --git a/uisimulator/win32/lcd-win32.c b/uisimulator/win32/lcd-win32.c
index 49c490e1f4..f5672a58bf 100644
--- a/uisimulator/win32/lcd-win32.c
+++ b/uisimulator/win32/lcd-win32.c
@@ -23,69 +23,16 @@
23#include "lcd.h" 23#include "lcd.h"
24#include "lcd-playersim.h" 24#include "lcd-playersim.h"
25 25
26#if LCD_DEPTH >= 16 26#if LCD_DEPTH == 16
27unsigned long bitmap[LCD_HEIGHT][LCD_WIDTH]; /* the ui display */ 27unsigned short bitmap[LCD_HEIGHT][LCD_WIDTH]; /* the ui display */
28 28
29BITMAPINFO256 bmi = 29BITMAPINFO256 bmi =
30{ 30{
31 {sizeof (BITMAPINFOHEADER), 31 {sizeof (BITMAPINFOHEADER),
32 LCD_WIDTH, -LCD_HEIGHT, 1, 32, 32 LCD_WIDTH, -LCD_HEIGHT, 1, 16,
33 BI_RGB, 0, 0, 0, 216, 216, 33 BI_BITFIELDS, 0, 0, 0, 3, 3,
34 }, /* colour lookup table for 8bit displays (standard web palette) */ 34 }, /* bitfield masks (RGB565) */
35 {{0x00,0x00,0x00,0}, {0x33,0x00,0x00,0}, {0x66,0x00,0x00,0}, {0x99,0x00,0x00,0}, 35 {{0x00, 0xf8, 0, 0}, {0xe0, 0x07, 0, 0}, {0x1f, 0x00, 0, 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 */ 36}; /* bitmap information */
90#else 37#else
91unsigned char bitmap[LCD_HEIGHT][LCD_WIDTH]; /* the ui display */ 38unsigned char bitmap[LCD_HEIGHT][LCD_WIDTH]; /* the ui display */
@@ -121,35 +68,7 @@ BITMAPINFO256 remote_bmi =
121 68
122void lcd_update(void) 69void lcd_update(void)
123{ 70{
124 int x, y; 71 lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT);
125 RECT r;
126
127 if (hGUIWnd == NULL)
128 _endthread ();
129
130 for (x = 0; x < LCD_WIDTH; x++)
131 for (y = 0; y < LCD_HEIGHT; y++)
132 {
133#if LCD_DEPTH == 1
134 bitmap[y][x] = ((lcd_framebuffer[y/8][x] >> (y & 7)) & 1);
135#elif LCD_DEPTH == 2
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;
143#endif
144 }
145
146 /* Invalidate only the window part that actually did change */
147 GetClientRect (hGUIWnd, &r);
148 r.left = UI_LCD_POSX * r.right / UI_WIDTH;
149 r.top = UI_LCD_POSY * r.bottom / UI_HEIGHT;
150 r.right = (UI_LCD_POSX + UI_LCD_WIDTH) * r.right / UI_WIDTH;
151 r.bottom = (UI_LCD_POSY + UI_LCD_HEIGHT) * r.bottom / UI_HEIGHT;
152 InvalidateRect (hGUIWnd, &r, FALSE);
153} 72}
154 73
155void lcd_update_rect(int x_start, int y_start, 74void lcd_update_rect(int x_start, int y_start,
@@ -178,11 +97,7 @@ void lcd_update_rect(int x_start, int y_start,
178#elif LCD_DEPTH == 2 97#elif LCD_DEPTH == 2
179 bitmap[y][x] = ((lcd_framebuffer[y/4][x] >> (2 * (y & 3))) & 3); 98 bitmap[y][x] = ((lcd_framebuffer[y/4][x] >> (2 * (y & 3))) & 3);
180#elif LCD_DEPTH == 16 99#elif LCD_DEPTH == 16
181 fb_data pixel = lcd_framebuffer[y][x]; 100 bitmap[y][x] = 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;
186#endif 101#endif
187 } 102 }
188 103
@@ -203,25 +118,9 @@ void lcd_update_rect(int x_start, int y_start,
203 118
204extern unsigned char lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH]; 119extern unsigned char lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH];
205 120
206void lcd_remote_update(void) 121void lcd_remote_update (void)
207{ 122{
208 int x, y; 123 lcd_remote_update_rect(0, 0, LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT);
209 RECT r;
210
211 if (hGUIWnd == NULL)
212 _endthread ();
213
214 for (x = 0; x < LCD_REMOTE_WIDTH; x++)
215 for (y = 0; y < LCD_REMOTE_HEIGHT; y++)
216 remote_bitmap[y][x] = ((lcd_remote_framebuffer[y/8][x] >> (y & 7)) & 1);
217
218 /* Invalidate only the window part that actually did change */
219 GetClientRect (hGUIWnd, &r);
220 r.left = UI_REMOTE_POSX * r.right / UI_WIDTH;
221 r.top = UI_REMOTE_POSY * r.bottom / UI_HEIGHT;
222 r.right = (UI_REMOTE_POSX + UI_REMOTE_WIDTH) * r.right / UI_WIDTH;
223 r.bottom = (UI_REMOTE_POSY + UI_REMOTE_HEIGHT) * r.bottom / UI_HEIGHT;
224 InvalidateRect (hGUIWnd, &r, FALSE);
225} 124}
226 125
227void lcd_remote_update_rect(int x_start, int y_start, 126void lcd_remote_update_rect(int x_start, int y_start,
diff --git a/uisimulator/win32/lcd-win32.h b/uisimulator/win32/lcd-win32.h
index 5aa4982c2b..b3533ad0cb 100644
--- a/uisimulator/win32/lcd-win32.h
+++ b/uisimulator/win32/lcd-win32.h
@@ -30,10 +30,10 @@ typedef struct
30 RGBQUAD bmiColors[256]; 30 RGBQUAD bmiColors[256];
31} BITMAPINFO256; 31} BITMAPINFO256;
32 32
33#if LCD_DEPTH >= 16 33#if LCD_DEPTH <= 8
34extern unsigned long bitmap[LCD_HEIGHT][LCD_WIDTH]; // the ui display
35#else
36extern unsigned char bitmap[LCD_HEIGHT][LCD_WIDTH]; // the ui display 34extern unsigned char bitmap[LCD_HEIGHT][LCD_WIDTH]; // the ui display
35#elif LCD_DEPTH <= 16
36extern unsigned short bitmap[LCD_HEIGHT][LCD_WIDTH]; // the ui display
37#endif 37#endif
38extern BITMAPINFO256 bmi; // bitmap information 38extern BITMAPINFO256 bmi; // bitmap information
39 39