From c05cb7f3bbcf4d64d4a938e0eb42065d8f3d3038 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 2 Aug 2013 22:23:00 +0200 Subject: SCUMM: Prefer getBasePtr over direct Surface::pixels access. --- engines/scumm/gfx.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'engines/scumm/gfx.cpp') diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp index 50ff0b3988..41899da0a3 100644 --- a/engines/scumm/gfx.cpp +++ b/engines/scumm/gfx.cpp @@ -422,7 +422,7 @@ void ScummEngine::initVirtScreen(VirtScreenNumber slot, int top, int width, int _res->createResource(rtBuffer, slot + 1, size); vs->pixels = getResourceAddress(rtBuffer, slot + 1); - memset(vs->pixels, 0, size); // reset background + memset(vs->getPixels(0, 0), 0, size); // reset background if (twobufs) { vs->backBuf = _res->createResource(rtBuffer, slot + 5, size); @@ -612,7 +612,7 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i // Some paranoia checks assert(top >= 0 && bottom <= vs->h); assert(x >= 0 && width <= vs->pitch); - assert(_textSurface.pixels); + assert(_textSurface.getBasePtr(0, 0)); // Perform some clipping if (width > vs->w - x) @@ -1135,7 +1135,7 @@ void ScummEngine::clearTextSurface() { _townsScreen->fillLayerRect(1, 0, 0, _textSurface.w, _textSurface.h, 0); #endif - fill((byte *)_textSurface.pixels, _textSurface.pitch, + fill((byte *)_textSurface.getBasePtr(0, 0), _textSurface.pitch, #ifndef DISABLE_TOWNS_DUAL_LAYER_MODE _game.platform == Common::kPlatformFMTowns ? 0 : #endif @@ -1590,7 +1590,7 @@ void GdiV2::prepareDrawBitmap(const byte *ptr, VirtScreen *vs, if (vs->hasTwoBuffers) dst = vs->backBuf + y * vs->pitch + x * 8; else - dst = (byte *)vs->pixels + y * vs->pitch + x * 8; + dst = (byte *)vs->getPixels(x * 8, y); mask_ptr = getMaskBuffer(x, y, 1); @@ -1827,7 +1827,7 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, const int y, const if (vs->hasTwoBuffers) dstPtr = vs->backBuf + y * vs->pitch + (x * 8 * vs->format.bytesPerPixel); else - dstPtr = (byte *)vs->pixels + y * vs->pitch + (x * 8 * vs->format.bytesPerPixel); + dstPtr = (byte *)vs->getPixels(x * 8, y); transpStrip = drawStrip(dstPtr, vs, x, y, width, height, stripnr, smap_ptr); @@ -1836,7 +1836,7 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, const int y, const transpStrip = true; if (vs->hasTwoBuffers) { - byte *frontBuf = (byte *)vs->pixels + y * vs->pitch + (x * 8 * vs->format.bytesPerPixel); + byte *frontBuf = (byte *)vs->getPixels(x * 8, y); if (lightsOn) copy8Col(frontBuf, vs->pitch, dstPtr, height, vs->format.bytesPerPixel); else @@ -2262,7 +2262,7 @@ void Gdi::resetBackground(int top, int bottom, int strip) { vs->bdirty[strip] = bottom; bgbak_ptr = (byte *)vs->backBuf + top * vs->pitch + (strip + vs->xstart/8) * 8 * vs->format.bytesPerPixel; - backbuff_ptr = (byte *)vs->pixels + top * vs->pitch + (strip + vs->xstart/8) * 8 * vs->format.bytesPerPixel; + backbuff_ptr = (byte *)vs->getPixels((strip + vs->xstart/8) * 8, top); numLinesToProcess = bottom - top; if (numLinesToProcess) { -- cgit v1.2.3 From 0a1cbac76ac66876d187d2951c671a86a4812a59 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:36:43 +0200 Subject: SCUMM: Take advantage of Surface::getPixels. --- engines/scumm/gfx.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/scumm/gfx.cpp') diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp index 41899da0a3..3da07610eb 100644 --- a/engines/scumm/gfx.cpp +++ b/engines/scumm/gfx.cpp @@ -612,7 +612,7 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i // Some paranoia checks assert(top >= 0 && bottom <= vs->h); assert(x >= 0 && width <= vs->pitch); - assert(_textSurface.getBasePtr(0, 0)); + assert(_textSurface.getPixels()); // Perform some clipping if (width > vs->w - x) @@ -1135,7 +1135,7 @@ void ScummEngine::clearTextSurface() { _townsScreen->fillLayerRect(1, 0, 0, _textSurface.w, _textSurface.h, 0); #endif - fill((byte *)_textSurface.getBasePtr(0, 0), _textSurface.pitch, + fill((byte *)_textSurface.getPixels(), _textSurface.pitch, #ifndef DISABLE_TOWNS_DUAL_LAYER_MODE _game.platform == Common::kPlatformFMTowns ? 0 : #endif -- cgit v1.2.3 From c22d91405429ad9866c6340939943aa21cd49d03 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 03:48:41 +0200 Subject: SCUMM: Do not set Surface::pixels directly anymore. --- engines/scumm/gfx.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/scumm/gfx.cpp') diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp index 3da07610eb..57436dc03c 100644 --- a/engines/scumm/gfx.cpp +++ b/engines/scumm/gfx.cpp @@ -421,7 +421,7 @@ void ScummEngine::initVirtScreen(VirtScreenNumber slot, int top, int width, int } _res->createResource(rtBuffer, slot + 1, size); - vs->pixels = getResourceAddress(rtBuffer, slot + 1); + vs->setPixels(getResourceAddress(rtBuffer, slot + 1)); memset(vs->getPixels(0, 0), 0, size); // reset background if (twobufs) { -- cgit v1.2.3 From 6485b291e9080acbd2e3d29a1bbaf7da9e79568d Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 4 Aug 2013 02:29:13 +0200 Subject: SCUMM: Fix Loom (and some other graphics regressions). These are regressions from c05cb7f3bbcf4d64d4a938e0eb42065d8f3d3038. They were caused by VirtualScreen::getPixels differing from Surface::getBasePtr and I accidently used the former in some cases in the conversion. I also fixed a bug in debugger.cpp which exchanged x and y. --- engines/scumm/gfx.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'engines/scumm/gfx.cpp') diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp index 57436dc03c..4c1fdaf673 100644 --- a/engines/scumm/gfx.cpp +++ b/engines/scumm/gfx.cpp @@ -422,7 +422,7 @@ void ScummEngine::initVirtScreen(VirtScreenNumber slot, int top, int width, int _res->createResource(rtBuffer, slot + 1, size); vs->setPixels(getResourceAddress(rtBuffer, slot + 1)); - memset(vs->getPixels(0, 0), 0, size); // reset background + memset(vs->getBasePtr(0, 0), 0, size); // reset background if (twobufs) { vs->backBuf = _res->createResource(rtBuffer, slot + 5, size); @@ -1590,7 +1590,7 @@ void GdiV2::prepareDrawBitmap(const byte *ptr, VirtScreen *vs, if (vs->hasTwoBuffers) dst = vs->backBuf + y * vs->pitch + x * 8; else - dst = (byte *)vs->getPixels(x * 8, y); + dst = (byte *)vs->getBasePtr(x * 8, y); mask_ptr = getMaskBuffer(x, y, 1); @@ -1827,7 +1827,7 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, const int y, const if (vs->hasTwoBuffers) dstPtr = vs->backBuf + y * vs->pitch + (x * 8 * vs->format.bytesPerPixel); else - dstPtr = (byte *)vs->getPixels(x * 8, y); + dstPtr = (byte *)vs->getBasePtr(x * 8, y); transpStrip = drawStrip(dstPtr, vs, x, y, width, height, stripnr, smap_ptr); @@ -1836,7 +1836,7 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, const int y, const transpStrip = true; if (vs->hasTwoBuffers) { - byte *frontBuf = (byte *)vs->getPixels(x * 8, y); + byte *frontBuf = (byte *)vs->getBasePtr(x * 8, y); if (lightsOn) copy8Col(frontBuf, vs->pitch, dstPtr, height, vs->format.bytesPerPixel); else @@ -2262,7 +2262,7 @@ void Gdi::resetBackground(int top, int bottom, int strip) { vs->bdirty[strip] = bottom; bgbak_ptr = (byte *)vs->backBuf + top * vs->pitch + (strip + vs->xstart/8) * 8 * vs->format.bytesPerPixel; - backbuff_ptr = (byte *)vs->getPixels((strip + vs->xstart/8) * 8, top); + backbuff_ptr = (byte *)vs->getBasePtr((strip + vs->xstart/8) * 8, top); numLinesToProcess = bottom - top; if (numLinesToProcess) { -- cgit v1.2.3