aboutsummaryrefslogtreecommitdiff
path: root/backends/sdl/sdl.cpp
diff options
context:
space:
mode:
authorMax Horn2002-09-29 18:19:57 +0000
committerMax Horn2002-09-29 18:19:57 +0000
commit977aea241e849cca829ef1a333789fa90f421b13 (patch)
treed1a75f286933a32bbc80de3685afb9ccf46b515a /backends/sdl/sdl.cpp
parent9926433cc1b316a01bae6d9d590b121968d3d8ad (diff)
downloadscummvm-rg350-977aea241e849cca829ef1a333789fa90f421b13.tar.gz
scummvm-rg350-977aea241e849cca829ef1a333789fa90f421b13.tar.bz2
scummvm-rg350-977aea241e849cca829ef1a333789fa90f421b13.zip
fixed buglet during shake mode
svn-id: r5040
Diffstat (limited to 'backends/sdl/sdl.cpp')
-rw-r--r--backends/sdl/sdl.cpp33
1 files changed, 19 insertions, 14 deletions
diff --git a/backends/sdl/sdl.cpp b/backends/sdl/sdl.cpp
index 8bdd5301e4..0542deded5 100644
--- a/backends/sdl/sdl.cpp
+++ b/backends/sdl/sdl.cpp
@@ -301,10 +301,19 @@ void OSystem_SDL_Normal::unload_gfx_mode() {
void OSystem_SDL_Normal::update_screen() {
- if (sdl_hwscreen == NULL)
- return; // Can this really happen?
+ assert(sdl_hwscreen != NULL);
+
+ // If the shake position changed, fill the dirty area with blackness
+ if (_currentShakePos != _newShakePos) {
+ SDL_Rect blackrect = {0, 0, _screenWidth*_scaleFactor, _newShakePos*_scaleFactor};
+ SDL_FillRect(sdl_hwscreen, &blackrect, 0);
- // First make sure the mouse is drawn, if it should be drawn.
+ _currentShakePos = _newShakePos;
+
+ _forceFull = true;
+ }
+
+ // Make sure the mouse is drawn, if it should be drawn.
draw_mouse();
// Check whether the palette was changed in the meantime and update the
@@ -319,17 +328,6 @@ void OSystem_SDL_Normal::update_screen() {
_forceFull = true;
}
-
- /* If the shake position changed, fill the dirty area with blackness */
- if (_currentShakePos != _newShakePos) {
- SDL_Rect blackrect = {0, 0, _screenWidth*_scaleFactor, _newShakePos*_scaleFactor};
- SDL_FillRect(sdl_hwscreen, &blackrect, 0);
-
- _currentShakePos = _newShakePos;
-
- _forceFull = true;
- }
-
// Force a full redraw if requested
if (_forceFull) {
_num_dirty_rects = 1;
@@ -388,6 +386,13 @@ void OSystem_SDL_Normal::update_screen() {
SDL_UnlockSurface(sdl_tmpscreen);
SDL_UnlockSurface(sdl_hwscreen);
+ // Readjust the dirty rect list in case we are doing a full update.
+ // This is necessary if shaking is active.
+ if (_forceFull) {
+ _dirty_rect_list[0].y = 0;
+ _dirty_rect_list[0].h = _screenHeight * _scaleFactor;
+ }
+
// Finally, blit all our changes to the screen
SDL_UpdateRects(sdl_hwscreen, _num_dirty_rects, _dirty_rect_list);
}