diff options
author | Jens Arnold <amiconn@rockbox.org> | 2005-03-06 13:28:40 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2005-03-06 13:28:40 +0000 |
commit | 0231c616992c331a0bd0556ed5ce46fb09854c74 (patch) | |
tree | 0c2bee8559d26bf9162dc766b52aa271fbdd1b84 /uisimulator | |
parent | 1167b403e65cbf6bf9e8b4fc27e212e2c913d717 (diff) | |
download | rockbox-0231c616992c331a0bd0556ed5ce46fb09854c74.tar.gz rockbox-0231c616992c331a0bd0556ed5ce46fb09854c74.zip |
Win32 simulator performance optimisation: Invalidate onle the part of the window that actually changed in lcd_update() and lcd_update_rect().
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6150 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator')
-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) void lcd_update() { int x, y; + RECT r; + if (hGUIWnd == NULL) _endthread (); @@ -82,10 +84,13 @@ void lcd_update() for (y = 0; y < LCD_HEIGHT; y++) bitmap[y][x] = ((lcd_framebuffer[y/8][x] >> (y & 7)) & 1); - InvalidateRect (hGUIWnd, NULL, FALSE); - - /* natural sleep :) Bagder: why is this here? */ - //Sleep (50); + /* 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); } void lcd_update_rect(int x_start, int y_start, @@ -93,6 +98,7 @@ void lcd_update_rect(int x_start, int y_start, { int x, y; int xmax, ymax; + RECT r; ymax = y_start + height; xmax = x_start + width; @@ -109,10 +115,17 @@ void lcd_update_rect(int x_start, int y_start, for (y = y_start; y < ymax; y++) bitmap[y][x] = ((lcd_framebuffer[y/8][x] >> (y & 7)) & 1); - /* Bagder: If I only knew how, I would make this call only invalidate - the actual rectangle we want updated here, this NULL thing here will - make the full rectangle updated! */ - InvalidateRect (hGUIWnd, NULL, FALSE); + /* Invalidate only the window part that actually did change */ + GetClientRect (hGUIWnd, &r); + r.left = (UI_LCD_POSX + (UI_LCD_WIDTH * x_start / LCD_WIDTH)) + * r.right / UI_WIDTH; + r.top = (UI_LCD_POSY + (UI_LCD_HEIGHT * y_start / LCD_HEIGHT)) + * r.bottom / UI_HEIGHT; + r.right = (UI_LCD_POSX + (UI_LCD_WIDTH * xmax / LCD_WIDTH)) + * r.right / UI_WIDTH; + r.bottom = (UI_LCD_POSY + (UI_LCD_HEIGHT * ymax / LCD_HEIGHT)) + * r.bottom / UI_HEIGHT; + InvalidateRect (hGUIWnd, &r, FALSE); } /* lcd_backlight() |