[Scummvm-cvs-logs] scummvm master -> e5808c740a62cb87a1ceeef7873af3b21e912c73

clone2727 clone2727 at gmail.com
Sat May 5 05:20:41 CEST 2012


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:
e5808c740a GRAPHICS: Fix 32-bit DirectBits images


Commit: e5808c740a62cb87a1ceeef7873af3b21e912c73
    https://github.com/scummvm/scummvm/commit/e5808c740a62cb87a1ceeef7873af3b21e912c73
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2012-05-04T20:18:28-07:00

Commit Message:
GRAPHICS: Fix 32-bit DirectBits images

Changed paths:
    graphics/decoders/pict.cpp



diff --git a/graphics/decoders/pict.cpp b/graphics/decoders/pict.cpp
index 9963873..bdb733a 100644
--- a/graphics/decoders/pict.cpp
+++ b/graphics/decoders/pict.cpp
@@ -361,14 +361,14 @@ void PICTDecoder::unpackBitsRect(Common::SeekableReadStream &stream, bool hasPal
 		memcpy(_outputSurface->pixels, buffer, _outputSurface->w * _outputSurface->h);
 		break;
 	case 2:
-		// Convert from 16-bit to whatever surface we need
+		// We have a 16-bit surface
 		_outputSurface->create(width, height, PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0));
 		for (uint16 y = 0; y < _outputSurface->h; y++)
 			for (uint16 x = 0; x < _outputSurface->w; x++)
 				WRITE_UINT16(_outputSurface->getBasePtr(x, y), READ_UINT16(buffer + (y * _outputSurface->w + x) * 2));
 		break;
 	case 3:
-		// Convert from 24-bit (planar!) to whatever surface we need
+		// We have a planar 24-bit surface
 		_outputSurface->create(width, height, Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0));
 		for (uint16 y = 0; y < _outputSurface->h; y++) {
 			for (uint16 x = 0; x < _outputSurface->w; x++) {
@@ -380,15 +380,18 @@ void PICTDecoder::unpackBitsRect(Common::SeekableReadStream &stream, bool hasPal
 		}
 		break;
 	case 4:
-		// Convert from 32-bit (planar!) to whatever surface we need
+		// We have a planar 32-bit surface
+		// Note that we ignore the alpha channel since it seems to not be correct
+		// Mac OS X does not ignore it, but then displays it incorrectly. Photoshop
+		// does ignore it and displays it correctly.
 		_outputSurface->create(width, height, Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0));
 		for (uint16 y = 0; y < _outputSurface->h; y++) {
 			for (uint16 x = 0; x < _outputSurface->w; x++) {
-				byte r = *(buffer + y * _outputSurface->w * 4 + x);
-				byte g = *(buffer + y * _outputSurface->w * 4 + _outputSurface->w + x);
-				byte b = *(buffer + y * _outputSurface->w * 4 + _outputSurface->w * 2 + x);
-				byte a = *(buffer + y * _outputSurface->w * 4 + _outputSurface->w * 3 + x);
-				*((uint32 *)_outputSurface->getBasePtr(x, y)) = _outputSurface->format.ARGBToColor(r, g, b, a);
+				byte a = 0xFF;
+				byte r = *(buffer + y * _outputSurface->w * 4 + _outputSurface->w + x);
+				byte g = *(buffer + y * _outputSurface->w * 4 + _outputSurface->w * 2 + x);
+				byte b = *(buffer + y * _outputSurface->w * 4 + _outputSurface->w * 3 + x);
+				*((uint32 *)_outputSurface->getBasePtr(x, y)) = _outputSurface->format.ARGBToColor(a, r, g, b);
 			}
 		}
 		break;






More information about the Scummvm-git-logs mailing list