aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/sdl/sdl-common.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/backends/sdl/sdl-common.cpp b/backends/sdl/sdl-common.cpp
index 9970d20b13..4849b1b1ca 100644
--- a/backends/sdl/sdl-common.cpp
+++ b/backends/sdl/sdl-common.cpp
@@ -197,11 +197,17 @@ void OSystem_SDL_Common::copy_rect(const byte *buf, int pitch, int x, int y, int
error("SDL_LockSurface failed: %s.\n", SDL_GetError());
byte *dst = (byte *)_screen->pixels + y * _screenWidth + x;
- do {
- memcpy(dst, buf, w);
- dst += _screenWidth;
- buf += pitch;
- } while (--h);
+
+ if (_screenWidth==pitch && pitch==w)
+ memcpy (dst, buf, h*w);
+ else
+ {
+ do {
+ memcpy(dst, buf, w);
+ dst += _screenWidth;
+ buf += pitch;
+ } while (--h);
+ }
SDL_UnlockSurface(_screen);
}