Win32 simulator: * Use a 16 bit display bitmap for 16bit target simulation. Simpler & faster this way. * Changed separate lcd_update() implementation into a simple call of lcd_update_rect() with the full rectangle.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7928 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
a436a7497d
commit
c6417b4a37
2 changed files with 13 additions and 114 deletions
|
@ -23,69 +23,16 @@
|
|||
#include "lcd.h"
|
||||
#include "lcd-playersim.h"
|
||||
|
||||
#if LCD_DEPTH >= 16
|
||||
unsigned long bitmap[LCD_HEIGHT][LCD_WIDTH]; /* the ui display */
|
||||
#if LCD_DEPTH == 16
|
||||
unsigned short 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}}
|
||||
LCD_WIDTH, -LCD_HEIGHT, 1, 16,
|
||||
BI_BITFIELDS, 0, 0, 0, 3, 3,
|
||||
}, /* bitfield masks (RGB565) */
|
||||
{{0x00, 0xf8, 0, 0}, {0xe0, 0x07, 0, 0}, {0x1f, 0x00, 0, 0}}
|
||||
}; /* bitmap information */
|
||||
#else
|
||||
unsigned char bitmap[LCD_HEIGHT][LCD_WIDTH]; /* the ui display */
|
||||
|
@ -121,35 +68,7 @@ BITMAPINFO256 remote_bmi =
|
|||
|
||||
void lcd_update(void)
|
||||
{
|
||||
int x, y;
|
||||
RECT r;
|
||||
|
||||
if (hGUIWnd == NULL)
|
||||
_endthread ();
|
||||
|
||||
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);
|
||||
r.left = UI_LCD_POSX * r.right / UI_WIDTH;
|
||||
r.top = UI_LCD_POSY * r.bottom / UI_HEIGHT;
|
||||
r.right = (UI_LCD_POSX + UI_LCD_WIDTH) * r.right / UI_WIDTH;
|
||||
r.bottom = (UI_LCD_POSY + UI_LCD_HEIGHT) * r.bottom / UI_HEIGHT;
|
||||
InvalidateRect (hGUIWnd, &r, FALSE);
|
||||
lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT);
|
||||
}
|
||||
|
||||
void lcd_update_rect(int x_start, int y_start,
|
||||
|
@ -178,11 +97,7 @@ void lcd_update_rect(int x_start, int y_start,
|
|||
#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;
|
||||
bitmap[y][x] = lcd_framebuffer[y][x];
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -203,25 +118,9 @@ void lcd_update_rect(int x_start, int y_start,
|
|||
|
||||
extern unsigned char lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH];
|
||||
|
||||
void lcd_remote_update(void)
|
||||
void lcd_remote_update (void)
|
||||
{
|
||||
int x, y;
|
||||
RECT r;
|
||||
|
||||
if (hGUIWnd == NULL)
|
||||
_endthread ();
|
||||
|
||||
for (x = 0; x < LCD_REMOTE_WIDTH; x++)
|
||||
for (y = 0; y < LCD_REMOTE_HEIGHT; y++)
|
||||
remote_bitmap[y][x] = ((lcd_remote_framebuffer[y/8][x] >> (y & 7)) & 1);
|
||||
|
||||
/* Invalidate only the window part that actually did change */
|
||||
GetClientRect (hGUIWnd, &r);
|
||||
r.left = UI_REMOTE_POSX * r.right / UI_WIDTH;
|
||||
r.top = UI_REMOTE_POSY * r.bottom / UI_HEIGHT;
|
||||
r.right = (UI_REMOTE_POSX + UI_REMOTE_WIDTH) * r.right / UI_WIDTH;
|
||||
r.bottom = (UI_REMOTE_POSY + UI_REMOTE_HEIGHT) * r.bottom / UI_HEIGHT;
|
||||
InvalidateRect (hGUIWnd, &r, FALSE);
|
||||
lcd_remote_update_rect(0, 0, LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT);
|
||||
}
|
||||
|
||||
void lcd_remote_update_rect(int x_start, int y_start,
|
||||
|
|
|
@ -30,10 +30,10 @@ typedef struct
|
|||
RGBQUAD bmiColors[256];
|
||||
} BITMAPINFO256;
|
||||
|
||||
#if LCD_DEPTH >= 16
|
||||
extern unsigned long bitmap[LCD_HEIGHT][LCD_WIDTH]; // the ui display
|
||||
#else
|
||||
#if LCD_DEPTH <= 8
|
||||
extern unsigned char bitmap[LCD_HEIGHT][LCD_WIDTH]; // the ui display
|
||||
#elif LCD_DEPTH <= 16
|
||||
extern unsigned short bitmap[LCD_HEIGHT][LCD_WIDTH]; // the ui display
|
||||
#endif
|
||||
extern BITMAPINFO256 bmi; // bitmap information
|
||||
|
||||
|
|
Loading…
Reference in a new issue