diff options
Diffstat (limited to 'graphics/png.cpp')
-rw-r--r-- | graphics/png.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/graphics/png.cpp b/graphics/png.cpp index e6dceab3fa..a1cf266227 100644 --- a/graphics/png.cpp +++ b/graphics/png.cpp @@ -202,7 +202,7 @@ Graphics::Surface *PNG::getSurface(const PixelFormat &format) { } // The surface is a whole scanline wide, skip the rest of it. if (_header.bitDepth == 4) - src += output->w / 2; + src += output->w / 2 + output->w % 2; } } @@ -236,7 +236,7 @@ bool PNG::read(Common::SeekableReadStream *str) { case kChunkIDAT: if (_compressedBufferSize == 0) { _compressedBufferSize += chunkLength; - _compressedBuffer = new byte[_compressedBufferSize]; + _compressedBuffer = (byte *)malloc(_compressedBufferSize); _stream->read(_compressedBuffer, chunkLength); } else { // Expand the buffer @@ -244,8 +244,8 @@ bool PNG::read(Common::SeekableReadStream *str) { _compressedBufferSize += chunkLength; byte *tmp = new byte[prevSize]; memcpy(tmp, _compressedBuffer, prevSize); - delete[] _compressedBuffer; - _compressedBuffer = new byte[_compressedBufferSize]; + free(_compressedBuffer); + _compressedBuffer = (byte *)malloc(_compressedBufferSize); memcpy(_compressedBuffer, tmp, prevSize); delete[] tmp; _stream->read(_compressedBuffer + prevSize, chunkLength); |