diff --git a/uisimulator/x11/lcd-x11.c b/uisimulator/x11/lcd-x11.c index 4a7dbc6bf3..75e29f3554 100644 --- a/uisimulator/x11/lcd-x11.c +++ b/uisimulator/x11/lcd-x11.c @@ -42,15 +42,14 @@ #if LCD_DEPTH == 2 #define YBLOCK 4 -#define BITOFFS 1 /* take the MSB of each pixel */ #define ANDBIT 3 /* AND with this to get the color number */ #else #define YBLOCK 8 -#define BITOFFS 0 #define ANDBIT 1 #endif extern void screen_resized(int width, int height); +extern bool lcd_display_redraw; #ifdef HAVE_LCD_BITMAP extern unsigned char lcd_framebuffer[LCD_HEIGHT/YBLOCK][LCD_WIDTH]; @@ -74,6 +73,7 @@ void lcd_update_rect(int x_start, int y_start, int ymax; int colors[LCD_WIDTH * LCD_HEIGHT]; struct coordinate points[LCD_WIDTH * LCD_HEIGHT]; + unsigned force_mask = lcd_display_redraw ? 0xFF : 0; #if 0 fprintf(stderr, "%04d: lcd_update_rect(%d, %d, %d, %d)\n", @@ -90,28 +90,29 @@ void lcd_update_rect(int x_start, int y_start, if(ymax >= LCD_HEIGHT/YBLOCK) ymax = LCD_HEIGHT/YBLOCK-1; - for(; yline<=ymax; yline++) { + for(; yline <= ymax; yline++) { y = yline * YBLOCK; - for(x=x_start; x>= (bit * LCD_DEPTH); - - /* set a dot */ - colors[p] = col; + colors[p] = col >> (bit * LCD_DEPTH); #else - colors[p] = col?3:0; + colors[p] = col ? 3 : 0; #endif - points[p].x = x + MARGIN_X; - points[p].y = y+bit + MARGIN_Y; - p++; /* increase the point counter */ + points[p].x = x + MARGIN_X; + points[p].y = y + bit + MARGIN_Y; + p++; /* increase the point counter */ + } + mask <<= LCD_DEPTH; } /* update the copy */ @@ -125,6 +126,7 @@ void lcd_update_rect(int x_start, int y_start, XtAppLock(app); XSync(dpy,False); XtAppUnlock(app); + lcd_display_redraw=false; } #ifdef LCD_REMOTE_HEIGHT @@ -148,8 +150,9 @@ void lcd_remote_update_rect(int x_start, int y_start, int bit; int xmax; int ymax; - struct coordinate points[LCD_WIDTH * LCD_HEIGHT]; - int colors[LCD_WIDTH * LCD_HEIGHT]; + struct coordinate points[LCD_REMOTE_WIDTH * LCD_REMOTE_HEIGHT]; + int colors[LCD_REMOTE_WIDTH * LCD_REMOTE_HEIGHT]; + unsigned force_mask = lcd_display_redraw ? 0xFF : 0; #if 0 fprintf(stderr, "%04d: lcd_update_rect(%d, %d, %d, %d)\n", @@ -166,31 +169,23 @@ void lcd_remote_update_rect(int x_start, int y_start, if(ymax >= LCD_REMOTE_HEIGHT/8) ymax = LCD_REMOTE_HEIGHT/8-1; - for(; yline<=ymax; yline++) { + for(; yline <= ymax; yline++) { y = yline * 8; - for(x=x_start; x