summaryrefslogtreecommitdiffstats
path: root/uisimulator
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2005-07-08 01:41:12 +0000
committerJens Arnold <amiconn@rockbox.org>2005-07-08 01:41:12 +0000
commitc28969d11f16b53c50918b06dbe9e545e33ce323 (patch)
treecf458c3972e630324142cee45103f890a48aba13 /uisimulator
parent348d8f6bab492f46235d10eb905f724770c2f763 (diff)
downloadrockbox-c28969d11f16b53c50918b06dbe9e545e33ce323.tar.gz
rockbox-c28969d11f16b53c50918b06dbe9e545e33ce323.zip
Remote LCD support for the Win32 H1x0 simulator.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7061 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator')
-rw-r--r--uisimulator/win32/UI-h100.bmpbin265464 -> 194120 bytes
-rw-r--r--uisimulator/win32/lcd-win32.c101
-rw-r--r--uisimulator/win32/lcd-win32.h5
-rw-r--r--uisimulator/win32/uisw32.c13
-rw-r--r--uisimulator/win32/uisw32.h16
5 files changed, 120 insertions, 15 deletions
diff --git a/uisimulator/win32/UI-h100.bmp b/uisimulator/win32/UI-h100.bmp
index 5c0898ab22..caeb81bc4b 100644
--- a/uisimulator/win32/UI-h100.bmp
+++ b/uisimulator/win32/UI-h100.bmp
Binary files differ
diff --git a/uisimulator/win32/lcd-win32.c b/uisimulator/win32/lcd-win32.c
index 11296884b7..216aa65a0e 100644
--- a/uisimulator/win32/lcd-win32.c
+++ b/uisimulator/win32/lcd-win32.c
@@ -39,13 +39,29 @@ BITMAPINFO256 bmi =
#ifdef HAVE_LCD_BITMAP
+#ifdef HAVE_REMOTE_LCD
+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};
+
+BITMAPINFO256 remote_bmi =
+{
+ {sizeof (BITMAPINFOHEADER),
+ LCD_REMOTE_WIDTH, -LCD_REMOTE_HEIGHT, 1, 8,
+ BI_RGB, 0, 0, 0, 2, 2,
+ },
+ {} /* colour lookup table gets filled later */
+};
+#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 lcd_update(void)
{
int x, y;
RECT r;
@@ -109,19 +125,67 @@ void lcd_update_rect(int x_start, int y_start,
InvalidateRect (hGUIWnd, &r, FALSE);
}
+#ifdef HAVE_REMOTE_LCD
+
+extern unsigned char lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH];
+
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);
}
void lcd_remote_update_rect(int x_start, int y_start,
- int width, int height)
+ int width, int height)
{
- (void)x_start;
- (void)y_start;
- (void)width;
- (void)height;
+ int x, y;
+ int xmax, ymax;
+ RECT r;
+
+ ymax = y_start + height;
+ xmax = x_start + width;
+
+ if (hGUIWnd == NULL)
+ _endthread ();
+
+ if(xmax > LCD_REMOTE_WIDTH)
+ xmax = LCD_REMOTE_WIDTH;
+ if(ymax >= LCD_REMOTE_HEIGHT)
+ ymax = LCD_REMOTE_HEIGHT;
+
+ for (x = x_start; x < xmax; x++)
+ for (y = y_start; y < ymax; 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 + (UI_REMOTE_WIDTH * x_start / LCD_REMOTE_WIDTH))
+ * r.right / UI_WIDTH;
+ r.top = (UI_REMOTE_POSY + (UI_REMOTE_HEIGHT * y_start / LCD_REMOTE_HEIGHT))
+ * r.bottom / UI_HEIGHT;
+ r.right = (UI_REMOTE_POSX + (UI_REMOTE_WIDTH * xmax / LCD_REMOTE_WIDTH))
+ * r.right / UI_WIDTH;
+ r.bottom = (UI_REMOTE_POSY + (UI_REMOTE_HEIGHT * ymax / LCD_REMOTE_HEIGHT))
+ * r.bottom / UI_HEIGHT;
+ InvalidateRect (hGUIWnd, &r, FALSE);
}
+
+#endif /* HAVE_REMOTE_LCD */
#endif /* HAVE_LCD_BITMAP */
#ifdef HAVE_LCD_CHARCELLS
@@ -131,7 +195,7 @@ extern bool lcd_display_redraw;
extern unsigned char hardware_buffer_lcd[11][2];
static unsigned char lcd_buffer_copy[11][2];
-void lcd_update()
+void lcd_update(void)
{
int x, y;
bool changed = false;
@@ -224,11 +288,32 @@ void lcdcolors(int index, int count, RGBQUAD *start, RGBQUAD *end)
}
}
+#ifdef HAVE_REMOTE_LCD
+/* set a range of bitmap indices to a gradient from startcolour to endcolour */
+void lcdremotecolors(int index, int count, RGBQUAD *start, RGBQUAD *end)
+{
+ int i;
+ count--;
+ for (i = 0; i <= count; i++)
+ {
+ remote_bmi.bmiColors[i+index].rgbRed = start->rgbRed
+ + (end->rgbRed - start->rgbRed) * i / count;
+ remote_bmi.bmiColors[i+index].rgbGreen = start->rgbGreen
+ + (end->rgbGreen - start->rgbGreen) * i / count;
+ remote_bmi.bmiColors[i+index].rgbBlue = start->rgbBlue
+ + (end->rgbBlue - start->rgbBlue) * i / count;
+ }
+}
+#endif
+
/* initialise simulator lcd driver */
void simlcdinit(void)
{
bmi.bmiHeader.biClrUsed = (1<<LCD_DEPTH);
bmi.bmiHeader.biClrImportant = (1<<LCD_DEPTH);
lcdcolors(0, (1<<LCD_DEPTH), &color_zero, &color_max);
+#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 26a47208e5..ca9c9da3ee 100644
--- a/uisimulator/win32/lcd-win32.h
+++ b/uisimulator/win32/lcd-win32.h
@@ -33,6 +33,11 @@ typedef struct
extern char bitmap[LCD_HEIGHT][LCD_WIDTH]; // the ui display
extern BITMAPINFO256 bmi; // bitmap information
+#ifdef HAVE_REMOTE_LCD
+extern char remote_bitmap[LCD_REMOTE_HEIGHT][LCD_REMOTE_WIDTH];
+extern BITMAPINFO256 remote_bmi; // bitmap information
+#endif
+
void simlcdinit(void);
#endif // #ifndef __LCDWIN32_H__
diff --git a/uisimulator/win32/uisw32.c b/uisimulator/win32/uisw32.c
index fb581c0cf1..02697be443 100644
--- a/uisimulator/win32/uisw32.c
+++ b/uisimulator/win32/uisw32.c
@@ -182,7 +182,16 @@ LRESULT CALLBACK GUIWndProc (
0, 0, LCD_WIDTH, LCD_HEIGHT,
bitmap, (BITMAPINFO *) &bmi, DIB_RGB_COLORS,
SRCCOPY);
-
+#ifdef HAVE_REMOTE_LCD
+ StretchDIBits (hDc,
+ UI_REMOTE_POSX * r.right / UI_WIDTH,
+ UI_REMOTE_POSY * r.bottom / UI_HEIGHT,
+ UI_REMOTE_WIDTH * r.right / UI_WIDTH,
+ UI_REMOTE_HEIGHT * r.bottom / UI_HEIGHT,
+ 0, 0, LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT,
+ remote_bitmap, (BITMAPINFO *) &remote_bmi,
+ DIB_RGB_COLORS, SRCCOPY);
+#endif
EndPaint (hWnd, &ps);
return TRUE;
}
@@ -240,7 +249,7 @@ BOOL GUIStartup ()
if (hGUIWnd == NULL)
return FALSE;
- simlcdinit();
+ simlcdinit();
return TRUE;
}
diff --git a/uisimulator/win32/uisw32.h b/uisimulator/win32/uisw32.h
index dbbfd06c1e..cf44a8a76d 100644
--- a/uisimulator/win32/uisw32.h
+++ b/uisimulator/win32/uisw32.h
@@ -76,16 +76,22 @@ typedef unsigned short wchar_t;
#define UI_LCD_HEIGHT 64 // (80 for real aspect)
#elif defined(IRIVER_H100)
-#define UI_TITLE "iRiver H100"
-#define UI_WIDTH 352 // width of GUI window
-#define UI_HEIGHT 377 // height of GUI window
+#define UI_TITLE "iriver H100"
+#define UI_WIDTH 379 // width of GUI window
+#define UI_HEIGHT 508 // height of GUI window
#define UI_LCD_BGCOLOR 90, 145, 90 // bkgnd color of LCD (no backlight)
#define UI_LCD_BGCOLORLIGHT 230, 216, 173 // bkgnd color of LCD (backlight)
#define UI_LCD_BLACK 0, 0, 0 // black
-#define UI_LCD_POSX 96 // x position of lcd
-#define UI_LCD_POSY 28 // y position of lcd
+#define UI_LCD_POSX 109 // x position of lcd
+#define UI_LCD_POSY 23 // y position of lcd
#define UI_LCD_WIDTH 160
#define UI_LCD_HEIGHT 128
+#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 50 // x position of remote lcd
+#define UI_REMOTE_POSY 403 // y position of remote lcd
+#define UI_REMOTE_WIDTH 128
+#define UI_REMOTE_HEIGHT 64
#elif defined(ARCHOS_GMINI120)
#define UI_TITLE "Gmini 120"