From 71b4b3dcba134a76d7490daf65523a6042efb94d Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 7 Jan 2010 15:28:58 +0000 Subject: - Adapt documentation, that keycolor in setMouseCursor may not exceed the maximum color value of the specified format. - Change SDL backend to assert out on invalid keycolor values In case we really need a way to specify "no keycolor" we need to discuss on how to do it *properly*. svn-id: r47123 --- backends/platform/sdl/graphics.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'backends/platform') diff --git a/backends/platform/sdl/graphics.cpp b/backends/platform/sdl/graphics.cpp index e02e2f0d1d..ce3647d6fb 100644 --- a/backends/platform/sdl/graphics.cpp +++ b/backends/platform/sdl/graphics.cpp @@ -1490,9 +1490,11 @@ void OSystem_SDL::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, _cursorFormat = Graphics::PixelFormat::createFormatCLUT8(); else if (format->bytesPerPixel <= _screenFormat.bytesPerPixel) _cursorFormat = *format; - keycolor &= (1 << (_cursorFormat.bytesPerPixel << 3)) - 1; + + if (_cursorFormat.bytesPerPixel < 4) + assert(keycolor < (uint)(1 << (_cursorFormat.bytesPerPixel << 3))); #else - keycolor &= 0xFF; + assert(keycolor <= 0xFF); #endif if (w == 0 || h == 0) -- cgit v1.2.3