[Scummvm-git-logs] scummvm master -> c4262682dc8b60244ec8a3cba9d71afadb80c326
AReim1982
alexander at areim.de
Thu Sep 24 09:26:32 UTC 2020
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:
c4262682dc WII: Fix transparency of RGB cursors
Commit: c4262682dc8b60244ec8a3cba9d71afadb80c326
https://github.com/scummvm/scummvm/commit/c4262682dc8b60244ec8a3cba9d71afadb80c326
Author: Alexander Reim (alexander at areim.de)
Date: 2020-09-24T11:26:21+02:00
Commit Message:
WII: Fix transparency of RGB cursors
Changed paths:
backends/platform/wii/osystem_gfx.cpp
diff --git a/backends/platform/wii/osystem_gfx.cpp b/backends/platform/wii/osystem_gfx.cpp
index 40b4512774..f425222f99 100644
--- a/backends/platform/wii/osystem_gfx.cpp
+++ b/backends/platform/wii/osystem_gfx.cpp
@@ -651,7 +651,6 @@ void OSystem_Wii::setMouseCursor(const void *buf, uint w, uint h, int hotspotX,
const Graphics::PixelFormat *format) {
gfx_tex_format_t tex_format = GFX_TF_PALETTE_RGB5A3;
uint tw, th;
- bool tmpBuf = false;
uint32 oldKeycolor = _mouseKeyColor;
#ifdef USE_RGB_COLOR
@@ -666,8 +665,6 @@ void OSystem_Wii::setMouseCursor(const void *buf, uint w, uint h, int hotspotX,
tw = ROUNDUP(w, 4);
th = ROUNDUP(h, 4);
- if (_pfCursor != _pfRGB3444)
- tmpBuf = true;
} else {
#endif
_mouseKeyColor = keycolor & 0xff;
@@ -684,64 +681,60 @@ void OSystem_Wii::setMouseCursor(const void *buf, uint w, uint h, int hotspotX,
gfx_tex_set_bilinear_filter(&_texMouse, _bilinearFilter);
- if ((tw != w) || (th != h))
- tmpBuf = true;
+ u8 bpp = _texMouse.bpp >> 3;
+ byte *tmp = (byte *) malloc(tw * th * bpp);
- if (!tmpBuf) {
- gfx_tex_convert(&_texMouse, (const byte *)buf);
- } else {
- u8 bpp = _texMouse.bpp >> 3;
- byte *tmp = (byte *) malloc(tw * th * bpp);
+ 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);
+
+#ifdef USE_RGB_COLOR
+ if (bpp > 1) {
- if (!tmp) {
- printf("could not alloc temp cursor buffer\n");
+ if (!Graphics::crossBlit(tmp, (const byte *)buf,
+ tw * _pfRGB3444.bytesPerPixel,
+ w * _pfCursor.bytesPerPixel,
+ tw, th, _pfRGB3444, _pfCursor)) {
+ printf("crossBlit failed (cursor)\n");
::abort();
}
- if (bpp > 1)
- memset(tmp, 0, tw * th * bpp);
- else
- memset(tmp, _mouseKeyColor, tw * th);
-
-#ifdef USE_RGB_COLOR
- if (bpp > 1) {
- if (!Graphics::crossBlit(tmp, (const byte *)buf,
- tw * _pfRGB3444.bytesPerPixel,
- w * _pfCursor.bytesPerPixel,
- tw, th, _pfRGB3444, _pfCursor)) {
- printf("crossBlit 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++;
}
- // 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 {
-#endif
- byte *dst = tmp;
- const byte *src = (const byte *)buf;
- do {
- memcpy(dst, src, w * bpp);
- src += w * bpp;
- dst += tw * bpp;
- } while (--h);
-#ifdef USE_RGB_COLOR
+ d += tw - w;
}
+ } else {
#endif
+ 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++;
- gfx_tex_convert(&_texMouse, tmp);
- free(tmp);
+ d += tw - w;
+ }
+
+#ifdef USE_RGB_COLOR
}
+#endif
+
+ gfx_tex_convert(&_texMouse, tmp);
+ free(tmp);
_mouseHotspotX = hotspotX;
_mouseHotspotY = hotspotY;
More information about the Scummvm-git-logs
mailing list