QZ_LockHWSurface() should always check for changes to the screen surface.

Apparently these pointers can change if the user has multiple displays and
 moves a window between them, and probably other similar cases.

Thanks to Kirk Baker for the patch!

--HG--
branch : SDL-1.2
extra : rebase_source : 3a2684f4ab920927e1299400e3bc894bebee3bcf
This commit is contained in:
Ryan C. Gordon 2011-06-04 15:33:50 -04:00
parent 2d65370f45
commit 9f494c72db

View file

@ -1249,6 +1249,16 @@ static int QZ_FillHWRect (_THIS, SDL_Surface *dst, SDL_Rect *rect, Uint32 color
static int QZ_LockHWSurface(_THIS, SDL_Surface *surface)
{
/*
* Always get latest bitmap address and rowbytes for the screen surface;
* they can change dynamically (user has multiple monitors, etc).
*/
if (surface == SDL_VideoSurface) {
surface->pixels = (void*) CGDisplayBaseAddress (kCGDirectMainDisplay);
surface->pitch = CGDisplayBytesPerRow (kCGDirectMainDisplay);
return (surface->pixels != NULL);
}
return 1;
}