Fixed Valgrind warning caused by always reading four bytes at a time from the
cursor source buffer. svn-id: r45558
This commit is contained in:
parent
43f476b571
commit
773bc170a3
1 changed files with 6 additions and 4 deletions
|
@ -1543,7 +1543,6 @@ void OSystem_SDL::blitCursor() {
|
||||||
const byte *srcPtr = _mouseData;
|
const byte *srcPtr = _mouseData;
|
||||||
#ifdef USE_RGB_COLOR
|
#ifdef USE_RGB_COLOR
|
||||||
uint32 color;
|
uint32 color;
|
||||||
uint32 colormask = (1 << (_cursorFormat.bytesPerPixel << 3)) - 1;
|
|
||||||
#else
|
#else
|
||||||
byte color;
|
byte color;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1582,10 +1581,13 @@ void OSystem_SDL::blitCursor() {
|
||||||
for (j = 0; j < w; j++) {
|
for (j = 0; j < w; j++) {
|
||||||
#ifdef USE_RGB_COLOR
|
#ifdef USE_RGB_COLOR
|
||||||
if (_cursorFormat.bytesPerPixel > 1) {
|
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
|
if (color != _mouseKeyColor) { // transparent, don't draw
|
||||||
uint8 r,g,b;
|
uint8 r, g, b;
|
||||||
_cursorFormat.colorToRGB(color,r,g,b);
|
_cursorFormat.colorToRGB(color, r, g, b);
|
||||||
*(uint16 *)dstPtr = SDL_MapRGB(_mouseOrigSurface->format,
|
*(uint16 *)dstPtr = SDL_MapRGB(_mouseOrigSurface->format,
|
||||||
r, g, b);
|
r, g, b);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue