Prevent division-by-zero in WarpMouse if surface's pitch is zero (a GL surface?).
--- a/src/video/SDL_cursor.c Thu Oct 20 06:55:26 2005 +0000
+++ b/src/video/SDL_cursor.c Sun Oct 30 05:45:46 2005 +0000
@@ -303,9 +303,14 @@
}
/* If we have an offset video mode, offset the mouse coordinates */
- x += (this->screen->offset % this->screen->pitch) /
- this->screen->format->BytesPerPixel;
- y += (this->screen->offset / this->screen->pitch);
+ if (this->screen->pitch == 0) {
+ x += this->screen->offset / this->screen->format->BytesPerPixel;
+ y += this->screen->offset;
+ } else {
+ x += (this->screen->offset % this->screen->pitch) /
+ this->screen->format->BytesPerPixel;
+ y += (this->screen->offset / this->screen->pitch);
+ }
/* This generates a mouse motion event */
if ( video->WarpWMCursor ) {