optimisation to blit rects in one shot when width=pitch=screenwidth

svn-id: r8317
This commit is contained in:
Bertrand Augereau 2003-06-05 07:52:50 +00:00
parent bd23bcd128
commit d510447d05

View File

@ -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);
}