BACKENDS: Fix GraphicsManager handling of empty cursors

The SDL graphics manager was just ignoring calls from CursorMan to
set the cursor to a blank cursor, which meant engines that did not
immediately send a cursor to CursorMan at startup would still show
the launcher's cursor (usually with a broken palette).

The OpenGL graphics manager would try to generate and draw an
invalid cursor surface when receiving an empty cursor.
This commit is contained in:
Colin Snover 2017-09-13 00:47:44 -05:00
parent da0a8db704
commit 5d8cf6ba42
2 changed files with 25 additions and 18 deletions

View file

@ -567,6 +567,18 @@ void applyColorKey(DstPixel *dst, const SrcPixel *src, uint w, uint h, uint dstP
} // End of anonymous namespace
void OpenGLGraphicsManager::setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
_cursorKeyColor = keycolor;
_cursorHotspotX = hotspotX;
_cursorHotspotY = hotspotY;
_cursorDontScale = dontScale;
if (!w || !h) {
delete _cursor;
_cursor = nullptr;
return;
}
Graphics::PixelFormat inputFormat;
#ifdef USE_RGB_COLOR
if (format) {
@ -602,11 +614,6 @@ void OpenGLGraphicsManager::setMouseCursor(const void *buf, uint w, uint h, int
_cursor->enableLinearFiltering(_currentState.filtering);
}
_cursorKeyColor = keycolor;
_cursorHotspotX = hotspotX;
_cursorHotspotY = hotspotY;
_cursorDontScale = dontScale;
_cursor->allocate(w, h);
if (inputFormat.bytesPerPixel == 1) {
// For CLUT8 cursors we can simply copy the input data into the