From 08b643ee57bce283db17a821c3d0d638c7ca0217 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Wed, 4 Mar 2009 18:46:08 +0000 Subject: [PATCH] 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 --- uisimulator/sdl/lcd-sdl.c | 20 ++++++++------------ 1 file 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, void sdl_gui_update(SDL_Surface *surface, int x_start, int y_start, int width, int height, int max_x, int max_y, int ui_x, int ui_y) { - int xmax, ymax; - - ymax = y_start + height; - xmax = x_start + width; - - if(xmax > max_x) - xmax = max_x; - if(ymax >= max_y) - ymax = max_y; + if (x_start + width > max_x) + width = max_x - x_start; + if (y_start + height > max_y) + height = max_y - y_start; SDL_Rect src = {x_start * display_zoom, y_start * display_zoom, - xmax * display_zoom, ymax * display_zoom}; - SDL_Rect dest= {(ui_x + x_start) * display_zoom, (ui_y + y_start) * display_zoom, - xmax * display_zoom, ymax * display_zoom}; + width * display_zoom, height * display_zoom}; + SDL_Rect dest= {(ui_x + x_start) * display_zoom, + (ui_y + y_start) * display_zoom, + width * display_zoom, height * display_zoom}; if (surface->flags & SDL_SRCALPHA) /* alpha needs a black background */ SDL_FillRect(gui_surface, &dest, 0);