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

@ -74,10 +74,6 @@ public:
// The screen will not be updated to reflect the new bitmap // The screen will not be updated to reflect the new bitmap
void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h); void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
// Moves the screen content around by the given amount of pixels
// but only the top height pixel rows, the rest stays untouched
void move_screen(int dx, int dy, int height);
// Update the dirty areas of the screen // Update the dirty areas of the screen
void updateScreen(); void updateScreen();

View file

@ -583,65 +583,6 @@ void OSystem_PALMOS::updateScreen() {
((this)->*(_renderer_proc))(); ((this)->*(_renderer_proc))();
} }
void OSystem_PALMOS::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;
// Hide the mouse
if (_mouseDrawn)
undraw_mouse();
RectangleType r, dummy;
WinSetDrawWindow(_offScreenH);
RctSetRectangle(&r, ((_offScreenH != _screenH) ? 0 : _screenOffset.x), ((_offScreenH != _screenH) ? 0 : _screenOffset.y), _screenWidth, _screenHeight);
// vertical movement
if (dy > 0) {
// move down - copy from bottom to top
if (_useHRmode) {
// need to set the draw window
HRWinScrollRectangle(gVars->HRrefNum, &r, winDown, dy, &dummy);
} else {
WinScrollRectangle(&r, winDown, dy, &dummy);
}
} else if (dy < 0) {
// move up - copy from top to bottom
dy = -dy;
if (_useHRmode) {
// need to set the draw window
HRWinScrollRectangle(gVars->HRrefNum, &r, winUp, dy, &dummy);
} else {
WinScrollRectangle(&r, winUp, dy, &dummy);
}
}
// horizontal movement
if (dx > 0) {
// move right - copy from right to left
if (_useHRmode) {
// need to set the draw window
HRWinScrollRectangle(gVars->HRrefNum, &r, winRight, dx, &dummy);
} else {
WinScrollRectangle(&r, winRight, dx, &dummy);
}
} else if (dx < 0) {
// move left - copy from left to right
dx = -dx;
if (_useHRmode) {
// need to set the draw window
HRWinScrollRectangle(gVars->HRrefNum, &r, winLeft, dx, &dummy);
} else {
WinScrollRectangle(&r, winLeft, dx, &dummy);
}
}
WinSetDrawWindow(_screenH);
// Prevent crash on Clie device using successive [HR]WinScrollRectangle !
SysTaskDelay(1);
}
void OSystem_PALMOS::draw1BitGfx(UInt16 id, Int32 x, Int32 y, Boolean show) { void OSystem_PALMOS::draw1BitGfx(UInt16 id, Int32 x, Int32 y, Boolean show) {
if (OPTIONS_TST(kOptDisableOnScrDisp)) if (OPTIONS_TST(kOptDisableOnScrDisp))
return; return;

View file

@ -73,7 +73,6 @@ class OSystem_Dreamcast : public OSystem {
// Draw a bitmap to screen. // Draw a bitmap to screen.
// The screen will not be updated to reflect the new bitmap // The screen will not be updated to reflect the new bitmap
void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h); void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
void move_screen(int dx, int dy, int height);
// Update the dirty areas of the screen // Update the dirty areas of the screen
void updateScreen(); void updateScreen();

View file

@ -206,46 +206,6 @@ void OSystem_Dreamcast::copyRectToScreen(const byte *buf, int pitch, int x, int
_screen_dirty = true; _screen_dirty = true;
} }
void OSystem_Dreamcast::move_screen(int dx, int dy, int height) {
if ((dx == 0) && (dy == 0))
return;
if (dx == 0) {
// vertical movement
if (dy > 0) {
// move down
// copy from bottom to top
for (int y = height - 1; y >= dy; y--)
copyRectToScreen(screen + SCREEN_W * (y - dy), SCREEN_W, 0, y, _screen_w, 1);
} else {
// move up
// copy from top to bottom
for (int y = 0; y < height + dx; y++)
copyRectToScreen(screen + SCREEN_W * (y - dy), SCREEN_W, 0, y, _screen_w, 1);
}
} else if (dy == 0) {
// horizontal movement
if (dx > 0) {
// move right
// copy from right to left
for (int x = _screen_w - 1; x >= dx; x--)
copyRectToScreen(screen + x - dx, SCREEN_W, x, 0, 1, height);
} else {
// move left
// copy from left to right
for (int x = 0; x < _screen_w; x++)
copyRectToScreen(screen + x - dx, SCREEN_W, x, 0, 1, height);
}
} else {
// free movement
// not necessary for now
}
_screen_dirty = true;
}
bool OSystem_Dreamcast::showMouse(bool visible) bool OSystem_Dreamcast::showMouse(bool visible)
{ {
bool last = _ms_visible; bool last = _ms_visible;

View file

@ -350,44 +350,6 @@ int SDL_SetColors(SDL_Surface *surface, SDL_Color *colors, int firstcolor, int n
return 1; return 1;
} }
// Moves the screen content around by the given amount of pixels
// but only the top height pixel rows, the rest stays untouched
void OSystem_GP32::move_screen(int dx, int dy, int height) {
if ((dx == 0) && (dy == 0))
return;
if (dx == 0) {
// vertical movement
if (dy > 0) {
// move down
// copy from bottom to top
for (int y = height - 1; y >= dy; y--)
copyRectToScreen((byte *)_screen->pixels + _screenWidth * (y - dy), _screenWidth, 0, y, _screenWidth, 1);
} else {
// move up
// copy from top to bottom
for (int y = 0; y < height + dx; y++)
copyRectToScreen((byte *)_screen->pixels + _screenWidth * (y - dy), _screenWidth, 0, y, _screenWidth, 1);
}
} else if (dy == 0) {
// horizontal movement
if (dx > 0) {
// move right
// copy from right to left
for (int x = _screenWidth - 1; x >= dx; x--)
copyRectToScreen((byte *)_screen->pixels + x - dx, _screenWidth, x, 0, 1, height);
} else {
// move left
// copy from left to right
for (int x = 0; x < _screenWidth; x++)
copyRectToScreen((byte *)_screen->pixels + x - dx, _screenWidth, x, 0, 1, height);
}
} else {
// free movement
// not necessary for now
}
}
void OSystem_GP32::load_gfx_mode() { void OSystem_GP32::load_gfx_mode() {
GpRectFill(NULL,&gpDraw[GAME_SURFACE], 0, 0, 320, 240, 0); //black border GpRectFill(NULL,&gpDraw[GAME_SURFACE], 0, 0, 320, 240, 0); //black border

View file

@ -47,10 +47,6 @@ public:
// The screen will not be updated to reflect the new bitmap // The screen will not be updated to reflect the new bitmap
void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h); void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
// Moves the screen content around by the given amount of pixels
// but only the top height pixel rows, the rest stays untouched
void move_screen(int dx, int dy, int height);
// Update the dirty areas of the screen // Update the dirty areas of the screen
void updateScreen(); void updateScreen();

View file

@ -1103,48 +1103,6 @@ void OSystem_MorphOS::copyRectToScreen(const byte *src, int pitch, int x, int y,
} }
} }
void OSystem_MorphOS::move_screen(int dx, int dy, int height) {
if ((dx == 0) && (dy == 0))
return;
UpdateRects = 26;
Rectangle update_rect = { 0, 0, ScummBufferWidth, ScummBufferHeight };
OrRectRegion(NewUpdateRegion, &update_rect);
ScreenChanged = true;
UndrawMouse();
// vertical movement
if (dy > 0) {
// move down
// copy from bottom to top
for (int y = height - 1; y >= dy; y--)
copyRectToScreen((byte *)ScummBuffer + ScummBufferWidth * (y - dy), ScummBufferWidth, 0, y, ScummBufferWidth, 1);
} else if (dy < 0) {
// move up
// copy from top to bottom
dy = -dy;
for (int y = dy; y < height; y++)
copyRectToScreen((byte *)ScummBuffer + ScummBufferWidth * y, ScummBufferWidth, 0, y - dy, ScummBufferWidth, 1);
}
// horizontal movement
if (dx > 0) {
// move right
// copy from right to left
for (int x = ScummBufferWidth - 1; x >= dx; x--)
copyRectToScreen((byte *)ScummBuffer + x - dx, ScummBufferWidth, x, 0, 1, height);
} else if (dx < 0) {
// move left
// copy from left to right
dx = -dx;
for (int x = dx; x < ScummBufferWidth; x++)
copyRectToScreen((byte *)ScummBuffer + x, ScummBufferWidth, x, 0, 1, height);
}
}
bool OSystem_MorphOS::AddUpdateRect(WORD x, WORD y, WORD w, WORD h) bool OSystem_MorphOS::AddUpdateRect(WORD x, WORD y, WORD w, WORD h)
{ {
if (UpdateRects > 25) if (UpdateRects > 25)

View file

@ -52,7 +52,6 @@ class OSystem_MorphOS : public OSystem
// Draw a bitmap to screen. // Draw a bitmap to screen.
// The screen will not be updated to reflect the new bitmap // The screen will not be updated to reflect the new bitmap
virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h); virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
void move_screen(int dx, int dy, int height);
// Update the dirty areas of the screen // Update the dirty areas of the screen
virtual void updateScreen(); virtual void updateScreen();

View file

@ -52,7 +52,6 @@ public:
virtual void setPalette(const byte *colors, uint start, uint num); virtual void setPalette(const byte *colors, uint start, uint num);
virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h); virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
virtual void updateScreen(); virtual void updateScreen();
virtual void move_screen(int dx, int dy, int height);
virtual void set_shake_pos(int shakeOffset); virtual void set_shake_pos(int shakeOffset);
virtual void showOverlay(); virtual void showOverlay();
@ -181,10 +180,6 @@ void OSystem_NULL::updateScreen()
{ {
} }
void OSystem_NULL::move_screen(int dx, int dy, int height)
{
}
void OSystem_NULL::set_shake_pos(int shakeOffset) void OSystem_NULL::set_shake_pos(int shakeOffset)
{ {
} }

