[Scummvm-git-logs] scummvm master -> e99485ae043fc343c01274a498a65e195e72a060
sev-
noreply at scummvm.org
Thu Apr 6 19:38:24 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:
e99485ae04 GRAPHICS: Only process Win cursor pixels as inverted if they are white and treat any other color with AND mask value 1 a
Commit: e99485ae043fc343c01274a498a65e195e72a060
https://github.com/scummvm/scummvm/commit/e99485ae043fc343c01274a498a65e195e72a060
Author: elasota (ejlasota at gmail.com)
Date: 2023-04-06T21:38:19+02:00
Commit Message:
GRAPHICS: Only process Win cursor pixels as inverted if they are white and treat any other color with AND mask value 1 as transparent.
Fixes incorrect cursor transparency in Riven.
Changed paths:
graphics/wincursor.cpp
diff --git a/graphics/wincursor.cpp b/graphics/wincursor.cpp
index 30ab3e67544..e5634a0fdca 100644
--- a/graphics/wincursor.cpp
+++ b/graphics/wincursor.cpp
@@ -235,24 +235,31 @@ bool WinCursor::readFromStream(Common::SeekableReadStream &stream) {
for (uint32 x = 0; x < _width; x++) {
byte &surfaceByte = _surface[y * _width + x];
if (src[x / 8] & (1 << (7 - x % 8))) {
+ const byte *paletteEntry = &_palette[surfaceByte * 3];
+
+ // Per WDDM spec, white with 1 in the AND mask is inverted, any other color with 1 is transparent.
+ // Riven depends on this behavior for proper cursor transparency, since it uses cursors where the
+ // transparent pixels have a non-zero non-black color.
+ const bool isTransparent = (paletteEntry[0] != 255 || paletteEntry[1] != 255 || paletteEntry[2] != 255);
+
if (_mask) {
byte &maskByte = _mask[y * _width + x];
- if (surfaceByte == 0) {
- // Transparent
+
+ if (isTransparent) {
maskByte = 0;
} else {
// Inverted, if the backend supports invert then emit an inverted pixel, otherwise opaque
- maskByte = supportInvert ? 2 : 1;
+ maskByte = supportInvert ? kCursorMaskInvert : kCursorMaskOpaque;
}
} else {
// Don't support mask or invert, leave this as opaque if it's XOR so it's visible
- if (surfaceByte == 0)
+ if (isTransparent)
surfaceByte = _keyColor;
}
} else {
// Opaque pixel
if (_mask)
- _mask[y * _width + x] = 1;
+ _mask[y * _width + x] = kCursorMaskOpaque;
}
}
More information about the Scummvm-git-logs
mailing list