diff --git a/src/osx/carbon/utilscocoa.mm b/src/osx/carbon/utilscocoa.mm index 000f6710a4..3dec92f22d 100644 --- a/src/osx/carbon/utilscocoa.mm +++ b/src/osx/carbon/utilscocoa.mm @@ -461,13 +461,14 @@ CGContextRef WXDLLIMPEXP_CORE wxOSXCreateBitmapContextFromNSImage( WX_NSImage ns hbitmap = CGBitmapContextCreate(NULL, imageSize.width*scale, imageSize.height*scale, 8, 0, wxMacGetGenericRGBColorSpace(), kCGImageAlphaPremultipliedFirst); CGContextScaleCTM( hbitmap, scale, scale ); + NSGraphicsContext *previousContext = [NSGraphicsContext currentContext]; NSGraphicsContext *nsGraphicsContext = [NSGraphicsContext graphicsContextWithGraphicsPort:hbitmap flipped:NO]; [NSGraphicsContext saveGraphicsState]; [NSGraphicsContext setCurrentContext:nsGraphicsContext]; [[NSColor whiteColor] setFill]; NSRectFill(NSMakeRect(0.0, 0.0, imageSize.width, imageSize.height)); [nsimage drawAtPoint:NSZeroPoint fromRect:NSZeroRect operation:NSCompositeCopy fraction:1.0]; - [NSGraphicsContext setCurrentContext:nsGraphicsContext]; + [NSGraphicsContext setCurrentContext:previousContext]; } return hbitmap; }