From 68520809162c8e0212a4ae10fb178a21339fb87f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 14 Mar 2009 15:43:37 +0000 Subject: Merged loadRGBPalette() inside setRGBPalette() (that's the only place it's used and where the screen palette is set). Added a wrapper for copyRectToScreen(), to remove some duplicated code inside the ScreenEffects() class svn-id: r39396 --- engines/made/screen.cpp | 9 +++++---- engines/made/screen.h | 2 +- engines/made/screenfx.cpp | 10 +--------- 3 files changed, 7 insertions(+), 14 deletions(-) (limited to 'engines') diff --git a/engines/made/screen.cpp b/engines/made/screen.cpp index 6fb7804753..d55b663296 100644 --- a/engines/made/screen.cpp +++ b/engines/made/screen.cpp @@ -218,17 +218,14 @@ void Screen::drawSurface(Graphics::Surface *sourceSurface, int x, int y, int16 f } -void Screen::loadRGBPalette(byte *palRGB, int count) { +void Screen::setRGBPalette(byte *palRGB, int start, int count) { for (int i = 0; i < count; i++) { _screenPalette[i * 4 + 0] = palRGB[i * 3 + 0]; _screenPalette[i * 4 + 1] = palRGB[i * 3 + 1]; _screenPalette[i * 4 + 2] = palRGB[i * 3 + 2]; _screenPalette[i * 4 + 3] = 0; } -} -void Screen::setRGBPalette(byte *palRGB, int start, int count) { - loadRGBPalette(palRGB, count); _vm->_system->setPalette(_screenPalette, start, count); } @@ -803,6 +800,10 @@ void Screen::showWorkScreen() { _vm->_system->copyRectToScreen((const byte*)_workScreen->pixels, _workScreen->pitch, 0, 0, _workScreen->w, _workScreen->h); } +void Screen::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) { + _vm->_system->copyRectToScreen(buf, pitch, x, y, w, h); +} + void Screen::updateScreenAndWait(int delay) { _vm->_system->updateScreen(); uint32 startTime = _vm->_system->getMillis(); diff --git a/engines/made/screen.h b/engines/made/screen.h index 47fe779625..ed4a526a60 100644 --- a/engines/made/screen.h +++ b/engines/made/screen.h @@ -91,7 +91,6 @@ public: void drawSurface(Graphics::Surface *sourceSurface, int x, int y, int16 flipX, int16 flipY, int16 mask, const ClipInfo &clipInfo); - void loadRGBPalette(byte *palRGB, int count = 256); void setRGBPalette(byte *palRGB, int start = 0, int count = 256); bool isPaletteLocked() { return _paletteLock; } void setPaletteLock(bool lock) { _paletteLock = lock; } @@ -188,6 +187,7 @@ public: Graphics::Surface *lockScreen(); void unlockScreen(); void showWorkScreen(); + void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h); void updateScreenAndWait(int delay); int16 addToSpriteList(int16 index, int16 xofs, int16 yofs); diff --git a/engines/made/screenfx.cpp b/engines/made/screenfx.cpp index 02a74374ab..1473d89c7b 100644 --- a/engines/made/screenfx.cpp +++ b/engines/made/screenfx.cpp @@ -268,15 +268,7 @@ void ScreenEffects::copyRect(Graphics::Surface *surface, int16 x1, int16 y1, int if (xd == -1) xd = x1; if (yd == -1) yd = y1; - Graphics::Surface *vgaScreen = _screen->lockScreen(); - byte *source = (byte*)surface->getBasePtr(x1, y1); - byte *dest = (byte*)vgaScreen->getBasePtr(xd, yd); - for (int y = 0; y < y2 - y1; y++) { - memcpy(dest, source, x2 - x1); - dest += 320; - source += 320; - } - _screen->unlockScreen(); + _screen->copyRectToScreen((const byte*)surface->pixels, surface->pitch, xd, yd, surface->w, surface->h); } void ScreenEffects::reposition(int16 x1, int16 y1, int16 x2, int16 y2, int xd, int yd) { -- cgit v1.2.3