aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/sdl/sdl-common.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/backends/sdl/sdl-common.cpp b/backends/sdl/sdl-common.cpp
index 95c4ea7364..92eca7acf8 100644
--- a/backends/sdl/sdl-common.cpp
+++ b/backends/sdl/sdl-common.cpp
@@ -233,8 +233,9 @@ void OSystem_SDL_Common::move_screen(int dx, int dy, int height) {
copy_rect((byte *)_screen->pixels + _screenWidth * (y - dy), _screenWidth, 0, y, _screenWidth, 1);
} else if (dy < 0) {
// move up - copy from top to bottom
+ dy = -dy;
for (y = dy; y < height; y++)
- copy_rect((byte *)_screen->pixels + _screenWidth * (y - dy), _screenWidth, 0, y, _screenWidth, 1);
+ copy_rect((byte *)_screen->pixels + _screenWidth * y, _screenWidth, 0, y - dy, _screenWidth, 1);
}
// horizontal movement
@@ -244,8 +245,9 @@ void OSystem_SDL_Common::move_screen(int dx, int dy, int height) {
copy_rect((byte *)_screen->pixels + x - dx, _screenWidth, x, 0, 1, height);
} else if (dx < 0) {
// move left - copy from left to right
+ dx = -dx;
for (x = dx; x < _screenWidth; x++)
- copy_rect((byte *)_screen->pixels + x - dx, _screenWidth, x, 0, 1, height);
+ copy_rect((byte *)_screen->pixels + x, _screenWidth, x - dx, 0, 1, height);
}
}