Re: CALayer maybe silly question
Re: CALayer maybe silly question
- Subject: Re: CALayer maybe silly question
- From: David Duncan <email@hidden>
- Date: Wed, 27 Jan 2010 15:09:32 -0800
On Jan 27, 2010, at 7:27 AM, vincent habchi wrote:
> Let's say I have a ScrollLayer with 9 underlying tiles (CALayer). Each tile has a delegate to provide contents via DrawLayer:inContext:. At init time, these delegates create a linked object that spawns a thread that runs its run loop (I end up therefore with 9 threads). When DrawLayer:inContext: is called, the delegates initializes the CGContextRef variable and sends a message to the run loop of the corresponding thread, starting the refresh code. I set NSLog so I know the drawing function is called. At best, I get a transitory partial display that vanishes at once. At worse, it crashes in aa_render (), called by CGStrokePath – I had to put a global lock to avoid this.
Are you calling -drawLayer:inContext: yourself? if you are, don't do that - just call -setNeedsDisplay on the layer, it will do the right thing.
But at the same time, you could probably simplify this a lot by creating CGImages with your content and then assign those images as the contents of your layers from the main thread. This is almost certainly likely to be simpler and less error prone (as well as allowing for a cleaner handoff of content).
--
David Duncan
Apple DTS Animation and Printing
_______________________________________________
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