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:
parent
47107f28ba
commit
017da2d103
1 changed files with 8 additions and 3 deletions
|
@ -303,9 +303,14 @@ void SDL_WarpMouse (Uint16 x, Uint16 y)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we have an offset video mode, offset the mouse coordinates */
|
/* If we have an offset video mode, offset the mouse coordinates */
|
||||||
x += (this->screen->offset % this->screen->pitch) /
|
if (this->screen->pitch == 0) {
|
||||||
this->screen->format->BytesPerPixel;
|
x += this->screen->offset / this->screen->format->BytesPerPixel;
|
||||||
y += (this->screen->offset / this->screen->pitch);
|
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 */
|
/* This generates a mouse motion event */
|
||||||
if ( video->WarpWMCursor ) {
|
if ( video->WarpWMCursor ) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue