From 3be6cf15742083b9786fba52d40f61e5803db840 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Tue, 15 Nov 2005 23:37:21 +0000 Subject: 16bit colour support (H300) for the win32 simulator. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7898 a1c6a512-1295-4272-9138-f99709370657 --- uisimulator/win32/UI-h300.bmp | Bin 0 -> 334712 bytes uisimulator/win32/lcd-win32.c | 96 ++++++++++++++++++++++++++++++++++++++---- uisimulator/win32/lcd-win32.h | 8 +++- uisimulator/win32/uisw32.h | 16 +++++++ 4 files changed, 109 insertions(+), 11 deletions(-) create mode 100644 uisimulator/win32/UI-h300.bmp (limited to 'uisimulator/win32') diff --git a/uisimulator/win32/UI-h300.bmp b/uisimulator/win32/UI-h300.bmp new file mode 100644 index 0000000000..2af6070884 Binary files /dev/null and b/uisimulator/win32/UI-h300.bmp 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 @@ #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<= 16 +extern unsigned long bitmap[LCD_HEIGHT][LCD_WIDTH]; // the ui display +#else +extern unsigned char bitmap[LCD_HEIGHT][LCD_WIDTH]; // the ui display +#endif extern BITMAPINFO256 bmi; // bitmap information #ifdef HAVE_REMOTE_LCD -extern char remote_bitmap[LCD_REMOTE_HEIGHT][LCD_REMOTE_WIDTH]; +extern unsigned char remote_bitmap[LCD_REMOTE_HEIGHT][LCD_REMOTE_WIDTH]; extern BITMAPINFO256 remote_bmi; // bitmap information #endif 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; #define UI_REMOTE_WIDTH 128 #define UI_REMOTE_HEIGHT 64 +#elif defined(IRIVER_H300_SERIES) +#define UI_TITLE "iriver H300" +#define UI_WIDTH 288 // width of GUI window +#define UI_HEIGHT 581 // height of GUI window +/* high-colour */ +#define UI_LCD_POSX 26 // x position of lcd +#define UI_LCD_POSY 36 // y position of lcd +#define UI_LCD_WIDTH 220 +#define UI_LCD_HEIGHT 176 +#define UI_REMOTE_BGCOLOR 90, 145, 90 // bkgnd of remote lcd (no bklight) +#define UI_REMOTE_BGCOLORLIGHT 250, 180, 130 // bkgnd of remote lcd (bklight) +#define UI_REMOTE_POSX 12 // x position of remote lcd +#define UI_REMOTE_POSY 478 // y position of remote lcd +#define UI_REMOTE_WIDTH 128 +#define UI_REMOTE_HEIGHT 64 + #elif defined(ARCHOS_GMINI120) #define UI_TITLE "Gmini 120" #define UI_WIDTH 370 // width of GUI window -- cgit v1.2.3