Re: NSTrackingArea message lag
Re: NSTrackingArea message lag
- Subject: Re: NSTrackingArea message lag
- From: Graham Cox <email@hidden>
- Date: Thu, 26 Jun 2008 21:15:38 +1000
On 26 Jun 2008, at 6:33 pm, Markus Spoettl wrote:
Redrawing means setting needsDisplay. I'm using
if (![self needsDisplay]) {
[self setNeedsDisplayInRect:rect];
}
I found the needsDisplay check to speed it up a little. rect is the
tracking area.
And does that work?
I think this is your problem. After the first rect is marked as
needing update, the needsDisplay method will return YES. That then
rejects all subsequent rect marking until the next event loop and the
view has been redrawn. Then another rect gets a shot, and so on.
Simply removing that if([![self needsDisplay]) should fix your
problem, I think.
Note - this type of thing is incorrect usage (of needsDisplay) which
is one thing, but more than that, it's premature optimisation. In this
case it's "optimised" it so aggressively it no longer works at all. So
the old adage of get it working, then optimise *if necessary* should
always be borne in mind. Don't assume what seems slow is slow - do it
the dumb way first, profile, and optimise what the profiler tells you
is needed.
hth,
Graham
_______________________________________________
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