From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37860) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YrZZO-00055G-5e for qemu-devel@nongnu.org; Sun, 10 May 2015 18:19:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YrZZM-0007j6-Vi for qemu-devel@nongnu.org; Sun, 10 May 2015 18:19:34 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:34107) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YrZZM-0007dd-OR for qemu-devel@nongnu.org; Sun, 10 May 2015 18:19:32 -0400 From: Peter Maydell Date: Sun, 10 May 2015 23:19:16 +0100 Message-Id: <1431296361-16981-2-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1431296361-16981-1-git-send-email-peter.maydell@linaro.org> References: <1431296361-16981-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PATCH 1/6] ui/cocoa: Drop tests for CGImageCreateWithImageInRect support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Programmingkid , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Alexander Graf , patches@linaro.org The code that tries to test at both compiletime and runtime for whether CGImageCreateWithImageInRect is supported provokes a compile warning on OSX 10.3: ui/cocoa.m:378:13: warning: comparison of function 'CGImageCreateWithImageInRect' equal to a null pointer is always false[-Wtautological-pointer-compare] if (CGImageCreateWithImageInRect == NULL) { // test if "CGImageCreateWithImageInRect" is supported on host at runtime ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~ The simplest way to deal with this is just to drop this code, since we don't in practice support OSX 10.4 anyway. (10.5 was released in 2007 and is the last PPC version, so is the earliest we really need to continue to support at all.) Signed-off-by: Peter Maydell --- ui/cocoa.m | 50 ++++++++++++++++++++------------------------------ 1 file changed, 20 insertions(+), 30 deletions(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index d1d29bc..6e69952 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -374,40 +374,30 @@ QemuCocoaView *cocoaView; 0, //interpolate kCGRenderingIntentDefault //intent ); -// test if host supports "CGImageCreateWithImageInRect" at compile time -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) - if (CGImageCreateWithImageInRect == NULL) { // test if "CGImageCreateWithImageInRect" is supported on host at runtime -#endif - // compatibility drawing code (draws everything) (OS X < 10.4) - CGContextDrawImage (viewContextRef, CGRectMake(0, 0, [self bounds].size.width, [self bounds].size.height), imageRef); -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) - } else { - // selective drawing code (draws only dirty rectangles) (OS X >= 10.4) - const NSRect *rectList; + // selective drawing code (draws only dirty rectangles) (OS X >= 10.4) + const NSRect *rectList; #if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) - NSInteger rectCount; + NSInteger rectCount; #else - int rectCount; + int rectCount; #endif - int i; - CGImageRef clipImageRef; - CGRect clipRect; - - [self getRectsBeingDrawn:&rectList count:&rectCount]; - for (i = 0; i < rectCount; i++) { - clipRect.origin.x = rectList[i].origin.x / cdx; - clipRect.origin.y = (float)screen.height - (rectList[i].origin.y + rectList[i].size.height) / cdy; - clipRect.size.width = rectList[i].size.width / cdx; - clipRect.size.height = rectList[i].size.height / cdy; - clipImageRef = CGImageCreateWithImageInRect( - imageRef, - clipRect - ); - CGContextDrawImage (viewContextRef, cgrect(rectList[i]), clipImageRef); - CGImageRelease (clipImageRef); - } + int i; + CGImageRef clipImageRef; + CGRect clipRect; + + [self getRectsBeingDrawn:&rectList count:&rectCount]; + for (i = 0; i < rectCount; i++) { + clipRect.origin.x = rectList[i].origin.x / cdx; + clipRect.origin.y = (float)screen.height - (rectList[i].origin.y + rectList[i].size.height) / cdy; + clipRect.size.width = rectList[i].size.width / cdx; + clipRect.size.height = rectList[i].size.height / cdy; + clipImageRef = CGImageCreateWithImageInRect( + imageRef, + clipRect + ); + CGContextDrawImage (viewContextRef, cgrect(rectList[i]), clipImageRef); + CGImageRelease (clipImageRef); } -#endif CGImageRelease (imageRef); } } -- 2.2.1