summaryrefslogtreecommitdiffstats
path: root/uisimulator/win32/lcd-win32.c
diff options
context:
space:
mode:
Diffstat (limited to 'uisimulator/win32/lcd-win32.c')
-rw-r--r--uisimulator/win32/lcd-win32.c96
1 files changed, 87 insertions, 9 deletions
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 @@
#include "lcd.h"
#include "lcd-playersim.h"
-char bitmap[LCD_HEIGHT][LCD_WIDTH]; /* the ui display */
+#if LCD_DEPTH >= 16
+unsigned long bitmap[LCD_HEIGHT][LCD_WIDTH]; /* the ui display */
+BITMAPINFO256 bmi =
+{
+ {sizeof (BITMAPINFOHEADER),
+ LCD_WIDTH, -LCD_HEIGHT, 1, 32,
+ BI_RGB, 0, 0, 0, 216, 216,
+ }, /* colour lookup table for 8bit displays (standard web palette) */
+ {{0x00,0x00,0x00,0}, {0x33,0x00,0x00,0}, {0x66,0x00,0x00,0}, {0x99,0x00,0x00,0},
+ {0xcc,0x00,0x00,0}, {0xff,0x00,0x00,0}, {0x00,0x33,0x00,0}, {0x33,0x33,0x00,0},
+ {0x66,0x33,0x00,0}, {0x99,0x33,0x00,0}, {0xcc,0x33,0x00,0}, {0xff,0x33,0x00,0},
+ {0x00,0x66,0x00,0}, {0x33,0x66,0x00,0}, {0x66,0x66,0x00,0}, {0x99,0x66,0x00,0},
+ {0xcc,0x66,0x00,0}, {0xff,0x66,0x00,0}, {0x00,0x99,0x00,0}, {0x33,0x99,0x00,0},
+ {0x66,0x99,0x00,0}, {0x99,0x99,0x00,0}, {0xcc,0x99,0x00,0}, {0xff,0x99,0x00,0},
+ {0x00,0xcc,0x00,0}, {0x33,0xcc,0x00,0}, {0x66,0xcc,0x00,0}, {0x99,0xcc,0x00,0},
+ {0xcc,0xcc,0x00,0}, {0xff,0xcc,0x00,0}, {0x00,0xff,0x00,0}, {0x33,0xff,0x00,0},
+ {0x66,0xff,0x00,0}, {0x99,0xff,0x00,0}, {0xcc,0xff,0x00,0}, {0xff,0xff,0x00,0},
+ {0x00,0x00,0x33,0}, {0x33,0x00,0x33,0}, {0x66,0x00,0x33,0}, {0x99,0x00,0x33,0},
+ {0xcc,0x00,0x33,0}, {0xff,0x00,0x33,0}, {0x00,0x33,0x33,0}, {0x33,0x33,0x33,0},
+ {0x66,0x33,0x33,0}, {0x99,0x33,0x33,0}, {0xcc,0x33,0x33,0}, {0xff,0x33,0x33,0},
+ {0x00,0x66,0x33,0}, {0x33,0x66,0x33,0}, {0x66,0x66,0x33,0}, {0x99,0x66,0x33,0},
+ {0xcc,0x66,0x33,0}, {0xff,0x66,0x33,0}, {0x00,0x99,0x33,0}, {0x33,0x99,0x33,0},
+ {0x66,0x99,0x33,0}, {0x99,0x99,0x33,0}, {0xcc,0x99,0x33,0}, {0xff,0x99,0x33,0},
+ {0x00,0xcc,0x33,0}, {0x33,0xcc,0x33,0}, {0x66,0xcc,0x33,0}, {0x99,0xcc,0x33,0},
+ {0xcc,0xcc,0x33,0}, {0xff,0xcc,0x33,0}, {0x00,0xff,0x33,0}, {0x33,0xff,0x33,0},
+ {0x66,0xff,0x33,0}, {0x99,0xff,0x33,0}, {0xcc,0xff,0x33,0}, {0xff,0xff,0x33,0},
+ {0x00,0x00,0x66,0}, {0x33,0x00,0x66,0}, {0x66,0x00,0x66,0}, {0x99,0x00,0x66,0},
+ {0xcc,0x00,0x66,0}, {0xff,0x00,0x66,0}, {0x00,0x33,0x66,0}, {0x33,0x33,0x66,0},
+ {0x66,0x33,0x66,0}, {0x99,0x33,0x66,0}, {0xcc,0x33,0x66,0}, {0xff,0x33,0x66,0},
+ {0x00,0x66,0x66,0}, {0x33,0x66,0x66,0}, {0x66,0x66,0x66,0}, {0x99,0x66,0x66,0},
+ {0xcc,0x66,0x66,0}, {0xff,0x66,0x66,0}, {0x00,0x99,0x66,0}, {0x33,0x99,0x66,0},
+ {0x66,0x99,0x66,0}, {0x99,0x99,0x66,0}, {0xcc,0x99,0x66,0}, {0xff,0x99,0x66,0},
+ {0x00,0xcc,0x66,0}, {0x33,0xcc,0x66,0}, {0x66,0xcc,0x66,0}, {0x99,0xcc,0x66,0},
+ {0xcc,0xcc,0x66,0}, {0xff,0xcc,0x66,0}, {0x00,0xff,0x66,0}, {0x33,0xff,0x66,0},
+ {0x66,0xff,0x66,0}, {0x99,0xff,0x66,0}, {0xcc,0xff,0x66,0}, {0xff,0xff,0x66,0},
+ {0x00,0x00,0x99,0}, {0x33,0x00,0x99,0}, {0x66,0x00,0x99,0}, {0x99,0x00,0x99,0},
+ {0xcc,0x00,0x99,0}, {0xff,0x00,0x99,0}, {0x00,0x33,0x99,0}, {0x33,0x33,0x99,0},
+ {0x66,0x33,0x99,0}, {0x99,0x33,0x99,0}, {0xcc,0x33,0x99,0}, {0xff,0x33,0x99,0},
+ {0x00,0x66,0x99,0}, {0x33,0x66,0x99,0}, {0x66,0x66,0x99,0}, {0x99,0x66,0x99,0},
+ {0xcc,0x66,0x99,0}, {0xff,0x66,0x99,0}, {0x00,0x99,0x99,0}, {0x33,0x99,0x99,0},
+ {0x66,0x99,0x99,0}, {0x99,0x99,0x99,0}, {0xcc,0x99,0x99,0}, {0xff,0x99,0x99,0},
+ {0x00,0xcc,0x99,0}, {0x33,0xcc,0x99,0}, {0x66,0xcc,0x99,0}, {0x99,0xcc,0x99,0},
+ {0xcc,0xcc,0x99,0}, {0xff,0xcc,0x99,0}, {0x00,0xff,0x99,0}, {0x33,0xff,0x99,0},
+ {0x66,0xff,0x99,0}, {0x99,0xff,0x99,0}, {0xcc,0xff,0x99,0}, {0xff,0xff,0x99,0},
+ {0x00,0x00,0xcc,0}, {0x33,0x00,0xcc,0}, {0x66,0x00,0xcc,0}, {0x99,0x00,0xcc,0},
+ {0xcc,0x00,0xcc,0}, {0xff,0x00,0xcc,0}, {0x00,0x33,0xcc,0}, {0x33,0x33,0xcc,0},
+ {0x66,0x33,0xcc,0}, {0x99,0x33,0xcc,0}, {0xcc,0x33,0xcc,0}, {0xff,0x33,0xcc,0},
+ {0x00,0x66,0xcc,0}, {0x33,0x66,0xcc,0}, {0x66,0x66,0xcc,0}, {0x99,0x66,0xcc,0},
+ {0xcc,0x66,0xcc,0}, {0xff,0x66,0xcc,0}, {0x00,0x99,0xcc,0}, {0x33,0x99,0xcc,0},
+ {0x66,0x99,0xcc,0}, {0x99,0x99,0xcc,0}, {0xcc,0x99,0xcc,0}, {0xff,0x99,0xcc,0},
+ {0x00,0xcc,0xcc,0}, {0x33,0xcc,0xcc,0}, {0x66,0xcc,0xcc,0}, {0x99,0xcc,0xcc,0},
+ {0xcc,0xcc,0xcc,0}, {0xff,0xcc,0xcc,0}, {0x00,0xff,0xcc,0}, {0x33,0xff,0xcc,0},
+ {0x66,0xff,0xcc,0}, {0x99,0xff,0xcc,0}, {0xcc,0xff,0xcc,0}, {0xff,0xff,0xcc,0},
+ {0x00,0x00,0xff,0}, {0x33,0x00,0xff,0}, {0x66,0x00,0xff,0}, {0x99,0x00,0xff,0},
+ {0xcc,0x00,0xff,0}, {0xff,0x00,0xff,0}, {0x00,0x33,0xff,0}, {0x33,0x33,0xff,0},
+ {0x66,0x33,0xff,0}, {0x99,0x33,0xff,0}, {0xcc,0x33,0xff,0}, {0xff,0x33,0xff,0},
+ {0x00,0x66,0xff,0}, {0x33,0x66,0xff,0}, {0x66,0x66,0xff,0}, {0x99,0x66,0xff,0},
+ {0xcc,0x66,0xff,0}, {0xff,0x66,0xff,0}, {0x00,0x99,0xff,0}, {0x33,0x99,0xff,0},
+ {0x66,0x99,0xff,0}, {0x99,0x99,0xff,0}, {0xcc,0x99,0xff,0}, {0xff,0x99,0xff,0},
+ {0x00,0xcc,0xff,0}, {0x33,0xcc,0xff,0}, {0x66,0xcc,0xff,0}, {0x99,0xcc,0xff,0},
+ {0xcc,0xcc,0xff,0}, {0xff,0xcc,0xff,0}, {0x00,0xff,0xff,0}, {0x33,0xff,0xff,0},
+ {0x66,0xff,0xff,0}, {0x99,0xff,0xff,0}, {0xcc,0xff,0xff,0}, {0xff,0xff,0xff,0}}
+}; /* bitmap information */
+#else
+unsigned char bitmap[LCD_HEIGHT][LCD_WIDTH]; /* the ui display */
RGBQUAD color_zero = {UI_LCD_BGCOLORLIGHT, 0};
RGBQUAD color_max = {0, 0, 0, 0};
@@ -36,12 +100,12 @@ BITMAPINFO256 bmi =
},
{} /* colour lookup table gets filled later */
}; /* bitmap information */
+#endif
#ifdef HAVE_LCD_BITMAP
#ifdef HAVE_REMOTE_LCD
-char remote_bitmap[LCD_REMOTE_HEIGHT][LCD_REMOTE_WIDTH];
-
+unsigned char remote_bitmap[LCD_REMOTE_HEIGHT][LCD_REMOTE_WIDTH];
RGBQUAD remote_color_zero = {UI_REMOTE_BGCOLORLIGHT, 0};
RGBQUAD remote_color_max = {0, 0, 0, 0};
@@ -55,12 +119,6 @@ BITMAPINFO256 remote_bmi =
};
#endif
-#if LCD_DEPTH == 1
-extern unsigned char lcd_framebuffer[LCD_HEIGHT/8][LCD_WIDTH]; /* the display */
-#elif LCD_DEPTH == 2
-extern unsigned char lcd_framebuffer[LCD_HEIGHT/4][LCD_WIDTH]; /* the display */
-#endif
-
void lcd_update(void)
{
int x, y;
@@ -71,11 +129,19 @@ void lcd_update(void)
for (x = 0; x < LCD_WIDTH; x++)
for (y = 0; y < LCD_HEIGHT; y++)
+ {
#if LCD_DEPTH == 1
bitmap[y][x] = ((lcd_framebuffer[y/8][x] >> (y & 7)) & 1);
#elif LCD_DEPTH == 2
bitmap[y][x] = ((lcd_framebuffer[y/4][x] >> (2 * (y & 3))) & 3);
+#elif LCD_DEPTH == 16
+ fb_data pixel = lcd_framebuffer[y][x];
+ unsigned red = ((pixel >> 8) & 0xf8) | (pixel >> 13);
+ unsigned green = ((pixel >> 3) & 0xfc) | ((pixel >> 9) & 0x03);
+ unsigned blue = ((pixel << 3) & 0xf8) | ((pixel >> 2) & 0x07);
+ bitmap[y][x] = (red << 16) | (green << 8) | blue;
#endif
+ }
/* Invalidate only the window part that actually did change */
GetClientRect (hGUIWnd, &r);
@@ -106,11 +172,19 @@ void lcd_update_rect(int x_start, int y_start,
for (x = x_start; x < xmax; x++)
for (y = y_start; y < ymax; y++)
+ {
#if LCD_DEPTH == 1
bitmap[y][x] = ((lcd_framebuffer[y/8][x] >> (y & 7)) & 1);
#elif LCD_DEPTH == 2
bitmap[y][x] = ((lcd_framebuffer[y/4][x] >> (2 * (y & 3))) & 3);
+#elif LCD_DEPTH == 16
+ fb_data pixel = lcd_framebuffer[y][x];
+ unsigned red = ((pixel >> 8) & 0xf8) | (pixel >> 13);
+ unsigned green = ((pixel >> 3) & 0xfc) | ((pixel >> 9) & 0x03);
+ unsigned blue = ((pixel << 3) & 0xf8) | ((pixel >> 2) & 0x07);
+ bitmap[y][x] = (red << 16) | (green << 8) | blue;
#endif
+ }
/* Invalidate only the window part that actually did change */
GetClientRect (hGUIWnd, &r);
@@ -272,6 +346,7 @@ void lcd_backlight (bool on)
}
#endif
+#if LCD_DEPTH <= 8
/* set a range of bitmap indices to a gradient from startcolour to endcolour */
void lcdcolors(int index, int count, RGBQUAD *start, RGBQUAD *end)
{
@@ -291,6 +366,7 @@ void lcdcolors(int index, int count, RGBQUAD *start, RGBQUAD *end)
+ (end->rgbBlue - start->rgbBlue) * i / count;
}
}
+#endif
#ifdef HAVE_REMOTE_LCD
/* 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)
/* initialise simulator lcd driver */
void simlcdinit(void)
{
+#if LCD_DEPTH <= 8
lcdcolors(0, (1<<LCD_DEPTH), &color_zero, &color_max);
+#endif
#ifdef HAVE_REMOTE_LCD
lcdremotecolors(0, (1<<LCD_REMOTE_DEPTH), &remote_color_zero, &remote_color_max);
#endif