diff options
Diffstat (limited to 'uisimulator/win32')
-rw-r--r-- | uisimulator/win32/lcd-win32.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/uisimulator/win32/lcd-win32.c b/uisimulator/win32/lcd-win32.c index 243e83dd2e..8b01803978 100644 --- a/uisimulator/win32/lcd-win32.c +++ b/uisimulator/win32/lcd-win32.c | |||
@@ -58,6 +58,8 @@ void lcd_set_invert_display(bool invert) | |||
58 | void lcd_update() | 58 | void lcd_update() |
59 | { | 59 | { |
60 | int x, y; | 60 | int x, y; |
61 | RECT r; | ||
62 | |||
61 | if (hGUIWnd == NULL) | 63 | if (hGUIWnd == NULL) |
62 | _endthread (); | 64 | _endthread (); |
63 | 65 | ||
@@ -82,10 +84,13 @@ void lcd_update() | |||
82 | for (y = 0; y < LCD_HEIGHT; y++) | 84 | for (y = 0; y < LCD_HEIGHT; y++) |
83 | bitmap[y][x] = ((lcd_framebuffer[y/8][x] >> (y & 7)) & 1); | 85 | bitmap[y][x] = ((lcd_framebuffer[y/8][x] >> (y & 7)) & 1); |
84 | 86 | ||
85 | InvalidateRect (hGUIWnd, NULL, FALSE); | 87 | /* Invalidate only the window part that actually did change */ |
86 | 88 | GetClientRect (hGUIWnd, &r); | |
87 | /* natural sleep :) Bagder: why is this here? */ | 89 | r.left = UI_LCD_POSX * r.right / UI_WIDTH; |
88 | //Sleep (50); | 90 | r.top = UI_LCD_POSY * r.bottom / UI_HEIGHT; |
91 | r.right = (UI_LCD_POSX + UI_LCD_WIDTH) * r.right / UI_WIDTH; | ||
92 | r.bottom = (UI_LCD_POSY + UI_LCD_HEIGHT) * r.bottom / UI_HEIGHT; | ||
93 | InvalidateRect (hGUIWnd, &r, FALSE); | ||
89 | } | 94 | } |
90 | 95 | ||
91 | void lcd_update_rect(int x_start, int y_start, | 96 | void lcd_update_rect(int x_start, int y_start, |
@@ -93,6 +98,7 @@ void lcd_update_rect(int x_start, int y_start, | |||
93 | { | 98 | { |
94 | int x, y; | 99 | int x, y; |
95 | int xmax, ymax; | 100 | int xmax, ymax; |
101 | RECT r; | ||
96 | 102 | ||
97 | ymax = y_start + height; | 103 | ymax = y_start + height; |
98 | xmax = x_start + width; | 104 | xmax = x_start + width; |
@@ -109,10 +115,17 @@ void lcd_update_rect(int x_start, int y_start, | |||
109 | for (y = y_start; y < ymax; y++) | 115 | for (y = y_start; y < ymax; y++) |
110 | bitmap[y][x] = ((lcd_framebuffer[y/8][x] >> (y & 7)) & 1); | 116 | bitmap[y][x] = ((lcd_framebuffer[y/8][x] >> (y & 7)) & 1); |
111 | 117 | ||
112 | /* Bagder: If I only knew how, I would make this call only invalidate | 118 | /* Invalidate only the window part that actually did change */ |
113 | the actual rectangle we want updated here, this NULL thing here will | 119 | GetClientRect (hGUIWnd, &r); |
114 | make the full rectangle updated! */ | 120 | r.left = (UI_LCD_POSX + (UI_LCD_WIDTH * x_start / LCD_WIDTH)) |
115 | InvalidateRect (hGUIWnd, NULL, FALSE); | 121 | * r.right / UI_WIDTH; |
122 | r.top = (UI_LCD_POSY + (UI_LCD_HEIGHT * y_start / LCD_HEIGHT)) | ||
123 | * r.bottom / UI_HEIGHT; | ||
124 | r.right = (UI_LCD_POSX + (UI_LCD_WIDTH * xmax / LCD_WIDTH)) | ||
125 | * r.right / UI_WIDTH; | ||
126 | r.bottom = (UI_LCD_POSY + (UI_LCD_HEIGHT * ymax / LCD_HEIGHT)) | ||
127 | * r.bottom / UI_HEIGHT; | ||
128 | InvalidateRect (hGUIWnd, &r, FALSE); | ||
116 | } | 129 | } |
117 | 130 | ||
118 | /* lcd_backlight() | 131 | /* lcd_backlight() |