diff options
author | Matthew Hoops | 2014-02-27 21:27:24 -0500 |
---|---|---|
committer | Matthew Hoops | 2014-02-28 00:27:37 -0500 |
commit | 08ea14a8d0e1a1478d1f486edeecea3e619e0cd0 (patch) | |
tree | 54e46574c82d1aa95c4cca2a16e31faae2e34aea /image/codecs/msrle.cpp | |
parent | e6717aaf43c7a25d426502a6d5d7028d50aab255 (diff) | |
download | scummvm-rg350-08ea14a8d0e1a1478d1f486edeecea3e619e0cd0.tar.gz scummvm-rg350-08ea14a8d0e1a1478d1f486edeecea3e619e0cd0.tar.bz2 scummvm-rg350-08ea14a8d0e1a1478d1f486edeecea3e619e0cd0.zip |
IMAGE: Make Codec take a stream reference; change function name to decodeFrame
Diffstat (limited to 'image/codecs/msrle.cpp')
-rw-r--r-- | image/codecs/msrle.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/image/codecs/msrle.cpp b/image/codecs/msrle.cpp index 951de83c31..89fe869a9e 100644 --- a/image/codecs/msrle.cpp +++ b/image/codecs/msrle.cpp @@ -39,7 +39,7 @@ MSRLEDecoder::~MSRLEDecoder() { delete _surface; } -const Graphics::Surface *MSRLEDecoder::decodeImage(Common::SeekableReadStream *stream) { +const Graphics::Surface *MSRLEDecoder::decodeFrame(Common::SeekableReadStream &stream) { if (_bitsPerPixel == 8) { decode8(stream); } else @@ -48,7 +48,7 @@ const Graphics::Surface *MSRLEDecoder::decodeImage(Common::SeekableReadStream *s return _surface; } -void MSRLEDecoder::decode8(Common::SeekableReadStream *stream) { +void MSRLEDecoder::decode8(Common::SeekableReadStream &stream) { int x = 0; int y = _surface->h - 1; @@ -60,9 +60,9 @@ void MSRLEDecoder::decode8(Common::SeekableReadStream *stream) { byte *output = data + ((height - 1) * width); byte *output_end = data + ((height) * width); - while (!stream->eos()) { - byte count = stream->readByte(); - byte value = stream->readByte(); + while (!stream.eos()) { + byte count = stream.readByte(); + byte value = stream.readByte(); if (count == 0) { if (value == 0) { @@ -84,8 +84,8 @@ void MSRLEDecoder::decode8(Common::SeekableReadStream *stream) { } else if (value == 2) { // Skip - count = stream->readByte(); - value = stream->readByte(); + count = stream.readByte(); + value = stream.readByte(); y -= value; x += count; @@ -101,15 +101,15 @@ void MSRLEDecoder::decode8(Common::SeekableReadStream *stream) { // Copy data if (output + value > output_end) { - stream->skip(value); + stream.skip(value); continue; } for (int i = 0; i < value; i++) - *output++ = stream->readByte(); + *output++ = stream.readByte(); if (value & 1) - stream->skip(1); + stream.skip(1); x += value; } |