Just wanted to say that I got it to work finally! :)

basically I thought the last part of your code, where you render the CGImage in the current context was a necessary part of the trick, I realized that it wasn't hehe...

No noticeable leaks now! Thanks a lot for this trick!


On 3-Dec-08, at 8:27 PM, Rob Keniger wrote:


On 03/12/2008, at 6:22 PM, Jean-Nicolas Jolivet wrote:

Quick question (2 actually), right now Im drawing my CIImage in a custom view... would drawing the CIImage in my view's drawRect method achieve the same (leak-free) result as your piece of code??? i.e. something simple like:
<snip>

As far as I know, as long as you are drawing the CIImage to an on- screen context there will be no memory leak, so this should be fine if the view is in an on-screen window.

Second question; my app does batch image processing so eventually I will have to draw those CIImage offscreen.. (only for the Color Control Filter actually)... I assume I have to live with the leak??


No, just use the code I posted which will prevent the leak from occurring when drawing offscreen, you just have to get an existing on-screen context to draw into. The drawing itself happens offscreen, you are just "borrowing" the on-screen context. You could get the context from anywhere as long as it's a valid on-screen context - in the example I posted I used the main window's context ([[NSApp mainWindow] graphicsContext]) but this is not the only way to do it.

--
Rob Keniger



_______________________________________________

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/silvertab%40videotron.ca

This email sent to [EMAIL PROTECTED]

Jean-Nicolas Jolivet
[EMAIL PROTECTED]
http://www.silverscripting.com

_______________________________________________

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