mirror of
https://github.com/scummvm/scummvm.git
synced 2026-06-20 05:45:29 +00:00
BACKENDS: WII: Always retain cursor palette
Calling setMouseCursor with a non-palette cursor no longer clears the cursor palette, allowing a subsequent call with a paletted cursor to re-use it. This fixes Trac defect #13895. The approach taken was to just copy what the OpenGL backend was doing in the same situation.
This commit is contained in:
1 parent
7aae7ec661
commit
73b66c60f8
1 file changed
+15
-25
@@ -334,8 +334,13 @@ void OSystem_Wii::updateMousePalette() {
|
||||
printf("%s() _cursorPaletteDisabled:%d\n", __func__, _cursorPaletteDisabled);
|
||||
#endif
|
||||
|
||||
if (_texMouse.palette && _cursorPaletteDisabled) {
|
||||
memcpy(_texMouse.palette, _cursorPalette, 256 * 2);
|
||||
if (_texMouse.palette) {
|
||||
if (!_cursorPaletteDisabled) {
|
||||
memcpy(_texMouse.palette, _cursorPalette, 256 * 2);
|
||||
} else {
|
||||
memcpy(_texMouse.palette, _texGame.palette, 256 * 2);
|
||||
}
|
||||
|
||||
_cursorPaletteDirty = true;
|
||||
}
|
||||
}
|
||||
@@ -357,20 +362,7 @@ void OSystem_Wii::setPalette(const byte *colors, uint start, uint num) {
|
||||
|
||||
gfx_tex_flush_palette(&_texGame);
|
||||
|
||||
s = colors;
|
||||
d = _cursorPalette;
|
||||
|
||||
for (uint i = 0; i < num; ++i, s += 3) {
|
||||
d[start + i] = _pfRGB3444.ARGBToColor(0xff, s[0], s[1], s[2]);
|
||||
}
|
||||
|
||||
if (_cursorPaletteDisabled) {
|
||||
assert(_texMouse.palette);
|
||||
|
||||
memcpy((u8 *)_texMouse.palette + start * 2, (u8 *)_cursorPalette + start * 2, num * 2);
|
||||
|
||||
_cursorPaletteDirty = true;
|
||||
}
|
||||
updateMousePalette();
|
||||
}
|
||||
|
||||
void OSystem_Wii::grabPalette(byte *colors, uint start, uint num) const {
|
||||
@@ -407,18 +399,16 @@ void OSystem_Wii::setCursorPalette(const byte *colors, uint start, uint num) {
|
||||
gfx_tex_set_bilinear_filter(&_texMouse, _bilinearFilter);
|
||||
}
|
||||
|
||||
if (_cursorPaletteDisabled) {
|
||||
memcpy(_cursorPalette, _texMouse.palette, 256 * 2);
|
||||
_cursorPaletteDisabled = false;
|
||||
}
|
||||
_cursorPaletteDisabled = false;
|
||||
|
||||
const byte *s = colors;
|
||||
u16 *d = _texMouse.palette;
|
||||
u16 *d = _cursorPalette;
|
||||
|
||||
for (uint i = 0; i < num; ++i, s += 3)
|
||||
for (uint i = 0; i < num; ++i, s += 3) {
|
||||
d[start + i] = _pfRGB3444.ARGBToColor(0xff, s[0], s[1], s[2]);
|
||||
}
|
||||
|
||||
_cursorPaletteDirty = true;
|
||||
updateMousePalette();
|
||||
}
|
||||
|
||||
void OSystem_Wii::copyRectToScreen(const void *buf, int pitch, int x, int y,
|
||||
@@ -788,6 +778,6 @@ void OSystem_Wii::setMouseCursor(const void *buf, uint w, uint h, int hotspotX,
|
||||
_mouseHotspotY = hotspotY;
|
||||
_cursorDontScale = dontScale;
|
||||
|
||||
if ((_texMouse.palette) && (oldKeycolor != _mouseKeyColor))
|
||||
_cursorPaletteDirty = true;
|
||||
if (_pfCursor.bytesPerPixel == 1 && oldKeycolor != _mouseKeyColor)
|
||||
updateMousePalette();
|
||||
}
|
||||
Reference in new issue
Block a user