[Scummvm-git-logs] scummvm master -> 872db10b8a701075fc07ec979ea30b8890d2990c
AReim1982
noreply at scummvm.org
Fri Oct 30 11:58:34 UTC 2026
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
872db10b8a WII: Use crossKeyBlit for true color cursors
Commit: 872db10b8a701075fc07ec979ea30b8890d2990c
https://github.com/scummvm/scummvm/commit/872db10b8a701075fc07ec979ea30b8890d2990c
Author: Alexander Reim (alexander at areim.de)
Date: 2026-10-30T12:57:18+01:00
Commit Message:
WII: Use crossKeyBlit for true color cursors
Use crossKeyBlit() to convert true color cursors to the Wii RGB5A3
texture format and handle the cursor key color during conversion.
This removes the previous 16-bit-specific key color handling and the
hardcoded RGB5A3 alpha manipulation.
Keep the CLUT8 cursor path unchanged.
Changed paths:
backends/platform/wii/osystem.h
backends/platform/wii/osystem_gfx.cpp
diff --git a/backends/platform/wii/osystem.h b/backends/platform/wii/osystem.h
index 516621deed3..a2fc032ebe0 100644
--- a/backends/platform/wii/osystem.h
+++ b/backends/platform/wii/osystem.h
@@ -92,6 +92,7 @@ private:
Graphics::PixelFormat _pfGame;
Graphics::PixelFormat _pfGameTexture;
Graphics::PixelFormat _pfCursor;
+ Graphics::PixelFormat _pfCursorTexture;
bool _consoleVisible;
bool _optionsDlgActive;
@@ -101,7 +102,7 @@ private:
bool _mouseVisible;
s32 _mouseX, _mouseY;
s32 _mouseHotspotX, _mouseHotspotY;
- u16 _mouseKeyColor;
+ uint32 _mouseKeyColor;
gfx_tex_t _texMouse;
bool _kbd_active;
diff --git a/backends/platform/wii/osystem_gfx.cpp b/backends/platform/wii/osystem_gfx.cpp
index 3a75f3f2cd9..a64f45957d1 100644
--- a/backends/platform/wii/osystem_gfx.cpp
+++ b/backends/platform/wii/osystem_gfx.cpp
@@ -668,11 +668,12 @@ void OSystem_Wii::warpMouse(int x, int y) {
}
void OSystem_Wii::setMouseCursor(const void *buf, uint w, uint h, int hotspotX,
- int hotspotY, uint32 keycolor,
- const Graphics::PixelFormat *format, const byte *mask,
- frac_t scaleX, frac_t scaleY) {
+ int hotspotY, uint32 keycolor,
+ const Graphics::PixelFormat *format, const byte *mask,
+ frac_t scaleX, frac_t scaleY) {
#ifdef PLATFORM_WII_OSYSTEM_GFX_DEBUG
- printf("%s(%p, w:%u, h:%u, hsX:%d, hsY:%d, kc:%u, scaleX:%f, scaleY:%f, %p, %p)\n", __func__, buf, w, h, hotspotX, hotspotY, keycolor, fracToDouble(scaleX), fracToDouble(scaleY), format, mask);
+ printf("%s(%p, w:%u, h:%u, hsX:%d, hsY:%d, kc:%u, scaleX:%f, scaleY:%f, %p, %p)\n",
+ __func__, buf, w, h, hotspotX, hotspotY, keycolor, fracToDouble(scaleX), fracToDouble(scaleY), format, mask);
#endif
if (mask)
@@ -688,15 +689,15 @@ void OSystem_Wii::setMouseCursor(const void *buf, uint w, uint h, int hotspotX,
if (_pfCursor.bytesPerPixel > 1) {
tex_format = GFX_TF_RGB5A3;
- _mouseKeyColor = keycolor & 0xffff;
+ _pfCursorTexture = _pfRGB3444;
+ _mouseKeyColor = keycolor;
tw = ROUNDUP(w, 4);
th = ROUNDUP(h, 4);
-
} else {
+ _pfCursorTexture = Graphics::PixelFormat::createFormatCLUT8();
_mouseKeyColor = keycolor & 0xff;
tw = ROUNDUP(w, 8);
th = ROUNDUP(h, 4);
-
}
if (!gfx_tex_init(&_texMouse, tex_format, TLUT_MOUSE, tw, th)) {
@@ -706,51 +707,42 @@ void OSystem_Wii::setMouseCursor(const void *buf, uint w, uint h, int hotspotX,
gfx_tex_set_bilinear_filter(&_texMouse, _bilinearFilter);
- u8 bpp = _texMouse.bpp >> 3;
- byte *tmp = (byte *) malloc(tw * th * bpp);
+ const uint bytesPerPixel = _texMouse.bpp >> 3;
+ byte *tmp = (byte *)malloc(tw * th * bytesPerPixel);
if (!tmp) {
printf("could not alloc temp cursor buffer\n");
::abort();
}
- if (bpp > 1)
- memset(tmp, 0, tw * th * bpp);
- else
- memset(tmp, _mouseKeyColor, tw * th);
-
- if (bpp > 1) {
-
- if (!Graphics::crossBlit(tmp, (const byte *)buf,
- tw * _pfRGB3444.bytesPerPixel,
- w * _pfCursor.bytesPerPixel,
- w, h, _pfRGB3444, _pfCursor)) {
- printf("crossBlit failed (cursor)\n");
+ if (_pfCursor.bytesPerPixel > 1) {
+ const uint16 transparentColor =
+ (uint16)_pfCursorTexture.ARGBToColor(0, 0, 0, 0);
+ uint16 *dst = (uint16 *)tmp;
+
+ for (uint i = 0; i < tw * th; ++i)
+ dst[i] = transparentColor;
+
+ if (!Graphics::crossKeyBlit(tmp, (const byte *)buf,
+ tw * _pfCursorTexture.bytesPerPixel,
+ w * _pfCursor.bytesPerPixel,
+ w, h, _pfCursorTexture, _pfCursor,
+ _mouseKeyColor)) {
+ free(tmp);
+ printf("crossKeyBlit failed (cursor)\n");
::abort();
}
-
- // nasty, shouldn't the frontend set the alpha channel?
- const u16 *s = (const u16 *) buf;
- u16 *d = (u16 *) tmp;
- for (u16 y = 0; y < h; ++y) {
- for (u16 x = 0; x < w; ++x) {
- if (*s++ == _mouseKeyColor)
- *d++ &= ~(7 << 12);
- else
- d++;
- }
- d += tw - w;
- }
} else {
- const byte *s = (const byte *)buf;
- byte *d = (byte *) tmp;
- for (u16 y = 0; y < h; ++y) {
- for (u16 x = 0; x < w; ++x) {
- *d++ = *s++;
- }
- d += tw - w;
- }
+ memset(tmp, _mouseKeyColor, tw * th);
+
+ const byte *src = (const byte *)buf;
+ byte *dst = tmp;
+ for (uint y = 0; y < h; ++y) {
+ memcpy(dst, src, w);
+ src += w;
+ dst += tw;
+ }
}
gfx_tex_convert(&_texMouse, tmp);
More information about the Scummvm-git-logs
mailing list