[Pkg-owncloud-commits] [owncloud-client] 87/115: OS X: Optimize Finder icon drawing code

Sandro Knauß hefee-guest at moszumanska.debian.org
Fri Aug 29 22:04:04 UTC 2014


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit d9de6e68ad552055ccc57302d8d28e14ec939b89
Author: Markus Goetz <markus at woboq.com>
Date:   Mon Aug 18 17:25:43 2014 +0200

    OS X: Optimize Finder icon drawing code
    
    Don't have an intermeditate TIFF.
---
 .../MacOSX/OwnCloudFinder/IconOverlayHandlers.m      | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/shell_integration/MacOSX/OwnCloudFinder/IconOverlayHandlers.m b/shell_integration/MacOSX/OwnCloudFinder/IconOverlayHandlers.m
index 90b22fd..14f1232 100644
--- a/shell_integration/MacOSX/OwnCloudFinder/IconOverlayHandlers.m
+++ b/shell_integration/MacOSX/OwnCloudFinder/IconOverlayHandlers.m
@@ -91,14 +91,18 @@
 
 		if (iconimage != nil)
 		{
-			CGImageSourceRef source;
-			NSData* data = [iconimage TIFFRepresentation];
-
-			source = CGImageSourceCreateWithData((CFDataRef)data, NULL);
-			CGImageRef maskRef = CGImageSourceCreateImageAtIndex(source, 0, NULL);
-			CGContextDrawImage(myContext, CGRectMake(0, 0, [icon size].width, [icon size].height), maskRef);
-			CFRelease(source);
-			CFRelease(maskRef);
+			CGRect destRect = CGRectMake(0, 0, [icon size].width, [icon size].height);
+			CGImageRef cgImage = [iconimage CGImageForProposedRect:&destRect
+														   context:[NSGraphicsContext currentContext]
+															 hints:nil];
+			if (cgImage) {
+				CGContextDrawImage(myContext, destRect, cgImage);
+				//CGImageRelease(cgImage); // leak here? if we leave this code in, Finder crashes
+				// But actually i'm not seeing a leak in Activity Monitor.. maybe it is not really leaking?
+			} else {
+				NSLog(@"No image given!!!!!11 %@", [url path]);
+			}
+
 		}
 
 		[icon unlockFocus];

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list