src/video/quartz/SDL_QuartzVideo.m
branchSDL-1.2
changeset 6157 8a1bc41db6bb
parent 6146 06ae169343e4
child 6158 6f3a2bb301d6
     1.1 --- a/src/video/quartz/SDL_QuartzVideo.m	Tue Jan 03 01:41:17 2012 -0500
     1.2 +++ b/src/video/quartz/SDL_QuartzVideo.m	Mon Jan 02 21:25:34 2012 -0800
     1.3 @@ -1149,9 +1149,8 @@
     1.4      }
     1.5  
     1.6      if (qz_window != nil) {
     1.7 -        NSGraphicsContext *ctx;
     1.8 -        ctx = [NSGraphicsContext graphicsContextWithWindow:qz_window];
     1.9 -        [NSGraphicsContext setCurrentContext:ctx];
    1.10 +        nsgfx_context = [NSGraphicsContext graphicsContextWithWindow:qz_window];
    1.11 +        [NSGraphicsContext setCurrentContext:nsgfx_context];
    1.12      }
    1.13  
    1.14      /* Setup the new pixel format */
    1.15 @@ -1507,8 +1506,12 @@
    1.16      }
    1.17      
    1.18      else {
    1.19 -        CGContextRef cgc = (CGContextRef)
    1.20 -            [[NSGraphicsContext currentContext] graphicsPort];
    1.21 +        NSGraphicsContext *ctx = [NSGraphicsContext currentContext];
    1.22 +        if (ctx != nsgfx_context) { /* uhoh, you might be rendering from another thread... */
    1.23 +            [NSGraphicsContext setCurrentContext:nsgfx_context];
    1.24 +            ctx = nsgfx_context;
    1.25 +        }
    1.26 +        CGContextRef cgc = (CGContextRef) [ctx graphicsPort];
    1.27          QZ_DrawResizeIcon (this);
    1.28          CGContextFlush (cg_context);
    1.29          CGImageRef image = CGBitmapContextCreateImage (cg_context);