From 0aa067504006a177191f6a6644069b7109b980e3 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Thu, 27 Jun 2013 16:39:05 +0200 Subject: Cocoa: Simplify qt_mac_cgimage_to_nsimage code Since 10.6, NSImage has a sensible contructor for that. Change-Id: Ie753135ebb37630c1a70c395689bf85d4a4a01de Reviewed-by: Jake Petroules Reviewed-by: Shawn Rutledge --- src/plugins/platforms/cocoa/qcocoahelpers.mm | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'src/plugins/platforms/cocoa') diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm index 066b2d9cc1..1b3db9f63a 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.mm +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -124,16 +124,7 @@ CGImageRef qt_mac_image_to_cgimage(const QImage &img) NSImage *qt_mac_cgimage_to_nsimage(CGImageRef image) { - QCocoaAutoReleasePool pool; - NSImage *newImage = 0; - NSRect imageRect = NSMakeRect(0.0, 0.0, CGImageGetWidth(image), CGImageGetHeight(image)); - newImage = [[NSImage alloc] initWithSize:imageRect.size]; - [newImage lockFocus]; - { - CGContextRef imageContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; - CGContextDrawImage(imageContext, *(CGRect*)&imageRect, image); - } - [newImage unlockFocus]; + NSImage *newImage = [[NSImage alloc] initWithCGImage:image size:NSZeroSize]; return newImage; } -- cgit v1.2.3