Re: drawing in a separate thread
Re: drawing in a separate thread
- Subject: Re: drawing in a separate thread
- From: Graham Cox <email@hidden>
- Date: Sun, 4 May 2008 00:11:21 +1000
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@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