1
0
Fork 0
forked from len0rd/rockbox

16bit colour support (H300) for the win32 simulator.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7898 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2005-11-15 23:37:21 +00:00
parent 2691d76073
commit 3be6cf1574
9 changed files with 119 additions and 29 deletions

View file

@ -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

View file

@ -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)
{

View file

@ -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 */

View file

@ -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)
{

View file

@ -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;

Binary file not shown.

After

Width:  |  Height:  |  Size: 327 KiB

View file

@ -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

View file

@ -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

View file

@ -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