Prevent division-by-zero in WarpMouse if surface's pitch is zero (a GL surface?).

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401166
This commit is contained in:
Ryan C. Gordon 2005-10-30 05:45:46 +00:00
parent 47107f28ba
commit 017da2d103

View file

@ -303,9 +303,14 @@ void SDL_WarpMouse (Uint16 x, Uint16 y)
}
/* 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 ) {