Skip navigation.
 
mlRe: drawing in a separate thread
FROM : Graham Cox
DATE : Sat May 03 16:11:21 2008

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 resets the list. If the drawRect: method is call 
> faster than what the background thread can process, the Cocoa effort 
> to coalesce updates is lost.


Ah, OK, I see what you were saying - I should keep clumping together 
new dirty rects as they are marked until the *thread* has dealt with 
them. Might be a good idea - though to be honest sounds like it could 
be computationally complex. Even just splitting up two overlapping 
rects (in a question a couple of weeks ago) was a bit of a head-
scratcher - this sounds ten times worse ;-)

> Even if such API exists, it will be useless with multi-threading, as 
> a view assume that after a drawRect: call, all rects that was marked 
> for update are now updated. And so, the "dirty rects" list will not 
> be synchronize with the real state of the view.


I agree, the update rects would be stale by the time the thread gets 
around to using them. That's already the problem I'm having with 
moving objects losing their edges when dragging. But with such an API 
the *thread* could grab those rects just before drawing at least 
minimising the "time to become stale" which would reduce if not 
eliminate the problem.

I still see no theoretical way around this basic problem with dirty 
rects being generated on one thread and being updated on another (if 
the dirty rects are changing rapidly, which they are much of the time).

One thing that would dramatically improve drawing times is if NSShadow 
wasn't so dog-slow. That's part of the *real* problem I'm having :(

Frankly I'm about ready to give up on this - seems more trouble than 
it's worth.

G._______________________________________________

Cocoa-dev mailing list (<email_removed>)

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/<email_removed>

This email sent to <email_removed>

Related mailsAuthorDate
mldrawing in a separate thread Graham Cox May 2, 09:13
mlRe: drawing in a separate thread Kyle Sluder May 2, 10:13
mlRe: drawing in a separate thread Graham Cox May 2, 13:07
mlRe: drawing in a separate thread Jean-Daniel Dupas May 2, 13:20
mlRe: drawing in a separate thread Jens Alfke May 2, 17:27
mlRe: drawing in a separate thread Graham Cox May 2, 17:30
mlRe: drawing in a separate thread Jean-Daniel Dupas May 2, 18:04
mlRe: drawing in a separate thread Duncan May 3, 05:40
mlRe: drawing in a separate thread Graham Cox May 3, 06:51
mlRe: drawing in a separate thread Duncan May 3, 13:36
mlRe: drawing in a separate thread Jean-Daniel Dupas May 3, 13:57
mlRe: drawing in a separate thread Graham Cox May 3, 14:52
mlRe: drawing in a separate thread Jean-Daniel Dupas May 3, 15:22
mlRe: drawing in a separate thread Graham Cox May 3, 15:30
mlRe: drawing in a separate thread Ricky Sharp May 3, 15:44
mlRe: drawing in a separate thread Jean-Daniel Dupas May 3, 15:55
mlRe: drawing in a separate thread Graham Cox May 3, 16:11