summaryrefslogtreecommitdiffstats
path: root/uisimulator
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2005-11-17 17:25:56 +0000
committerJens Arnold <amiconn@rockbox.org>2005-11-17 17:25:56 +0000
commitc6417b4a376331756d6dea262bc605c985f00344 (patch)
tree50c4df166c1d307393234dfb790b919b102fed37 /uisimulator
parenta436a7497dbb67249ffac11f62d7e8ced245acdb (diff)
downloadrockbox-c6417b4a376331756d6dea262bc605c985f00344.tar.gz
rockbox-c6417b4a376331756d6dea262bc605c985f00344.zip
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
Diffstat (limited to 'uisimulator')
-rw-r--r--uisimulator/win32/lcd-win32.c121
-rw-r--r--uisimulator/win32/lcd-win32.h6
2 files changed, 13 insertions, 114 deletions
diff --git a/uisimulator/win32/lcd-win32.c b/uisimulator/win32/lcd-win32.c
index 49c490e1f4..f5672a58bf 100644
--- a/uisimulator/win32/lcd-win32.c
+++ b/uisimulator/win32/lcd-win32.c
@@ -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,
diff --git a/uisimulator/win32/lcd-win32.h b/uisimulator/win32/lcd-win32.h
index 5aa4982c2b..b3533ad0cb 100644
--- a/uisimulator/win32/lcd-win32.h
+++ b/uisimulator/win32/lcd-win32.h
@@ -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