summaryrefslogtreecommitdiffstats
path: root/uisimulator/x11
diff options
context:
space:
mode:
Diffstat (limited to 'uisimulator/x11')
-rw-r--r--uisimulator/x11/Makefile1
-rw-r--r--uisimulator/x11/lcd-x11.c134
-rw-r--r--uisimulator/x11/screenhack.c7
-rw-r--r--uisimulator/x11/uibasic.c15
4 files changed, 149 insertions, 8 deletions
diff --git a/uisimulator/x11/Makefile b/uisimulator/x11/Makefile
index 4d3e1e7fce..989ac65223 100644
--- a/uisimulator/x11/Makefile
+++ b/uisimulator/x11/Makefile
@@ -45,7 +45,6 @@ CFLAGS = $(DEBUG) $(DEFINES) $(INCLUDES) $(GCCOPTS)
OUTFILE = $(BUILDDIR)/libsim.a
all: $(OUTFILE)
- @$(MAKE) -C $(SIMCOMMON)
include $(TOOLSDIR)/make.inc
diff --git a/uisimulator/x11/lcd-x11.c b/uisimulator/x11/lcd-x11.c
index dada13d42d..1ee15f9169 100644
--- a/uisimulator/x11/lcd-x11.c
+++ b/uisimulator/x11/lcd-x11.c
@@ -46,11 +46,6 @@ extern void screen_resized(int width, int height);
#ifdef HAVE_LCD_BITMAP
unsigned char lcd_framebuffer_copy[LCD_HEIGHT/8][LCD_WIDTH];
-void lcd_set_invert_display(bool invert)
-{
- (void)invert;
-}
-
void lcd_update (void)
{
int x, y;
@@ -162,6 +157,135 @@ void lcd_update_rect(int x_start, int y_start,
XSync(dpy,False);
XtAppUnlock(app);
}
+
+#ifdef LCD_REMOTE_HEIGHT
+extern unsigned char lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH];
+unsigned char lcd_remote_framebuffer_copy[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH];
+
+#define REMOTE_MARGIN_X 2
+#define REMOTE_MARGIN_Y (LCD_HEIGHT + 2 + MARGIN_Y)
+
+void lcd_remote_update (void)
+{
+ int x, y;
+ int p=0;
+ int bit;
+ struct coordinate points[LCD_REMOTE_WIDTH * LCD_REMOTE_HEIGHT];
+ int cp=0;
+ struct coordinate clearpoints[LCD_REMOTE_WIDTH * LCD_REMOTE_HEIGHT];
+
+ for(y=0; y<LCD_REMOTE_HEIGHT; y+=8) {
+ for(x=0; x<LCD_REMOTE_WIDTH; x++) {
+ if(lcd_remote_framebuffer[y/8][x] ||
+ lcd_remote_framebuffer_copy[y/8][x]) {
+ /* one or more bits/pixels are changed */
+ unsigned char diff =
+ lcd_remote_framebuffer[y/8][x] ^
+ lcd_remote_framebuffer_copy[y/8][x];
+
+ for(bit=0; bit<8; bit++) {
+ if(lcd_remote_framebuffer[y/8][x]&(1<<bit)) {
+ /* set a dot */
+ points[p].x = x + REMOTE_MARGIN_X;
+ points[p].y = y+bit + REMOTE_MARGIN_Y;
+ p++; /* increase the point counter */
+ }
+ else if(diff &(1<<bit)) {
+ /* clear a dot */
+ clearpoints[cp].x = x + REMOTE_MARGIN_X;
+ clearpoints[cp].y = y+bit + REMOTE_MARGIN_Y;
+ cp++; /* increase the point counter */
+ }
+ }
+ }
+ }
+ }
+
+ /* copy a huge block */
+ memcpy(lcd_remote_framebuffer_copy, lcd_remote_framebuffer,
+ sizeof(lcd_remote_framebuffer));
+
+ drawdots(0, &clearpoints[0], cp);
+ drawdots(1, &points[0], p);
+ /* printf("lcd_update: Draws %d pixels, clears %d pixels (max %d/%d)\n",
+ p, cp, p+cp, LCD_HEIGHT*LCD_WIDTH); */
+ XtAppLock(app);
+ XSync(dpy,False);
+ XtAppUnlock(app);
+}
+
+void lcd_remote_update_rect(int x_start, int y_start,
+ int width, int height)
+{
+ int x;
+ int yline=y_start;
+ int y;
+ int p=0;
+ int bit;
+ int cp=0;
+ int xmax;
+ int ymax;
+ struct coordinate points[LCD_WIDTH * LCD_HEIGHT];
+ struct coordinate clearpoints[LCD_WIDTH * LCD_HEIGHT];
+
+#if 0
+ fprintf(stderr, "%04d: lcd_update_rect(%d, %d, %d, %d)\n",
+ counter++, x_start, y_start, width, height);
+#endif
+ /* The Y coordinates have to work on even 8 pixel rows */
+ ymax = (yline + height)/8;
+ yline /= 8;
+
+ xmax = x_start + width;
+
+ if(xmax > LCD_REMOTE_WIDTH)
+ xmax = LCD_REMOTE_WIDTH;
+ if(ymax >= LCD_REMOTE_HEIGHT/8)
+ ymax = LCD_REMOTE_HEIGHT/8-1;
+
+ for(; yline<=ymax; yline++) {
+ y = yline * 8;
+ for(x=x_start; x<xmax; x++) {
+ if(lcd_remote_framebuffer[yline][x] ||
+ lcd_remote_framebuffer_copy[yline][x]) {
+ /* one or more bits/pixels are changed */
+ unsigned char diff =
+ lcd_remote_framebuffer[yline][x] ^
+ lcd_remote_framebuffer_copy[yline][x];
+
+ for(bit=0; bit<8; bit++) {
+ if(lcd_remote_framebuffer[yline][x]&(1<<bit)) {
+ /* set a dot */
+ points[p].x = x + REMOTE_MARGIN_X;
+ points[p].y = y+bit + REMOTE_MARGIN_Y;
+ p++; /* increase the point counter */
+ }
+ else if(diff &(1<<bit)) {
+ /* clear a dot */
+ clearpoints[cp].x = x + REMOTE_MARGIN_X;
+ clearpoints[cp].y = y+bit + REMOTE_MARGIN_Y;
+ cp++; /* increase the point counter */
+ }
+ }
+
+ /* update the copy */
+ lcd_remote_framebuffer_copy[yline][x] =
+ lcd_remote_framebuffer[yline][x];
+ }
+ }
+ }
+
+ drawdots(0, &clearpoints[0], cp);
+ drawdots(1, &points[0], p);
+ /* printf("lcd_update_rect: Draws %d pixels, clears %d pixels\n", p, cp);*/
+ XtAppLock(app);
+ XSync(dpy,False);
+ XtAppUnlock(app);
+}
+
+
+#endif
+
#endif
#ifdef HAVE_LCD_CHARCELLS
diff --git a/uisimulator/x11/screenhack.c b/uisimulator/x11/screenhack.c
index fb0f5637e5..4b8713970a 100644
--- a/uisimulator/x11/screenhack.c
+++ b/uisimulator/x11/screenhack.c
@@ -437,8 +437,13 @@ int main (int argc, char **argv)
{
static char geometry[40];
#ifdef HAVE_LCD_BITMAP
+ unsigned int height = LCD_HEIGHT;
+#ifdef LCD_REMOTE_HEIGHT
+ height += LCD_REMOTE_HEIGHT;
+#endif
+ printf("height: %d\n", height);
snprintf(geometry, 40, "*geometry: %dx%d",
- LCD_WIDTH*display_zoom+14, LCD_HEIGHT*display_zoom+8);
+ LCD_WIDTH*display_zoom+14, height*display_zoom+8);
#else
snprintf(geometry, 40, "*geometry: %dx%d", 280*display_zoom,
132*display_zoom);
diff --git a/uisimulator/x11/uibasic.c b/uisimulator/x11/uibasic.c
index 0c3e9bb9d0..08fdf594ed 100644
--- a/uisimulator/x11/uibasic.c
+++ b/uisimulator/x11/uibasic.c
@@ -235,7 +235,7 @@ void screenhack()
void screen_redraw()
{
- /* draw a border around the "Recorder" screen */
+ /* draw a border around the screen */
#define X1 0
#define Y1 0
#define X2 (LCD_WIDTH + MARGIN_X*2)
@@ -246,4 +246,17 @@ void screen_redraw()
drawline(1, X1, Y2, X2, Y2);
drawline(1, X1, Y1, X1, Y2);
lcd_update();
+#ifdef LCD_REMOTE_HEIGHT
+ /* draw a border around the remote LCD screen */
+#define RX1 0
+#define RY1 (Y2 +1)
+#define RX2 (LCD_REMOTE_WIDTH + MARGIN_X*2)
+#define RY2 (Y2 + 1 + LCD_REMOTE_HEIGHT)
+
+ drawline(1, RX1, RY1, RX2, RY1);
+ drawline(1, RX2, RY1, RX2, RY2);
+ drawline(1, RX1, RY2, RX2, RY2);
+ drawline(1, RX1, RY1, RX1, RY2);
+ lcd_remote_update();
+#endif
}