diff options
author | Johannes Schickel | 2013-08-03 02:35:31 +0200 |
---|---|---|
committer | Johannes Schickel | 2013-08-03 04:02:49 +0200 |
commit | 5111746911958bd35422e9614b0961a6b911ea06 (patch) | |
tree | 0b166db3132da17f7a49a40b8914aa1b94e03c05 /graphics/decoders | |
parent | f03dc05847a77661c2978619099ab18c82bb94f7 (diff) | |
download | scummvm-rg350-5111746911958bd35422e9614b0961a6b911ea06.tar.gz scummvm-rg350-5111746911958bd35422e9614b0961a6b911ea06.tar.bz2 scummvm-rg350-5111746911958bd35422e9614b0961a6b911ea06.zip |
GRAPHICS: Take advantage of Surface::getPixels.
Diffstat (limited to 'graphics/decoders')
-rw-r--r-- | graphics/decoders/bmp.cpp | 2 | ||||
-rw-r--r-- | graphics/decoders/iff.cpp | 4 | ||||
-rw-r--r-- | graphics/decoders/jpeg.cpp | 2 | ||||
-rw-r--r-- | graphics/decoders/pcx.cpp | 6 | ||||
-rw-r--r-- | graphics/decoders/pict.cpp | 2 | ||||
-rw-r--r-- | graphics/decoders/png.cpp | 2 | ||||
-rw-r--r-- | graphics/decoders/tga.cpp | 4 |
7 files changed, 11 insertions, 11 deletions
diff --git a/graphics/decoders/bmp.cpp b/graphics/decoders/bmp.cpp index 51e43075a5..2eabbb7631 100644 --- a/graphics/decoders/bmp.cpp +++ b/graphics/decoders/bmp.cpp @@ -130,7 +130,7 @@ bool BitmapDecoder::loadStream(Common::SeekableReadStream &stream) { const int extraDataLength = (srcPitch % 4) ? 4 - (srcPitch % 4) : 0; if (bitsPerPixel == 8) { - byte *dst = (byte *)_surface->getBasePtr(0, 0); + byte *dst = (byte *)_surface->getPixels(); for (int32 i = 0; i < height; i++) { stream.read(dst + (height - i - 1) * width, width); diff --git a/graphics/decoders/iff.cpp b/graphics/decoders/iff.cpp index 60a6dafda2..7b37969fc1 100644 --- a/graphics/decoders/iff.cpp +++ b/graphics/decoders/iff.cpp @@ -170,7 +170,7 @@ void IFFDecoder::loadBitmap(Common::SeekableReadStream &stream) { if (_type == TYPE_ILBM) { uint32 scanlinePitch = ((_header.width + 15) >> 4) << 1; byte *scanlines = new byte[scanlinePitch * _header.numPlanes]; - byte *data = (byte *)_surface->getBasePtr(0, 0); + byte *data = (byte *)_surface->getPixels(); for (uint16 i = 0; i < _header.height; ++i) { byte *scanline = scanlines; @@ -194,7 +194,7 @@ void IFFDecoder::loadBitmap(Common::SeekableReadStream &stream) { delete[] scanlines; } else if (_type == TYPE_PBM) { - byte *data = (byte *)_surface->getBasePtr(0, 0); + byte *data = (byte *)_surface->getPixels(); uint32 outSize = _header.width * _header.height; if (_header.compression) { diff --git a/graphics/decoders/jpeg.cpp b/graphics/decoders/jpeg.cpp index d2829e3576..ff018c799a 100644 --- a/graphics/decoders/jpeg.cpp +++ b/graphics/decoders/jpeg.cpp @@ -81,7 +81,7 @@ const Surface *JPEGDecoder::getSurface() const { const Graphics::Surface *uComponent = getComponent(2); const Graphics::Surface *vComponent = getComponent(3); - YUVToRGBMan.convert444(_rgbSurface, Graphics::YUVToRGBManager::kScaleFull, (const byte *)yComponent->getBasePtr(0, 0), (const byte *)uComponent->getBasePtr(0, 0), (const byte *)vComponent->getBasePtr(0, 0), yComponent->w, yComponent->h, yComponent->pitch, uComponent->pitch); + YUVToRGBMan.convert444(_rgbSurface, Graphics::YUVToRGBManager::kScaleFull, (const byte *)yComponent->getPixels(), (const byte *)uComponent->getPixels(), (const byte *)vComponent->getPixels(), yComponent->w, yComponent->h, yComponent->pitch, uComponent->pitch); return _rgbSurface; } diff --git a/graphics/decoders/pcx.cpp b/graphics/decoders/pcx.cpp index 5815633545..eb9b4c997d 100644 --- a/graphics/decoders/pcx.cpp +++ b/graphics/decoders/pcx.cpp @@ -117,7 +117,7 @@ bool PCXDecoder::loadStream(Common::SeekableReadStream &stream) { if (nPlanes == 3 && bitsPerPixel == 8) { // 24bpp Graphics::PixelFormat format = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0); _surface->create(width, height, format); - dst = (byte *)_surface->getBasePtr(0, 0); + dst = (byte *)_surface->getPixels(); _paletteColorCount = 0; for (y = 0; y < height; y++) { @@ -135,7 +135,7 @@ bool PCXDecoder::loadStream(Common::SeekableReadStream &stream) { } } else if (nPlanes == 1 && bitsPerPixel == 8) { // 8bpp indexed _surface->create(width, height, Graphics::PixelFormat::createFormatCLUT8()); - dst = (byte *)_surface->getBasePtr(0, 0); + dst = (byte *)_surface->getPixels(); _paletteColorCount = 16; for (y = 0; y < height; y++, dst += _surface->pitch) { @@ -163,7 +163,7 @@ bool PCXDecoder::loadStream(Common::SeekableReadStream &stream) { } } else if ((nPlanes == 2 || nPlanes == 3 || nPlanes == 4) && bitsPerPixel == 1) { // planar, 4, 8 or 16 colors _surface->create(width, height, Graphics::PixelFormat::createFormatCLUT8()); - dst = (byte *)_surface->getBasePtr(0, 0); + dst = (byte *)_surface->getPixels(); _paletteColorCount = 16; for (y = 0; y < height; y++, dst += _surface->pitch) { diff --git a/graphics/decoders/pict.cpp b/graphics/decoders/pict.cpp index 0b2ba9a64e..f3e17b33e2 100644 --- a/graphics/decoders/pict.cpp +++ b/graphics/decoders/pict.cpp @@ -364,7 +364,7 @@ void PICTDecoder::unpackBitsRect(Common::SeekableReadStream &stream, bool withPa case 1: // Just copy to the image _outputSurface->create(width, height, PixelFormat::createFormatCLUT8()); - memcpy(_outputSurface->getBasePtr(0, 0), buffer, _outputSurface->w * _outputSurface->h); + memcpy(_outputSurface->getPixels(), buffer, _outputSurface->w * _outputSurface->h); break; case 2: // We have a 16-bit surface diff --git a/graphics/decoders/png.cpp b/graphics/decoders/png.cpp index ac9689fcc8..505475213f 100644 --- a/graphics/decoders/png.cpp +++ b/graphics/decoders/png.cpp @@ -164,7 +164,7 @@ bool PNGDecoder::loadStream(Common::SeekableReadStream &stream) { png_set_packing(pngPtr); } else { _outputSurface->create(width, height, Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0)); - if (!_outputSurface->getBasePtr(0, 0)) { + if (!_outputSurface->getPixels()) { error("Could not allocate memory for output image."); } if (bitDepth == 16) diff --git a/graphics/decoders/tga.cpp b/graphics/decoders/tga.cpp index 3ee506f31b..a9f136d238 100644 --- a/graphics/decoders/tga.cpp +++ b/graphics/decoders/tga.cpp @@ -272,7 +272,7 @@ bool TGADecoder::readData(Common::SeekableReadStream &tga, byte imageType, byte } else if (imageType == TYPE_BW) { _surface.create(_surface.w, _surface.h, _format); - byte *data = (byte *)_surface.getBasePtr(0, 0); + byte *data = (byte *)_surface.getPixels(); uint32 count = _surface.w * _surface.h; while (count-- > 0) { @@ -318,7 +318,7 @@ bool TGADecoder::readDataRLE(Common::SeekableReadStream &tga, byte imageType, by if (imageType == TYPE_RLE_TRUECOLOR || imageType == TYPE_RLE_BW || imageType == TYPE_RLE_CMAP) { _surface.create(_surface.w, _surface.h, _format); uint32 count = _surface.w * _surface.h; - byte *data = (byte *)_surface.getBasePtr(0, 0); + byte *data = (byte *)_surface.getPixels(); while (count > 0) { uint32 header = tga.readByte(); |