Got rid of OSystem::move_screen

svn-id: r14882
This commit is contained in:
Max Horn 2004-09-04 01:31:04 +00:00
parent b086ee7f67
commit 4bd05071e5
14 changed files with 13 additions and 336 deletions

View file

@ -720,77 +720,6 @@ void OSystem_SDL::setPalette(const byte *colors, uint start, uint num) {
_paletteDirtyEnd = start + num;
}
void OSystem_SDL::move_screen(int dx, int dy, int height) {
// Short circuit check - do we have to do anything anyway?
if ((dx == 0 && dy == 0) || height <= 0)
return;
Common::StackLock lock(_graphicsMutex); // Lock the mutex until this function ends
byte *src, *dst;
int x, y;
// We'll have to do a full screen redraw anyway, so set the flag.
_forceFull = true;
// Hide the mouse
undraw_mouse();
// Try to lock the screen surface
if (SDL_LockSurface(_screen) == -1)
error("SDL_LockSurface failed: %s", SDL_GetError());
// vertical movement
if (dy > 0) {
// move down - copy from bottom to top
dst = (byte *)_screen->pixels + (height - 1) * _screenWidth;
src = dst - dy * _screenWidth;
for (y = dy; y < height; y++) {
memcpy(dst, src, _screenWidth);
src -= _screenWidth;
dst -= _screenWidth;
}
} else if (dy < 0) {
// move up - copy from top to bottom
dst = (byte *)_screen->pixels;
src = dst - dy * _screenWidth;
for (y = -dy; y < height; y++) {
memcpy(dst, src, _screenWidth);
src += _screenWidth;
dst += _screenWidth;
}
}
// horizontal movement
if (dx > 0) {
// move right - copy from right to left
dst = (byte *)_screen->pixels + (_screenWidth - 1);
src = dst - dx;
for (y = 0; y < height; y++) {
for (x = dx; x < _screenWidth; x++) {
*dst-- = *src--;
}
src += _screenWidth + (_screenWidth - dx);
dst += _screenWidth + (_screenWidth - dx);
}
} else if (dx < 0) {
// move left - copy from left to right
dst = (byte *)_screen->pixels;
src = dst - dx;
for (y = 0; y < height; y++) {
for (x = -dx; x < _screenWidth; x++) {
*dst++ = *src++;
}
src += _screenWidth - (_screenWidth + dx);
dst += _screenWidth - (_screenWidth + dx);
}
}
// Unlock the screen surface
SDL_UnlockSurface(_screen);
}
void OSystem_SDL::set_shake_pos(int shake_pos) {
_newShakePos = shake_pos;
}