summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2005-11-15 23:37:21 +0000
committerJens Arnold <amiconn@rockbox.org>2005-11-15 23:37:21 +0000
commit3be6cf15742083b9786fba52d40f61e5803db840 (patch)
tree0813b8c21260c62b916f1fe99f76e1bf30e1f21a
parent2691d760737c591cf368e9c4e90b1f96b973cfcc (diff)
downloadrockbox-3be6cf15742083b9786fba52d40f61e5803db840.tar.gz
rockbox-3be6cf15742083b9786fba52d40f61e5803db840.tar.bz2
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
-rw-r--r--firmware/SOURCES6
-rw-r--r--firmware/drivers/lcd-16bit.c6
-rw-r--r--firmware/drivers/lcd-h300.c10
-rw-r--r--firmware/drivers/lcd-ipod.c4
-rw-r--r--uisimulator/common/lcd-common.c2
-rw-r--r--uisimulator/win32/UI-h300.bmpbin0 -> 334712 bytes
-rw-r--r--uisimulator/win32/lcd-win32.c96
-rw-r--r--uisimulator/win32/lcd-win32.h8
-rw-r--r--uisimulator/win32/uisw32.h16
9 files changed, 119 insertions, 29 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES
index d8cd16e692..fb8ed7b6d7 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -98,6 +98,9 @@ drivers/i2c.c
#if CONFIG_CODEC != SWCODEC
drivers/mas.c
#endif
+#ifdef IRIVER_H300_SERIES
+drivers/pcf50606.c
+#endif
#ifdef HAVE_RTC
drivers/rtc.c
#endif
@@ -150,6 +153,3 @@ replaygain.c
pcm_record.c
#endif
sound.c
-#ifdef IRIVER_H300_SERIES
-drivers/pcf50606.c
-#endif
diff --git a/firmware/drivers/lcd-16bit.c b/firmware/drivers/lcd-16bit.c
index fb5e0ccbb8..9f698bbacd 100644
--- a/firmware/drivers/lcd-16bit.c
+++ b/firmware/drivers/lcd-16bit.c
@@ -63,6 +63,12 @@ static const char scroll_tick_table[16] = {
100, 80, 64, 50, 40, 32, 25, 20, 16, 12, 10, 8, 6, 5, 4, 3
};
+/* probably just a dummy */
+int lcd_default_contrast(void)
+{
+ return 28;
+}
+
/* LCD init */
void lcd_init(void)
{
diff --git a/firmware/drivers/lcd-h300.c b/firmware/drivers/lcd-h300.c
index 1e71da59a8..4edfe404b3 100644
--- a/firmware/drivers/lcd-h300.c
+++ b/firmware/drivers/lcd-h300.c
@@ -49,13 +49,6 @@ void lcd_write_data(const unsigned short* p_bytes, int count)
/*** hardware configuration ***/
-int lcd_default_contrast(void)
-{
- return 28;
-}
-
-#ifndef SIMULATOR
-
void lcd_set_contrast(int val)
{
(void)val;
@@ -84,10 +77,8 @@ void lcd_roll(int lines)
(void)lines;
}
-#endif /* !SIMULATOR */
/* LCD init */
-#ifndef SIMULATOR
void lcd_init_device(void)
{
/* GPO46 is LCD RESET */
@@ -216,4 +207,3 @@ void lcd_update_rect(int x, int y, int width, int height)
lcd_write_data ((unsigned short *)&lcd_framebuffer[y][x], width);
}
}
-#endif /* !SIMULATOR */
diff --git a/firmware/drivers/lcd-ipod.c b/firmware/drivers/lcd-ipod.c
index 69272ccccf..f7a21044bb 100644
--- a/firmware/drivers/lcd-ipod.c
+++ b/firmware/drivers/lcd-ipod.c
@@ -120,10 +120,6 @@ static void lcd_cmd_data(int cmd, int data)
}
/*** hardware configuration ***/
-int lcd_default_contrast(void)
-{
- return 28;
-}
void lcd_set_contrast(int val)
{
diff --git a/uisimulator/common/lcd-common.c b/uisimulator/common/lcd-common.c
index c3f74e8447..a9fc294b1a 100644
--- a/uisimulator/common/lcd-common.c
+++ b/uisimulator/common/lcd-common.c
@@ -30,7 +30,7 @@
#include "lcd-x11.h"
#endif
-void lcd_blit(const unsigned char* p_data, int x, int y, int width, int height,
+void lcd_blit(const fb_data* p_data, int x, int y, int width, int height,
int stride)
{
(void)p_data;
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 @@
#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
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
RGBQUAD bmiColors[256];
} BITMAPINFO256;
-extern char bitmap[LCD_HEIGHT][LCD_WIDTH]; // the ui display
+#if LCD_DEPTH >= 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