Re: Optimizing View Drawing Code
Re: Optimizing View Drawing Code
- Subject: Re: Optimizing View Drawing Code
- From: Stephen Blinkhorn <email@hidden>
- Date: Sat, 9 Jan 2010 19:50:37 -0600
Hi Markus,
On 8 Jan 2010, at 10:50, Markus Spoettl wrote:
Are you absolutely sure that you're not updating more than the 20
times mentioned in your initial message?
The audio back end posts a notification every 50ms to the GUI that the
display needs refreshing. The GUI checks a few things first to ensure
it isn't redrawing a view if it doesn't really need to.
Something doesn't add up - that load should be handled easily. You
may be calling it more often that you think. Also, how many views
are you updating each time the timer expires? I can imagine that if
you do that on a lot of views 20 times a second the system could go
down like that.
16 audio meter views need to be refreshed. A custom NSView is used as
the content view for the window. That view contains a number of NSBox
views - each of which contain a meter.
Also, do you really have to update the entire view each time? What
speeds up drawing a lot is specifying a dirty rect as small as
possible and restricting the actual drawing to the area inside the
rect whenever possible. May not be relevant in your case as the
bottleneck seems to be somewhere else.
I paint a CGLayer as a background/frame and then paint another layer
on top of that clipped to the required level that the meter is to
display. That all happens very quickly but I'll try specifying a
smaller drawing rect on the off chance that something changes.
Thanks,
Stephen
_______________________________________________
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