diff options
author | Colin Snover | 2016-11-07 19:50:49 -0600 |
---|---|---|
committer | Colin Snover | 2016-11-07 19:51:53 -0600 |
commit | 8eb8e7366c5c68c3d44a7ce5234f4b7c8bf2015f (patch) | |
tree | fa2a01504aa688767436dd166a925c0ff6335e4b /image | |
parent | f3d9d88f58d38fedbf6d65d825d6183013086898 (diff) | |
download | scummvm-rg350-8eb8e7366c5c68c3d44a7ce5234f4b7c8bf2015f.tar.gz scummvm-rg350-8eb8e7366c5c68c3d44a7ce5234f4b7c8bf2015f.tar.bz2 scummvm-rg350-8eb8e7366c5c68c3d44a7ce5234f4b7c8bf2015f.zip |
IMAGE: Add support for 16-bit RLE TGA images
Used by Titanic engine.
Diffstat (limited to 'image')
-rw-r--r-- | image/tga.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/image/tga.cpp b/image/tga.cpp index f22cfcb1ad..adfe7eefbb 100644 --- a/image/tga.cpp +++ b/image/tga.cpp @@ -152,7 +152,7 @@ bool TGADecoder::readHeader(Common::SeekableReadStream &tga, byte &imageType, by // of alpha-bits, however, as the game files that use this decoder seems // to ignore that fact, we force the amount to 8 for 32bpp files for now. _format = Graphics::PixelFormat(4, 8, 8, 8, /* attributeBits */ 8, 16, 8, 0, 24); - } else if (pixelDepth == 16 && imageType == TYPE_TRUECOLOR) { + } else if (pixelDepth == 16) { // 16bpp TGA is ARGB1555 _format = Graphics::PixelFormat(2, 5, 5, 5, attributeBits, 10, 5, 0, 15); } else { @@ -353,6 +353,13 @@ bool TGADecoder::readDataRLE(Common::SeekableReadStream &tga, byte imageType, by #endif count--; } + } else if (pixelDepth == 16 && imageType == TYPE_RLE_TRUECOLOR) { + const uint16 rgb = tga.readUint16LE(); + while (rleCount-- > 0) { + *((uint16 *)data) = rgb; + data += 2; + count--; + } } else if (pixelDepth == 8 && imageType == TYPE_RLE_BW) { byte color = tga.readByte(); while (rleCount-- > 0) { @@ -397,6 +404,12 @@ bool TGADecoder::readDataRLE(Common::SeekableReadStream &tga, byte imageType, by #endif count--; } + } else if (pixelDepth == 16 && imageType == TYPE_RLE_TRUECOLOR) { + while (rleCount-- > 0) { + *((uint16 *)data) = tga.readUint16LE(); + data += 2; + count--; + } } else if (pixelDepth == 8 && imageType == TYPE_RLE_BW) { while (rleCount-- > 0) { byte color = tga.readByte(); |