summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2009-03-04 18:46:08 +0000
committerJens Arnold <amiconn@rockbox.org>2009-03-04 18:46:08 +0000
commit08b643ee57bce283db17a821c3d0d638c7ca0217 (patch)
treec224e56499d929b67b84b58277467e36b2c094a5
parent4f87abf90af67d23582156343ef7dbd66cd18aa8 (diff)
downloadrockbox-08b643ee57bce283db17a821c3d0d638c7ca0217.tar.gz
rockbox-08b643ee57bce283db17a821c3d0d638c7ca0217.zip
Fix update rectangle calculation. This caused the black artifacts outside the screen area introduced with backlight simulation for colour targets.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20199 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--uisimulator/sdl/lcd-sdl.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/uisimulator/sdl/lcd-sdl.c b/uisimulator/sdl/lcd-sdl.c
index aa74c14cd9..f1ffe8a76a 100644
--- a/uisimulator/sdl/lcd-sdl.c
+++ b/uisimulator/sdl/lcd-sdl.c
@@ -75,20 +75,16 @@ void sdl_update_rect(SDL_Surface *surface, int x_start, int y_start, int width,
75void sdl_gui_update(SDL_Surface *surface, int x_start, int y_start, int width, 75void sdl_gui_update(SDL_Surface *surface, int x_start, int y_start, int width,
76 int height, int max_x, int max_y, int ui_x, int ui_y) 76 int height, int max_x, int max_y, int ui_x, int ui_y)
77{ 77{
78 int xmax, ymax; 78 if (x_start + width > max_x)
79 79 width = max_x - x_start;
80 ymax = y_start + height; 80 if (y_start + height > max_y)
81 xmax = x_start + width; 81 height = max_y - y_start;
82
83 if(xmax > max_x)
84 xmax = max_x;
85 if(ymax >= max_y)
86 ymax = max_y;
87 82
88 SDL_Rect src = {x_start * display_zoom, y_start * display_zoom, 83 SDL_Rect src = {x_start * display_zoom, y_start * display_zoom,
89 xmax * display_zoom, ymax * display_zoom}; 84 width * display_zoom, height * display_zoom};
90 SDL_Rect dest= {(ui_x + x_start) * display_zoom, (ui_y + y_start) * display_zoom, 85 SDL_Rect dest= {(ui_x + x_start) * display_zoom,
91 xmax * display_zoom, ymax * display_zoom}; 86 (ui_y + y_start) * display_zoom,
87 width * display_zoom, height * display_zoom};
92 88
93 if (surface->flags & SDL_SRCALPHA) /* alpha needs a black background */ 89 if (surface->flags & SDL_SRCALPHA) /* alpha needs a black background */
94 SDL_FillRect(gui_surface, &dest, 0); 90 SDL_FillRect(gui_surface, &dest, 0);