From 6fce92b0ea2fce78c375ade0bc6c2ac4231b96bd Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:05:40 +0200 Subject: VIDEO: Prefer getBasePtr over direct Surface::pixels access. --- video/codecs/cdtoons.cpp | 2 +- video/codecs/cinepak.cpp | 6 +++--- video/codecs/msrle.cpp | 2 +- video/codecs/msvideo1.cpp | 2 +- video/codecs/qtrle.cpp | 12 ++++++------ video/codecs/rpza.cpp | 2 +- video/codecs/smc.cpp | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) (limited to 'video/codecs') diff --git a/video/codecs/cdtoons.cpp b/video/codecs/cdtoons.cpp index 528cee8094..f4adb11dae 100644 --- a/video/codecs/cdtoons.cpp +++ b/video/codecs/cdtoons.cpp @@ -298,7 +298,7 @@ Graphics::Surface *CDToonsDecoder::decodeImage(Common::SeekableReadStream *strea for (uint i = 0; i < actions.size(); i++) { CDToonsAction &action = actions[i]; if (i == 0 && action.blockId == 0) - memset(_surface->pixels, backgroundColor, _surface->w * _surface->h); + memset(_surface->getBasePtr(0, 0), backgroundColor, _surface->w * _surface->h); if (!_blocks.contains(action.blockId)) continue; if (!action.rect.right) diff --git a/video/codecs/cinepak.cpp b/video/codecs/cinepak.cpp index bcf0cf1180..363ca43f61 100644 --- a/video/codecs/cinepak.cpp +++ b/video/codecs/cinepak.cpp @@ -41,11 +41,11 @@ namespace Video { byte b = _clipTable[lum + (u << 1)]; \ \ if (_pixelFormat.bytesPerPixel == 2) \ - *((uint16 *)_curFrame.surface->pixels + offset) = _pixelFormat.RGBToColor(r, g, b); \ + *((uint16 *)_curFrame.surface->getBasePtr(0, 0) + offset) = _pixelFormat.RGBToColor(r, g, b); \ else \ - *((uint32 *)_curFrame.surface->pixels + offset) = _pixelFormat.RGBToColor(r, g, b); \ + *((uint32 *)_curFrame.surface->getBasePtr(0, 0) + offset) = _pixelFormat.RGBToColor(r, g, b); \ } else \ - *((byte *)_curFrame.surface->pixels + offset) = lum + *((byte *)_curFrame.surface->getBasePtr(0, 0) + offset) = lum CinepakDecoder::CinepakDecoder(int bitsPerPixel) : Codec() { _curFrame.surface = NULL; diff --git a/video/codecs/msrle.cpp b/video/codecs/msrle.cpp index fa03a59efd..8efc1a9d8d 100644 --- a/video/codecs/msrle.cpp +++ b/video/codecs/msrle.cpp @@ -53,7 +53,7 @@ void MSRLEDecoder::decode8(Common::SeekableReadStream *stream) { int x = 0; int y = _surface->h - 1; - byte *data = (byte *) _surface->pixels; + byte *data = (byte *) _surface->getBasePtr(0, 0); uint16 width = _surface->w; uint16 height = _surface->h; diff --git a/video/codecs/msvideo1.cpp b/video/codecs/msvideo1.cpp index 06e4640025..dc7550f791 100644 --- a/video/codecs/msvideo1.cpp +++ b/video/codecs/msvideo1.cpp @@ -48,7 +48,7 @@ MSVideo1Decoder::~MSVideo1Decoder() { void MSVideo1Decoder::decode8(Common::SeekableReadStream *stream) { byte colors[8]; - byte *pixels = (byte *)_surface->pixels; + byte *pixels = (byte *)_surface->getBasePtr(0, 0); uint16 stride = _surface->w; int skipBlocks = 0; diff --git a/video/codecs/qtrle.cpp b/video/codecs/qtrle.cpp index d2cdea27de..0e356e5d63 100644 --- a/video/codecs/qtrle.cpp +++ b/video/codecs/qtrle.cpp @@ -61,7 +61,7 @@ QTRLEDecoder::QTRLEDecoder(uint16 width, uint16 height, byte bitsPerPixel) : Cod void QTRLEDecoder::decode1(Common::SeekableReadStream *stream, uint32 rowPtr, uint32 linesToChange) { uint32 pixelPtr = 0; - byte *rgb = (byte *)_surface->pixels; + byte *rgb = (byte *)_surface->getBasePtr(0, 0); while (linesToChange) { CHECK_STREAM_PTR(2); @@ -105,7 +105,7 @@ void QTRLEDecoder::decode1(Common::SeekableReadStream *stream, uint32 rowPtr, ui void QTRLEDecoder::decode2_4(Common::SeekableReadStream *stream, uint32 rowPtr, uint32 linesToChange, byte bpp) { uint32 pixelPtr = 0; - byte *rgb = (byte *)_surface->pixels; + byte *rgb = (byte *)_surface->getBasePtr(0, 0); byte numPixels = (bpp == 4) ? 8 : 16; while (linesToChange--) { @@ -165,7 +165,7 @@ void QTRLEDecoder::decode2_4(Common::SeekableReadStream *stream, uint32 rowPtr, void QTRLEDecoder::decode8(Common::SeekableReadStream *stream, uint32 rowPtr, uint32 linesToChange) { uint32 pixelPtr = 0; - byte *rgb = (byte *)_surface->pixels; + byte *rgb = (byte *)_surface->getBasePtr(0, 0); while (linesToChange--) { CHECK_STREAM_PTR(2); @@ -210,7 +210,7 @@ void QTRLEDecoder::decode8(Common::SeekableReadStream *stream, uint32 rowPtr, ui void QTRLEDecoder::decode16(Common::SeekableReadStream *stream, uint32 rowPtr, uint32 linesToChange) { uint32 pixelPtr = 0; - uint16 *rgb = (uint16 *)_surface->pixels; + uint16 *rgb = (uint16 *)_surface->getBasePtr(0, 0); while (linesToChange--) { CHECK_STREAM_PTR(2); @@ -248,7 +248,7 @@ void QTRLEDecoder::decode16(Common::SeekableReadStream *stream, uint32 rowPtr, u void QTRLEDecoder::decode24(Common::SeekableReadStream *stream, uint32 rowPtr, uint32 linesToChange) { uint32 pixelPtr = 0; - uint32 *rgb = (uint32 *)_surface->pixels; + uint32 *rgb = (uint32 *)_surface->getBasePtr(0, 0); while (linesToChange--) { CHECK_STREAM_PTR(2); @@ -294,7 +294,7 @@ void QTRLEDecoder::decode24(Common::SeekableReadStream *stream, uint32 rowPtr, u void QTRLEDecoder::decode32(Common::SeekableReadStream *stream, uint32 rowPtr, uint32 linesToChange) { uint32 pixelPtr = 0; - uint32 *rgb = (uint32 *)_surface->pixels; + uint32 *rgb = (uint32 *)_surface->getBasePtr(0, 0); while (linesToChange--) { CHECK_STREAM_PTR(2); diff --git a/video/codecs/rpza.cpp b/video/codecs/rpza.cpp index 0a9f87747e..f4bdc380fe 100644 --- a/video/codecs/rpza.cpp +++ b/video/codecs/rpza.cpp @@ -58,7 +58,7 @@ RPZADecoder::~RPZADecoder() { #define PUT_PIXEL(color) \ if ((int32)blockPtr < _surface->w * _surface->h) \ - WRITE_UINT16((uint16 *)_surface->pixels + blockPtr, color); \ + WRITE_UINT16((uint16 *)_surface->getBasePtr(0, 0) + blockPtr, color); \ blockPtr++ const Graphics::Surface *RPZADecoder::decodeImage(Common::SeekableReadStream *stream) { diff --git a/video/codecs/smc.cpp b/video/codecs/smc.cpp index 2eedb62a0f..c1b765a3cd 100644 --- a/video/codecs/smc.cpp +++ b/video/codecs/smc.cpp @@ -56,7 +56,7 @@ SMCDecoder::~SMCDecoder() { } const Graphics::Surface *SMCDecoder::decodeImage(Common::SeekableReadStream *stream) { - byte *pixels = (byte *)_surface->pixels; + byte *pixels = (byte *)_surface->getBasePtr(0, 0); uint32 numBlocks = 0; uint32 colorFlags = 0; -- cgit v1.2.3