Skip to content

Commit

Permalink
QZ_LockHWSurface() should always check for changes to the screen surf…
Browse files Browse the repository at this point in the history
…ace.

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!
  • Loading branch information
icculus committed Jun 4, 2011
1 parent 518f1d0 commit 3315ad7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/video/quartz/SDL_QuartzVideo.m
Expand Up @@ -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;
}

Expand Down

0 comments on commit 3315ad7

Please sign in to comment.