diff options
author | Torbjörn Andersson | 2009-10-31 12:38:08 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2009-10-31 12:38:08 +0000 |
commit | 773bc170a3f99c26fe061ff31ab98999147e60cc (patch) | |
tree | ba5535a6e672cab19edf84ac4224672f96d85fb6 /backends | |
parent | 43f476b5716e797525abf893ae58025109857176 (diff) | |
download | scummvm-rg350-773bc170a3f99c26fe061ff31ab98999147e60cc.tar.gz scummvm-rg350-773bc170a3f99c26fe061ff31ab98999147e60cc.tar.bz2 scummvm-rg350-773bc170a3f99c26fe061ff31ab98999147e60cc.zip |
Fixed Valgrind warning caused by always reading four bytes at a time from the
cursor source buffer.
svn-id: r45558
Diffstat (limited to 'backends')
-rw-r--r-- | backends/platform/sdl/graphics.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/backends/platform/sdl/graphics.cpp b/backends/platform/sdl/graphics.cpp index ff09e5bc8f..47f9db8688 100644 --- a/backends/platform/sdl/graphics.cpp +++ b/backends/platform/sdl/graphics.cpp @@ -1543,7 +1543,6 @@ void OSystem_SDL::blitCursor() { const byte *srcPtr = _mouseData; #ifdef USE_RGB_COLOR uint32 color; - uint32 colormask = (1 << (_cursorFormat.bytesPerPixel << 3)) - 1; #else byte color; #endif @@ -1582,10 +1581,13 @@ void OSystem_SDL::blitCursor() { for (j = 0; j < w; j++) { #ifdef USE_RGB_COLOR if (_cursorFormat.bytesPerPixel > 1) { - color = (*(uint32 *) srcPtr) & colormask; + if (_cursorFormat.bytesPerPixel == 2) + color = *(uint16 *)srcPtr; + else + color = *(uint32 *)srcPtr; if (color != _mouseKeyColor) { // transparent, don't draw - uint8 r,g,b; - _cursorFormat.colorToRGB(color,r,g,b); + uint8 r, g, b; + _cursorFormat.colorToRGB(color, r, g, b); *(uint16 *)dstPtr = SDL_MapRGB(_mouseOrigSurface->format, r, g, b); } |