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

phcoder noreply at scummvm.org
Thu Feb 2 16:36:16 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:
ef3eda01e0 GUI: Fix black rectangle around cursor in modern remastered them without RGB


Commit: ef3eda01e004e278004f4cacbb8b85af8fe25493
    https://github.com/scummvm/scummvm/commit/ef3eda01e004e278004f4cacbb8b85af8fe25493
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-02-02T19:36:12+03: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