aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'backends/graphics/surfacesdl/surfacesdl-graphics.cpp')
-rw-r--r--backends/graphics/surfacesdl/surfacesdl-graphics.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index 4a6061c428..6d3b3c4750 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -1843,9 +1843,7 @@ void SurfaceSdlGraphicsManager::setMouseCursor(const void *buf, uint w, uint h,
_cursorFormat = Graphics::PixelFormat::createFormatCLUT8();
}
- if (_cursorFormat.bytesPerPixel == 4) {
- assert(keyColor == 0);
- } else {
+ if (_cursorFormat.bytesPerPixel < 4) {
assert(keyColor < 1U << (_cursorFormat.bytesPerPixel * 8));
}
@@ -1898,7 +1896,9 @@ void SurfaceSdlGraphicsManager::setMouseCursor(const void *buf, uint w, uint h,
error("Allocating _mouseOrigSurface failed");
}
- if (_cursorFormat.bytesPerPixel < 4) {
+ if (_cursorFormat.bytesPerPixel == 4) {
+ SDL_SetColorKey(_mouseOrigSurface, SDL_SRCCOLORKEY | SDL_SRCALPHA, _mouseKeyColor);
+ } else {
SDL_SetColorKey(_mouseOrigSurface, SDL_RLEACCEL | SDL_SRCCOLORKEY | SDL_SRCALPHA, kMouseColorKey);
}
}
@@ -1979,7 +1979,7 @@ void SurfaceSdlGraphicsManager::blitCursor() {
}
SDL_PixelFormat *format = _mouseOrigSurface->format;
- _mouseSurface = SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_SRCALPHA,
+ _mouseSurface = SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_SRCCOLORKEY | SDL_SRCALPHA,
rW, rH,
format->BitsPerPixel,
format->Rmask,
@@ -1987,6 +1987,8 @@ void SurfaceSdlGraphicsManager::blitCursor() {
format->Bmask,
format->Amask);
+ SDL_SetColorKey(_mouseSurface, SDL_SRCCOLORKEY | SDL_SRCALPHA, _mouseKeyColor);
+
// At least SDL 2.0.4 on Windows apparently has a broken SDL_BlitScaled
// implementation, and SDL 1 has no such API at all, and our other
// scalers operate exclusively at 16bpp, so here is a scrappy 32bpp