[Scummvm-git-logs] scummvm master -> 8eb8e7366c5c68c3d44a7ce5234f4b7c8bf2015f

csnover csnover at users.noreply.github.com
Tue Nov 8 02:52:16 CET 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
8eb8e7366c IMAGE: Add support for 16-bit RLE TGA images


Commit: 8eb8e7366c5c68c3d44a7ce5234f4b7c8bf2015f
    https://github.com/scummvm/scummvm/commit/8eb8e7366c5c68c3d44a7ce5234f4b7c8bf2015f
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-11-07T19:51:53-06:00

Commit Message:
IMAGE: Add support for 16-bit RLE TGA images

Used by Titanic engine.

Changed paths:
    image/tga.cpp



diff --git a/image/tga.cpp b/image/tga.cpp
index f22cfcb..adfe7ee 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();





More information about the Scummvm-git-logs mailing list