From d510447d0505915bd11535137b8382db72a5c460 Mon Sep 17 00:00:00 2001 From: Bertrand Augereau Date: Thu, 5 Jun 2003 07:52:50 +0000 Subject: optimisation to blit rects in one shot when width=pitch=screenwidth svn-id: r8317 --- backends/sdl/sdl-common.cpp | 16 +++++++++++----- 1 file 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); } -- cgit v1.2.3