From ccaf4d865c46402f9e5d800956c414fd134b5dc9 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:41:03 +0200 Subject: PARALLACTION: Take advantage of Surface::getPixels. --- engines/parallaction/disk_br.cpp | 8 ++++---- engines/parallaction/disk_ns.cpp | 6 +++--- engines/parallaction/graphics.cpp | 12 ++++++------ engines/parallaction/input.cpp | 2 +- engines/parallaction/inventory.h | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) (limited to 'engines') diff --git a/engines/parallaction/disk_br.cpp b/engines/parallaction/disk_br.cpp index dfb8bded87..f648f4b9a1 100644 --- a/engines/parallaction/disk_br.cpp +++ b/engines/parallaction/disk_br.cpp @@ -225,7 +225,7 @@ void DosDisk_br::loadBitmap(Common::SeekableReadStream &stream, Graphics::Surfac } surf.create(width, height, Graphics::PixelFormat::createFormatCLUT8()); - stream.read(surf.getBasePtr(0, 0), width * height); + stream.read(surf.getPixels(), width * height); } Frames* DosDisk_br::loadPointer(const char *name) { @@ -449,7 +449,7 @@ void AmigaDisk_br::init() { void AmigaDisk_br::adjustForPalette(Graphics::Surface &surf, int transparentColor) { uint size = surf.w * surf.h; - byte *data = (byte *)surf.getBasePtr(0, 0); + byte *data = (byte *)surf.getPixels(); for (uint i = 0; i < size; i++, data++) { if (transparentColor == -1 || transparentColor != *data) *data += 16; @@ -552,7 +552,7 @@ MaskBuffer *AmigaDisk_br::loadMask(const char *name, uint32 w, uint32 h) { MaskBuffer *buffer = new MaskBuffer; // surface width was shrunk to 1/4th of the bitmap width due to the pixel packing buffer->create(decoder.getSurface()->w * 4, decoder.getSurface()->h); - memcpy(buffer->data, decoder.getSurface()->getBasePtr(0, 0), buffer->size); + memcpy(buffer->data, decoder.getSurface()->getPixels(), buffer->size); buffer->bigEndian = true; finalpass(buffer->data, buffer->size); return buffer; @@ -612,7 +612,7 @@ GfxObj* AmigaDisk_br::loadStatic(const char* name) { stream->read(shadow, shadowSize); for (int32 i = 0; i < surf->h; ++i) { byte *src = shadow + shadowWidth * i; - byte *dst = (byte *)surf->getBasePtr(0, 0) + surf->pitch * i; + byte *dst = (byte *)surf->getPixels() + surf->pitch * i; for (int32 j = 0; j < surf->w; ++j, ++dst) { byte bit = src[j/8] & (1 << (7 - (j & 7))); diff --git a/engines/parallaction/disk_ns.cpp b/engines/parallaction/disk_ns.cpp index 45f7100f80..ae28e864a9 100644 --- a/engines/parallaction/disk_ns.cpp +++ b/engines/parallaction/disk_ns.cpp @@ -482,7 +482,7 @@ void DosDisk_ns::loadBackground(BackgroundInfo& info, const char *filename) { // read bitmap, mask and path data and extract them into the 3 buffers info.bg.create(info.width, info.height, Graphics::PixelFormat::createFormatCLUT8()); createMaskAndPathBuffers(info); - unpackBackground(stream, (byte *)info.bg.getBasePtr(0, 0), info._mask->data, info._path->data); + unpackBackground(stream, (byte *)info.bg.getPixels(), info._mask->data, info._path->data); delete stream; } @@ -976,7 +976,7 @@ void AmigaDisk_ns::loadMask_internal(BackgroundInfo& info, const char *name) { info._mask = new MaskBuffer; // surface width was shrunk to 1/4th of the bitmap width due to the pixel packing info._mask->create(decoder.getSurface()->w * 4, decoder.getSurface()->h); - memcpy(info._mask->data, decoder.getSurface()->getBasePtr(0, 0), info._mask->size); + memcpy(info._mask->data, decoder.getSurface()->getPixels(), info._mask->size); info._mask->bigEndian = true; } @@ -998,7 +998,7 @@ void AmigaDisk_ns::loadPath_internal(BackgroundInfo& info, const char *name) { info._path = new PathBuffer; // surface width was shrunk to 1/8th of the bitmap width due to the pixel packing info._path->create(decoder.getSurface()->w * 8, decoder.getSurface()->h); - memcpy(info._path->data, decoder.getSurface()->getBasePtr(0, 0), info._path->size); + memcpy(info._path->data, decoder.getSurface()->getPixels(), info._path->size); info._path->bigEndian = true; } diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp index 0aaf78ec13..3f36d56420 100644 --- a/engines/parallaction/graphics.cpp +++ b/engines/parallaction/graphics.cpp @@ -332,7 +332,7 @@ void Gfx::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int void Gfx::clearScreen() { if (_doubleBuffering) { - if (_backBuffer.getBasePtr(0, 0)) { + if (_backBuffer.getPixels()) { Common::Rect r(_backBuffer.w, _backBuffer.h); _backBuffer.fillRect(r, 0); } @@ -419,13 +419,13 @@ void Gfx::updateScreen() { // is needed _overlayMode = false; - bool skipBackground = (_backgroundInfo->bg.getBasePtr(0, 0) == 0); // don't render frame if background is missing + bool skipBackground = (_backgroundInfo->bg.getPixels() == 0); // don't render frame if background is missing if (!skipBackground) { // background may not cover the whole screen, so adjust bulk update size uint w = _backgroundInfo->width; uint h = _backgroundInfo->height; - byte *backgroundData = (byte *)_backgroundInfo->bg.getBasePtr(0, 0); + byte *backgroundData = (byte *)_backgroundInfo->bg.getPixels(); uint16 backgroundPitch = _backgroundInfo->bg.pitch; copyRectToScreen(backgroundData, backgroundPitch, _backgroundInfo->_x, _backgroundInfo->_y, w, h); } @@ -450,7 +450,7 @@ void Gfx::applyHalfbriteEffect_NS(Graphics::Surface &surf) { return; } - byte *buf = (byte *)surf.getBasePtr(0, 0); + byte *buf = (byte *)surf.getPixels(); for (int i = 0; i < surf.w*surf.h; i++) { *buf++ |= 0x20; } @@ -493,7 +493,7 @@ void Gfx::patchBackground(Graphics::Surface &surf, int16 x, int16 y, bool mask) r.moveTo(x, y); uint16 z = (mask) ? _backgroundInfo->getMaskLayer(y) : LAYER_FOREGROUND; - blt(r, (byte *)surf.getBasePtr(0, 0), &_backgroundInfo->bg, z, 100, 0); + blt(r, (byte *)surf.getPixels(), &_backgroundInfo->bg, z, 100, 0); } void Gfx::fillBackground(const Common::Rect& r, byte color) { @@ -704,7 +704,7 @@ void Gfx::unregisterLabel(GfxObj *label) { void Gfx::copyRect(const Common::Rect &r, Graphics::Surface &src, Graphics::Surface &dst) { byte *s = (byte *)src.getBasePtr(r.left, r.top); - byte *d = (byte *)dst.getBasePtr(0, 0); + byte *d = (byte *)dst.getPixels(); for (uint16 i = 0; i < r.height(); i++) { memcpy(d, s, r.width()); diff --git a/engines/parallaction/input.cpp b/engines/parallaction/input.cpp index df7275aacc..a445ce0138 100644 --- a/engines/parallaction/input.cpp +++ b/engines/parallaction/input.cpp @@ -499,7 +499,7 @@ void Input::initCursors() { // TODO: scale mouse cursor (see staticres.cpp) Graphics::Surface *surf2 = new Graphics::Surface; surf2->create(32, 16, Graphics::PixelFormat::createFormatCLUT8()); - memcpy(surf2->getBasePtr(0, 0), _resMouseArrow_BR_Amiga, 32*16); + memcpy(surf2->getPixels(), _resMouseArrow_BR_Amiga, 32*16); _mouseArrow = new SurfaceToFrames(surf2); } break; diff --git a/engines/parallaction/inventory.h b/engines/parallaction/inventory.h index 418d1f7229..d5cf8badf0 100644 --- a/engines/parallaction/inventory.h +++ b/engines/parallaction/inventory.h @@ -108,7 +108,7 @@ public: void highlightItem(ItemPosition pos, byte color); void drawItem(ItemName name, byte *buffer, uint pitch); - byte *getData() { return (byte *)_surf.getBasePtr(0, 0); } + byte *getData() { return (byte *)_surf.getPixels(); } void getRect(Common::Rect &r) const; int16 getNumLines() const; -- cgit v1.2.3