aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorBertrand Augereau2003-06-05 07:52:50 +0000
committerBertrand Augereau2003-06-05 07:52:50 +0000
commitd510447d0505915bd11535137b8382db72a5c460 (patch)
treedb12b30e4b0c2c0809a65c5739f745ba61cd2d73 /backends
parentbd23bcd12827d2ba2e9695d30bc2b056306746e2 (diff)
downloadscummvm-rg350-d510447d0505915bd11535137b8382db72a5c460.tar.gz
scummvm-rg350-d510447d0505915bd11535137b8382db72a5c460.tar.bz2
scummvm-rg350-d510447d0505915bd11535137b8382db72a5c460.zip
optimisation to blit rects in one shot when width=pitch=screenwidth
svn-id: r8317
Diffstat (limited to 'backends')
-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);
}