View file

@ -720,77 +720,6 @@ void OSystem_SDL::setPalette(const byte *colors, uint start, uint num) {
_paletteDirtyEnd = start + 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) { void OSystem_SDL::set_shake_pos(int shake_pos) {
_newShakePos = shake_pos; _newShakePos = shake_pos;
} }

View file

@ -52,8 +52,6 @@ public:
// The screen will not be updated to reflect the new bitmap // The screen will not be updated to reflect the new bitmap
void copyRectToScreen(const byte *src, int pitch, int x, int y, int w, int h); void copyRectToScreen(const byte *src, int pitch, int x, int y, int w, int h);
void move_screen(int dx, int dy, int height);
// Update the dirty areas of the screen // Update the dirty areas of the screen
void updateScreen(); void updateScreen();

View file

@ -90,8 +90,6 @@ public:
// The screen will not be updated to reflect the new bitmap // The screen will not be updated to reflect the new bitmap
void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h); void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
void move_screen(int dx, int dy, int height);
// Update the dirty areas of the screen // Update the dirty areas of the screen
void updateScreen(); void updateScreen();
@ -577,43 +575,6 @@ void OSystem_X11::copyRectToScreen(const byte *buf, int pitch, int x, int y, int
} }
} }
void OSystem_X11::move_screen(int dx, int dy, int height) {
if ((dx == 0) && (dy == 0))
return;
if (dx == 0) {
// vertical movement
if (dy > 0) {
// move down
// copy from bottom to top
for (int y = height - 1; y >= dy; y--)
copyRectToScreen(local_fb + fb_width * (y - dy), fb_width, 0, y, fb_width, 1);
} else {
// move up
// copy from top to bottom
for (int y = 0; y < height + dx; y++)
copyRectToScreen(local_fb + fb_width * (y - dy), fb_width, 0, y, fb_width, 1);
}
} else if (dy == 0) {
// horizontal movement
if (dx > 0) {
// move right
// copy from right to left
for (int x = fb_width - 1; x >= dx; x--)
copyRectToScreen(local_fb + x - dx, fb_width, x, 0, 1, height);
} else {
// move left
// copy from left to right
for (int x = 0; x < fb_width; x++)
copyRectToScreen(local_fb + x - dx, fb_width, x, 0, 1, height);
}
} else {
// free movement
// not necessary for now
}
}
void OSystem_X11::blit_convert(const dirty_square * d, uint16 *dst, int pitch) { void OSystem_X11::blit_convert(const dirty_square * d, uint16 *dst, int pitch) {
uint8 *ptr_src = local_fb + (fb_width * d->y) + d->x; uint8 *ptr_src = local_fb + (fb_width * d->y) + d->x;
uint16 *ptr_dst = dst + (fb_width * d->y) + d->x; uint16 *ptr_dst = dst + (fb_width * d->y) + d->x;

View file

@ -264,19 +264,6 @@ public:
/** Update the dirty areas of the screen. */ /** Update the dirty areas of the screen. */
virtual void updateScreen() = 0; virtual void updateScreen() = 0;
/**
* Moves the screen content by the offset specified via dx/dy.
* Only the region from x=0 till x=height-1 is affected.
* @param dx the horizontal offset.
* @param dy the vertical offset.
* @param height the number of lines which in which the move will be done.
*
* @todo This is a rather special screen effect, only used by the SCUMM
* frontend - we should consider removing it from the backend API
* and instead implement the functionality in the frontend.
*/
virtual void move_screen(int dx, int dy, int height) = 0;
/** /**
* Set current shake position, a feature needed for some SCUMM screen effects. * Set current shake position, a feature needed for some SCUMM screen effects.
* The effect causes the displayed graphics to be shifted upwards by the specified * The effect causes the displayed graphics to be shifted upwards by the specified

View file

@ -372,7 +372,7 @@ void ScummEngine::drawDirtyScreenParts() {
_system->set_shake_pos(shake_positions[_shakeFrame]); _system->set_shake_pos(shake_positions[_shakeFrame]);
} else if (!_shakeEnabled &&_shakeFrame != 0) { } else if (!_shakeEnabled &&_shakeFrame != 0) {
_shakeFrame = 0; _shakeFrame = 0;
_system->set_shake_pos(shake_positions[_shakeFrame]); _system->set_shake_pos(0);
} }
} }
@ -2790,13 +2790,12 @@ void ScummEngine::scrollEffect(int dir) {
switch (dir) { switch (dir) {
case 0: case 0:
//up //up
y = 1 + step; y = step;
while (y < vs->h) { while (y < vs->h) {
_system->move_screen(0, -step, vs->h); _system->copyRectToScreen(vs->getPixels(0, 0),
_system->copyRectToScreen(vs->getPixels(0, y - step),
vs->pitch, vs->pitch,
0, vs->h - step, 0, vs->h - y,
vs->w, step); vs->w, y);
_system->updateScreen(); _system->updateScreen();
waitForTimer(kPictureDelay); waitForTimer(kPictureDelay);
@ -2805,13 +2804,12 @@ void ScummEngine::scrollEffect(int dir) {
break; break;
case 1: case 1:
// down // down
y = 1 + step; y = step;
while (y < vs->h) { while (y < vs->h) {
_system->move_screen(0, step, vs->h);
_system->copyRectToScreen(vs->getPixels(0, vs->h - y), _system->copyRectToScreen(vs->getPixels(0, vs->h - y),
vs->pitch, vs->pitch,
0, 0, 0, 0,
vs->w, step); vs->w, y);
_system->updateScreen(); _system->updateScreen();
waitForTimer(kPictureDelay); waitForTimer(kPictureDelay);
@ -2820,13 +2818,12 @@ void ScummEngine::scrollEffect(int dir) {
break; break;
case 2: case 2:
// left // left
x = 1 + step; x = step;
while (x < vs->w) { while (x < vs->w) {
_system->move_screen(-step, 0, vs->h); _system->copyRectToScreen(vs->getPixels(0, 0),
_system->copyRectToScreen(vs->getPixels(x - step, 0),
vs->pitch, vs->pitch,
vs->w - step, 0, vs->w - x, 0,
step, vs->h); x, vs->h);
_system->updateScreen(); _system->updateScreen();
waitForTimer(kPictureDelay); waitForTimer(kPictureDelay);
@ -2835,13 +2832,12 @@ void ScummEngine::scrollEffect(int dir) {
break; break;
case 3: case 3:
// right // right
x = 1 + step; x = step;
while (x < vs->w) { while (x < vs->w) {
_system->move_screen(step, 0, vs->h);
_system->copyRectToScreen(vs->getPixels(vs->w - x, 0), _system->copyRectToScreen(vs->getPixels(vs->w - x, 0),
vs->pitch, vs->pitch,
0, 0, 0, 0,
step, vs->h); x, vs->h);
_system->updateScreen(); _system->updateScreen();
waitForTimer(kPictureDelay); waitForTimer(kPictureDelay);