diff options
Diffstat (limited to 'engines/startrek/bitmap.cpp')
-rw-r--r-- | engines/startrek/bitmap.cpp | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/engines/startrek/bitmap.cpp b/engines/startrek/bitmap.cpp index 9fa1d36f40..dee8f67154 100644 --- a/engines/startrek/bitmap.cpp +++ b/engines/startrek/bitmap.cpp @@ -27,7 +27,7 @@ namespace StarTrek { -Bitmap::Bitmap(FileStream stream) { +Bitmap::Bitmap(Common::MemoryReadStreamEndian *stream, bool closeStream) { xoffset = stream->readUint16(); yoffset = stream->readUint16(); width = stream->readUint16(); @@ -36,17 +36,11 @@ Bitmap::Bitmap(FileStream stream) { pixelsArraySize = width * height; pixels = new byte[pixelsArraySize]; stream->read(pixels, width * height); -} -Bitmap::Bitmap(Common::MemoryReadStreamEndian *stream) { - xoffset = stream->readUint16(); - yoffset = stream->readUint16(); - width = stream->readUint16(); - height = stream->readUint16(); - - pixelsArraySize = width * height; - pixels = new byte[pixelsArraySize]; - stream->read(pixels, width * height); + if (closeStream) { + delete stream; + stream = nullptr; + } } Bitmap::Bitmap(const Bitmap &bitmap) { |