[Scummvm-git-logs] scummvm branch-2-7 -> 441ee7b9ed724d6e48113fd400504222787deadf

phcoder noreply at scummvm.org
Thu Feb 2 16:37:43 UTC 2023


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:
441ee7b9ed GUI: Fix black rectangle around cursor in modern remastered them without RGB


Commit: 441ee7b9ed724d6e48113fd400504222787deadf
    https://github.com/scummvm/scummvm/commit/441ee7b9ed724d6e48113fd400504222787deadf
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-02-02T17:37:30+01:00

Commit Message:
GUI: Fix black rectangle around cursor in modern remastered them without RGB

Modern remastered uses cursor with alpha. It's not correctly converted and
so we get black rectangle around it when using --disable-16bit

Changed paths:
    gui/ThemeEngine.cpp


diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 9a71249e16f..f730cd9ea76 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -1596,7 +1596,8 @@ bool ThemeEngine::createCursor(const Common::String &filename, int hotspotX, int
 	memset(_cursor, 0xFF, sizeof(byte) * _cursorWidth * _cursorHeight);
 
 	// the transparent color is 0xFF00FF
-	const uint32 colTransparent = _overlayFormat.RGBToColor(0xFF, 0, 0xFF);
+	const uint32 colTransparent = cursor->format.RGBToColor(0xFF, 0, 0xFF);
+	const uint32 alphaMask = cursor->format.ARGBToColor(0x80, 0, 0, 0);
 
 	// Now, scan the bitmap. We have to convert it from 16 bit color mode
 	// to 8 bit mode, and have to create a suitable palette on the fly.
@@ -1617,7 +1618,9 @@ bool ThemeEngine::createCursor(const Common::String &filename, int hotspotX, int
 			src += cursor->format.bytesPerPixel;
 
 			// Skip transparency
-			if (color == colTransparent)
+			if (color == colTransparent
+			    // Replace with transparent is alpha is present and < 50%
+			    || (alphaMask != 0 && (color & alphaMask) == 0))
 				continue;
 
 			cursor->format.colorToRGB(color, r, g, b);




More information about the Scummvm-git-logs mailing list