QZ_LockHWSurface() should always check for changes to the screen surface. SDL-1.2
authorRyan C. Gordon <icculus@icculus.org>
Sat, 04 Jun 2011 15:33:50 -0400
branchSDL-1.2
changeset 5549b3577cec429d
parent 5500 27348c0ae529
child 5550 80ae1ac3bdc9
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!
src/video/quartz/SDL_QuartzVideo.m
     1.1 --- a/src/video/quartz/SDL_QuartzVideo.m	Mon Mar 21 13:33:29 2011 -0700
     1.2 +++ b/src/video/quartz/SDL_QuartzVideo.m	Sat Jun 04 15:33:50 2011 -0400
     1.3 @@ -1249,6 +1249,16 @@
     1.4  
     1.5  static int  QZ_LockHWSurface(_THIS, SDL_Surface *surface)
     1.6  {
     1.7 +    /*
     1.8 +     * Always get latest bitmap address and rowbytes for the screen surface;
     1.9 +     *  they can change dynamically (user has multiple monitors, etc).
    1.10 +     */
    1.11 +    if (surface == SDL_VideoSurface) {
    1.12 +        surface->pixels = (void*) CGDisplayBaseAddress (kCGDirectMainDisplay);
    1.13 +        surface->pitch  = CGDisplayBytesPerRow (kCGDirectMainDisplay);
    1.14 +        return (surface->pixels != NULL);
    1.15 +    }
    1.16 +
    1.17      return 1;
    1.18  }
    1.19