Commit 017da2d1 authored by Ryan C. Gordon's avatar Ryan C. Gordon

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
parent 47107f28
......@@ -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 ) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment