mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-05 01:38:36 +00:00
WII: Fix transparency of RGB cursors
This commit is contained in:
parent
75826f80fc
commit
c4262682dc
@ -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 (!tmp) {
|
||||
printf("could not alloc temp cursor buffer\n");
|
||||
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();
|
||||
}
|
||||
|
||||
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++;
|
||||
|
||||
d += tw - w;
|
||||
}
|
||||
|
||||
#ifdef USE_RGB_COLOR
|
||||
}
|
||||
#endif
|
||||
|
||||
gfx_tex_convert(&_texMouse, tmp);
|
||||
free(tmp);
|
||||
}
|
||||
gfx_tex_convert(&_texMouse, tmp);
|
||||
free(tmp);
|
||||
|
||||
_mouseHotspotX = hotspotX;
|
||||
_mouseHotspotY = hotspotY;
|
||||
|
Loading…
x
Reference in New Issue
Block a user