Re: Threaded drawing
Re: Threaded drawing
- Subject: Re: Threaded drawing
- From: Ken Thomases <email@hidden>
- Date: Fri, 06 Dec 2013 21:59:46 -0600
On Dec 6, 2013, at 6:05 PM, Roland King wrote:
> On 7 Dec, 2013, at 12:46 am, Graham Cox <email@hidden> wrote:
>
>>
>>
>> @synchronized( self )
>> {
>> CGContextDrawImage( ctx, tileRect, tileImage );
>> }
>> CGImageRelease( tileImage );
> You could also, instead of synchronizing the CGContextDrawImage(), which may make your threads wait for each other for some infinitessimal time, use
>
> dispatch_async( dispatch_get_main_queue(), {
> CGContextDrawImage( ctx, tileRect, tileImage );
> CGImageRelease( tileImage );
> free( bitsPtr );
> }
>
> which serializes them. And I doubt it would make a sod of difference.
It would make a difference in that it wouldn't work. The draw operations will not be performed before the CGContextRestoreGState() call nor before the NSGraphicsContext that the CGContext was obtained from has had a chance to, for example, release the CGContext. Or, if not that, then change its state values.
Regards,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden