• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: CALayer maybe silly question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CALayer maybe silly question


  • Subject: Re: CALayer maybe silly question
  • From: vincent habchi <email@hidden>
  • Date: Wed, 27 Jan 2010 16:27:34 +0100

David,

Le 25 janv. 2010 à 21:39, David Duncan a écrit :

> If you want to draw to a layer on a separate thread, you need to run the runloop on that thread, as Core Animation is pretty highly dependent on the run loop operating. If you call -setNeedsDisplay on a thread where you never run the runloop, then it is likely that the layer's -display method will not be called until the thread terminates, which is likely your issue.

I've done that (I had to swallow all the doc, that was a headache ;)), but to no avail.

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.

If I understand the docs correctly – despite not being a native English speaker – there is one graphic context per thread, so, instead of passing the CGContextRef to the drawing thread, which obviously crashes unless a lock is set, shall I spawn a new thread that will create the CAScrollLayer and its sublayers? If yes, is there somehow a way to refresh the tiles concurrently?

Somehow, I think that one cannot return immediately from DrawLayer:InContext: and refresh the layer in background. Everything has to be in place since the recaching takes place immediately after. Is that correct?

Thanks,
Vincent_______________________________________________

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

  • Follow-Ups:
    • Re: CALayer maybe silly question
      • From: David Duncan <email@hidden>
References: 
 >CALayer maybe silly question (From: vincent habchi <email@hidden>)
 >Re: CALayer maybe silly question (From: David Duncan <email@hidden>)

  • Prev by Date: Re: Re: Localization help
  • Next by Date: Re: AppleEvent memory leak
  • Previous by thread: Re: CALayer maybe silly question
  • Next by thread: Re: CALayer maybe silly question
  • Index(es):
    • Date
    • Thread