[Scummvm-git-logs] scummvm master -> 60fcf993e7c19cf3c3c5e74c2dd447e2e2b2c4ac

bluegr bluegr at gmail.com
Wed Aug 21 13:13:31 CEST 2019


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:
60fcf993e7 GRAPHICS: Display Mac monochrome cursor inverted pixels


Commit: 60fcf993e7c19cf3c3c5e74c2dd447e2e2b2c4ac
    https://github.com/scummvm/scummvm/commit/60fcf993e7c19cf3c3c5e74c2dd447e2e2b2c4ac
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2019-08-21T14:13:26+03:00

Commit Message:
GRAPHICS: Display Mac monochrome cursor inverted pixels

Bug #7050

Changed paths:
    engines/sci/graphics/cursor.cpp
    graphics/maccursor.cpp
    graphics/maccursor.h


diff --git a/engines/sci/graphics/cursor.cpp b/engines/sci/graphics/cursor.cpp
index bcddd16..c2d737b 100644
--- a/engines/sci/graphics/cursor.cpp
+++ b/engines/sci/graphics/cursor.cpp
@@ -508,7 +508,10 @@ void GfxCursor::kernelSetMacCursor(GuiResourceId viewNum, int loopNum, int celNu
 	Common::MemoryReadStream resStream(resource->toStream());
 	Graphics::MacCursor *macCursor = new Graphics::MacCursor();
 
-	if (!macCursor->readFromStream(resStream)) {
+	// use black for mac monochrome inverted pixels so that cursor
+	//  features in FPFP and KQ6 Mac are displayed, bug #7050
+	byte macMonochromeInvertedPixelColor = 0;
+	if (!macCursor->readFromStream(resStream, false, macMonochromeInvertedPixelColor)) {
 		warning("Failed to load Mac cursor %d", viewNum);
 		delete macCursor;
 		return;
diff --git a/graphics/maccursor.cpp b/graphics/maccursor.cpp
index a66a910..75669e8 100644
--- a/graphics/maccursor.cpp
+++ b/graphics/maccursor.cpp
@@ -43,18 +43,18 @@ void MacCursor::clear() {
 	memset(_palette, 0, 256 * 3);
 }
 
-bool MacCursor::readFromStream(Common::SeekableReadStream &stream, bool forceMonochrome) {
+bool MacCursor::readFromStream(Common::SeekableReadStream &stream, bool forceMonochrome, byte monochromeInvertedPixelColor) {
 	clear();
 
 	// Older Mac CURS monochrome cursors had a set size
 	// All crsr cursors are larger than this
 	if (stream.size() == 32 * 2 + 4)
-		return readFromCURS(stream);
+		return readFromCURS(stream, monochromeInvertedPixelColor);
 
-	return readFromCRSR(stream, forceMonochrome);
+	return readFromCRSR(stream, forceMonochrome, monochromeInvertedPixelColor);
 }
 
-bool MacCursor::readFromCURS(Common::SeekableReadStream &stream) {
+bool MacCursor::readFromCURS(Common::SeekableReadStream &stream, byte monochromeInvertedPixelColor) {
 	// Grab B/W icon data
 	_surface = new byte[16 * 16];
 	for (int i = 0; i < 32; i++) {
@@ -66,9 +66,15 @@ bool MacCursor::readFromCURS(Common::SeekableReadStream &stream) {
 	// Apply mask data
 	for (int i = 0; i < 32; i++) {
 		byte imageByte = stream.readByte();
-		for (int b = 0; b < 8; b++)
-			if ((imageByte & (0x80 >> b)) == 0)
-				_surface[i * 8 + b] = 0xff;
+		for (int b = 0; b < 8; b++) {
+			if ((imageByte & (0x80 >> b)) == 0) {
+				// if an image bit is set outside the mask then the destination pixel
+				//  would have been inverted on macintosh, otherwise it's transparent.
+				//  we don't currently implement this inversion effect so instead we
+				//  use the optional color provided by the caller for these pixels.
+				_surface[i * 8 + b] = _surface[i * 8 + b] ? 0xff : monochromeInvertedPixelColor;
+			}
+		}
 	}
 
 	_hotspotY = stream.readUint16BE();
@@ -82,7 +88,7 @@ bool MacCursor::readFromCURS(Common::SeekableReadStream &stream) {
 	return !stream.eos();
 }
 
-bool MacCursor::readFromCRSR(Common::SeekableReadStream &stream, bool forceMonochrome) {
+bool MacCursor::readFromCRSR(Common::SeekableReadStream &stream, bool forceMonochrome, byte monochromeInvertedPixelColor) {
 	stream.readUint16BE(); // type
 	stream.readUint32BE(); // offset to pixel map
 	stream.readUint32BE(); // offset to pixel data
@@ -91,7 +97,7 @@ bool MacCursor::readFromCRSR(Common::SeekableReadStream &stream, bool forceMonoc
 	stream.readUint32BE(); // reserved
 
 	// Read the B/W data first
-	if (!readFromCURS(stream))
+	if (!readFromCURS(stream, monochromeInvertedPixelColor))
 		return false;
 
 	// Use b/w cursor on backends which don't support cursor palettes
diff --git a/graphics/maccursor.h b/graphics/maccursor.h
index 1ae38f8..a4da7cb 100644
--- a/graphics/maccursor.h
+++ b/graphics/maccursor.h
@@ -63,11 +63,11 @@ public:
 	uint16 getPaletteCount() const { return 256; }
 
 	/** Read the cursor's data out of a stream. */
-	bool readFromStream(Common::SeekableReadStream &stream, bool forceMonochrome = false);
+	bool readFromStream(Common::SeekableReadStream &stream, bool forceMonochrome = false, byte monochromeInvertedPixelColor = 0xff);
 
 private:
-	bool readFromCURS(Common::SeekableReadStream &stream);
-	bool readFromCRSR(Common::SeekableReadStream &stream, bool forceMonochrome);
+	bool readFromCURS(Common::SeekableReadStream &stream, byte monochromeInvertedPixelColor);
+	bool readFromCRSR(Common::SeekableReadStream &stream, bool forceMonochrome, byte monochromeInvertedPixelColor);
 
 	byte *_surface;
 	byte _palette[256 * 3];





More information about the Scummvm-git-logs mailing list