On Oct 21, 2008, at 10:54 AM, Josh Abernathy wrote:

Scott Stevenson uses an NSImage category with:

- (CGImageRef)cgImage
{
        // I'm open to better ideas. :)
        
        NSData* data = [self TIFFRepresentation];
        return CreateCGImageFromData(data);
}

So create an NSImage and use that.


Unfortunately, that will leak a CGImageRef, which can be a potentially very bad thing (since they can become large)

At the very least the method should be renamed to "createCGImage" (to indicate that the object is created and the caller needs to release it) and then explicitly call CGImageRelease in the caller after setting the CGImageRef property of the CALayer (since the CALayer will have retained it).



Glenn Andreas                      [EMAIL PROTECTED]
 <http://www.gandreas.com/> wicked fun!
quadrium | prime : build, mutate, evolve, animate : the next generation of fractal art



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to