From 45020d301289168d9269c4969dd1489e5e51ef54 Mon Sep 17 00:00:00 2001 From: Strangerke <strangerke@scummvm.org> Date: Sat, 5 Jan 2013 16:02:25 +0100 Subject: [PATCH] HOPKINS: Refactor copy16bFromSurfaceScaleX2 --- engines/hopkins/graphics.cpp | 37 +++++++++++++++++------------------- engines/hopkins/graphics.h | 2 +- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 5e450989986..3820dbb5c1d 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -170,7 +170,7 @@ void GraphicsManager::loadVgaImage(const Common::String &file) { max_x = 320; lockScreen(); - copy16bToSurfaceScaleX2(_vesaBuffer); + copy16bFromSurfaceScaleX2(_vesaBuffer); unlockScreen(); fadeInBreakout(); @@ -683,7 +683,7 @@ void GraphicsManager::fadeOutDefaultLength(const byte *surface) { void GraphicsManager::fadeInBreakout() { setpal_vga256(_palette); lockScreen(); - copy16bToSurfaceScaleX2(_vesaBuffer); + copy16bFromSurfaceScaleX2(_vesaBuffer); unlockScreen(); DD_VBL(); } @@ -698,7 +698,7 @@ void GraphicsManager::fateOutBreakout() { setpal_vga256(palette); lockScreen(); - copy16bToSurfaceScaleX2(_vesaBuffer); + copy16bFromSurfaceScaleX2(_vesaBuffer); unlockScreen(); DD_VBL(); } @@ -1203,29 +1203,26 @@ void GraphicsManager::AFFICHE_SPEEDVGA(const byte *objectData, int xp, int yp, i } /** - * Copy to surface to video buffer, scale 2x. + * Copy from surface to video buffer, scale 2x. */ -void GraphicsManager::copy16bToSurfaceScaleX2(const byte *surface) { - const byte *v1; - byte *v2; - byte *v6; - int v; - byte *v10; +void GraphicsManager::copy16bFromSurfaceScaleX2(const byte *surface) { + byte *palPtr; + int curPixel; assert(_videoPtr); - v1 = surface; - v2 = 30 * WinScan + (byte *)_videoPtr->pixels; + const byte *curSurface = surface; + byte *destPtr = 30 * WinScan + (byte *)_videoPtr->pixels; for (int y = 200; y; y--) { - v10 = v2; + byte *oldDestPtr = destPtr; for (int x = 320; x; x--) { - v = 2 * *v1; - v6 = PAL_PIXELS + v; - v2[0] = v2[2] = v2[WinScan] = v2[WinScan + 2] = v6[0]; - v2[1] = v2[3] = v2[WinScan + 1] = v2[WinScan + 3] = v6[1]; - ++v1; - v2 += 4; + curPixel = 2 * *curSurface; + palPtr = PAL_PIXELS + curPixel; + destPtr[0] = destPtr[2] = destPtr[WinScan] = destPtr[WinScan + 2] = palPtr[0]; + destPtr[1] = destPtr[3] = destPtr[WinScan + 1] = destPtr[WinScan + 3] = palPtr[1]; + ++curSurface; + destPtr += 4; } - v2 = WinScan * 2 + v10; + destPtr = WinScan * 2 + oldDestPtr; } } diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 513e9eea054..c0faa466f8b 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -154,7 +154,7 @@ public: void displayVesaSegment(); void AFFICHE_SPEEDVGA(const byte *objectData, int xp, int yp, int idx); void CopyAsm(const byte *surface); - void copy16bToSurfaceScaleX2(const byte *surface); + void copy16bFromSurfaceScaleX2(const byte *surface); void Restore_Mem(byte *destSurface, const byte *src, int xp, int yp, int width, int height); int zoomIn(int v, int percentage); int zoomOut(int v, int percentage);