Mercurial > sdl-ios-xcode
comparison src/video/SDL_cursor.c @ 1163:96ef83467667
Prevent division-by-zero in WarpMouse if surface's pitch is zero (a GL surface?).
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Sun, 30 Oct 2005 05:45:46 +0000 |
parents | af8b0f9ac2f4 |
children | f418917e0b7a |
comparison
equal
deleted
inserted
replaced
1162:2651158f59b8 | 1163:96ef83467667 |
---|---|
301 SDL_SetError("A video mode must be set before warping mouse"); | 301 SDL_SetError("A video mode must be set before warping mouse"); |
302 return; | 302 return; |
303 } | 303 } |
304 | 304 |
305 /* If we have an offset video mode, offset the mouse coordinates */ | 305 /* If we have an offset video mode, offset the mouse coordinates */ |
306 x += (this->screen->offset % this->screen->pitch) / | 306 if (this->screen->pitch == 0) { |
307 this->screen->format->BytesPerPixel; | 307 x += this->screen->offset / this->screen->format->BytesPerPixel; |
308 y += (this->screen->offset / this->screen->pitch); | 308 y += this->screen->offset; |
309 } else { | |
310 x += (this->screen->offset % this->screen->pitch) / | |
311 this->screen->format->BytesPerPixel; | |
312 y += (this->screen->offset / this->screen->pitch); | |
313 } | |
309 | 314 |
310 /* This generates a mouse motion event */ | 315 /* This generates a mouse motion event */ |
311 if ( video->WarpWMCursor ) { | 316 if ( video->WarpWMCursor ) { |
312 video->WarpWMCursor(this, x, y); | 317 video->WarpWMCursor(this, x, y); |
313 } else { | 318 } else { |