[Scummvm-git-logs] scummvm master -> e3c179e975f2c1420eabb8aa2accf26f0d897fed

sluicebox noreply at scummvm.org
Sun Nov 13 03:33:00 UTC 2022


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:
e3c179e975 GRAPHICS: Fix MacCursor handling of color 255


Commit: e3c179e975f2c1420eabb8aa2accf26f0d897fed
    https://github.com/scummvm/scummvm/commit/e3c179e975f2c1420eabb8aa2accf26f0d897fed
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2022-11-12T19:32:57-08:00

Commit Message:
GRAPHICS: Fix MacCursor handling of color 255

Fixes bug #13922 where black cursor pixels in the SCI game QFG1VGA-Mac
weren't being drawn. MacCursor uses 255 as its color key but in CRSR
resources 255 is defined as black. CRSR resources use a mask for
transparency so they have no color key. Now 255 is remapped to black.

Changed paths:
    graphics/maccursor.cpp


diff --git a/graphics/maccursor.cpp b/graphics/maccursor.cpp
index 81a04a464dd..c411ab11123 100644
--- a/graphics/maccursor.cpp
+++ b/graphics/maccursor.cpp
@@ -162,6 +162,18 @@ bool MacCursor::readFromCRSR(Common::SeekableReadStream &stream, bool forceMonoc
 		_palette[c * 3 + 2] = stream.readUint16BE() >> 8;
 	}
 
+	// Find black so that Macintosh black (255) can be remapped.
+	// This is necessary because we use 255 for the color key.
+	byte black = 0;
+	for (byte c = 0; c < 255; c++) {
+		if (_palette[c * 3 + 0] == 0 &&
+			_palette[c * 3 + 1] == 0 &&
+			_palette[c * 3 + 2] == 0) {
+			black = c;
+			break;
+		}
+	}
+
 	int pixelsPerByte = (iconBounds[2] - iconBounds[0]) / iconRowBytes;
 	int bpp           = 8 / pixelsPerByte;
 
@@ -177,8 +189,13 @@ bool MacCursor::readFromCRSR(Common::SeekableReadStream &stream, bool forceMonoc
 		for (int b = 0; b < pixelsPerByte; b++) {
 			int idx = j * pixelsPerByte + (pixelsPerByte - 1 - b);
 
-			if (_surface[idx] != 0xff) // if mask is not there
+			if (_surface[idx] != 0xff) { // if mask is not there
 				_surface[idx] = (byte)((iconData[j] >> (b * bpp)) & bitmask);
+				// Remap Macintosh black
+				if (_surface[idx] == 255) {
+					_surface[idx] = black;
+				}
+			}
 		}
 	}
 




More information about the Scummvm-git-logs mailing list