Re: drawing in a separate thread

2008-05-03 Thread Graham Cox
On 3 May 2008, at 11:55 pm, Jean-Daniel Dupas wrote: Le 3 mai 08 à 15:30, Graham Cox a écrit : Cocoa already coalesces updates in this way, so when drawRect: is called, the list of rects is the merged list. Cocoa already do this for synchronous drawing, and after each drawRect: call it

Re: drawing in a separate thread

2008-05-03 Thread Jean-Daniel Dupas
Le 3 mai 08 à 15:30, Graham Cox a écrit : Cocoa already coalesces updates in this way, so when drawRect: is called, the list of rects is the merged list. Cocoa already do this for synchronous drawing, and after each drawRect: call it resets the list. If the drawRect: method is call faste

Re: drawing in a separate thread

2008-05-03 Thread Ricky Sharp
On May 3, 2008, at 8:30 AM, Graham Cox wrote: Cocoa already coalesces updates in this way, so when drawRect: is called, the list of rects is the merged list. I does raise a question though - is there a way to get, at any point in time, the list of merged rects needing update from a view *a

Re: drawing in a separate thread

2008-05-03 Thread Graham Cox
Cocoa already coalesces updates in this way, so when drawRect: is called, the list of rects is the merged list. I does raise a question though - is there a way to get, at any point in time, the list of merged rects needing update from a view *at that point* - in other words, outside of a dr

Re: drawing in a separate thread

2008-05-03 Thread Jean-Daniel Dupas
Le 3 mai 08 à 14:52, Graham Cox a écrit : On 3 May 2008, at 9:36 pm, Duncan wrote: If you're going to do your drawing in a separate thread, you'll need to remember WHAT to draw. I wouldn't call it "hackish", I'd call it the cost of doing business that way. If you implement a job queue,

Re: drawing in a separate thread

2008-05-03 Thread Graham Cox
On 3 May 2008, at 9:36 pm, Duncan wrote: If you're going to do your drawing in a separate thread, you'll need to remember WHAT to draw. I wouldn't call it "hackish", I'd call it the cost of doing business that way. If you implement a job queue, add the list of dirty rectangles to each jo

Re: drawing in a separate thread

2008-05-03 Thread Jean-Daniel Dupas
Le 3 mai 08 à 13:36, Duncan a écrit : On May 3, 2008, at 5:00 AM, Graham Cox <[EMAIL PROTECTED]> wrote: One thing I realised after the previous posting is that the performance hit I'm seeing is because unlike the usual drawRect: case, I wasn't doing any clipping to the update area, so the

Re: drawing in a separate thread

2008-05-03 Thread Duncan
On May 3, 2008, at 5:00 AM, Graham Cox <[EMAIL PROTECTED]> wrote: One thing I realised after the previous posting is that the performance hit I'm seeing is because unlike the usual drawRect: case, I wasn't doing any clipping to the update area, so the entire view was getting repainted rath

Re: drawing in a separate thread

2008-05-02 Thread Graham Cox
On 3 May 2008, at 1:40 pm, Duncan wrote: On May 2, 2008, at 12:49 PM, Graham Cox <[EMAIL PROTECTED]> wrote: Subject: Re: drawing in a separate thread OK, I have managed to implement this after a lot of poring over the docs. I'm not sure if it's the most efficient

Re: drawing in a separate thread

2008-05-02 Thread Duncan
On May 2, 2008, at 12:49 PM, Graham Cox <[EMAIL PROTECTED]> wrote: Subject: Re: drawing in a separate thread OK, I have managed to implement this after a lot of poring over the docs. I'm not sure if it's the most efficient way to actually handle the thread communicat

Re: drawing in a separate thread

2008-05-02 Thread Jean-Daniel Dupas
Le 2 mai 08 à 17:27, Jens Alfke a écrit : On 2 May '08, at 4:20 AM, Jean-Daniel Dupas wrote: You can have a look at DistributedObject. I think you can publish a drawer object in your drawing thread and then, just call draw fro your main thread. DO might be overkill for this scenario. Th

Re: drawing in a separate thread

2008-05-02 Thread Graham Cox
OK, I have managed to implement this after a lot of poring over the docs. I'm not sure if it's the most efficient way to actually handle the thread communication, but it does work (using NSMachPort). As I hoped, there isn't a big problem with drawing the graphics as they should be, apart fr

Re: drawing in a separate thread

2008-05-02 Thread Jens Alfke
On 2 May '08, at 4:20 AM, Jean-Daniel Dupas wrote: You can have a look at DistributedObject. I think you can publish a drawer object in your drawing thread and then, just call draw fro your main thread. DO might be overkill for this scenario. The background thread really just needs to ru

Re: drawing in a separate thread

2008-05-02 Thread Jean-Daniel Dupas
You can have a look at DistributedObject. I think you can publish a drawer object in your drawing thread and then, just call draw fro your main thread. To be more generic, a worker thread may do this: - start and setup thread. - create IPC objects. (publish an object using Distributed object

Re: drawing in a separate thread

2008-05-02 Thread Graham Cox
On 2 May 2008, at 6:13 pm, Kyle Sluder wrote: On Fri, May 2, 2008 at 3:13 AM, Graham Cox <[EMAIL PROTECTED]> wrote: I realise these questions must sound rather fundamental, but nothing in the Cocoa Drawing Guide or Thread Guide really addresses them. I have used threads before to perform t

Re: drawing in a separate thread

2008-05-02 Thread Kyle Sluder
On Fri, May 2, 2008 at 3:13 AM, Graham Cox <[EMAIL PROTECTED]> wrote: > I realise these questions must sound rather fundamental, but nothing in the > Cocoa Drawing Guide or Thread Guide really addresses them. I have used > threads before to perform tasks not involving drawing, so I'm not completel