Re: Optimizing NSRectFill
Re: Optimizing NSRectFill
- Subject: Re: Optimizing NSRectFill
- From: Scott Ribe <email@hidden>
- Date: Sun, 21 Dec 2008 09:49:08 -0700
- Thread-topic: Optimizing NSRectFill
> I did a quick test.
> I have a 1ms timer which just do -setNeedDisplay: on a small view.
> And the result is that my timer callback is called 60 times per seconds.
> If I remove the seetNeedDisplay: call, it is called 1000 times (as
> expected).
>
> So I think that you're right (and that everything is synchronous) but
> I also think that the 'flush results to screen' blocks until the
> screen is ready and so limit the number of redraw to the refresh rate
> of the screen.
> If this is effectively the case, your timer trick will not be very
> helpful.
That was a surprise to me. My understanding was that the entire purpose of
setNeedsDisplay was to queue up deferred drawing requests so that they'd be
taken care of in a single later drawRect call on the effected objects.
And when I checked the tech note that you referenced, I found that it makes
this explicit:
> In Cocoa use NSView's setNeedsDisplay: to request an update for a view instead
> of the more immediate display:
I guess what Mike is proposing is that redrawing in response to
setNeedsDisplay is only deferred until the end of handling the current
event? (And therefore only improves things when there are multiple calls on
the same view.) This is at least consistent with the documentation, as far
as I know. But I had assumed that somewhere the system was putting more of
an effort into deciding when to redraw marked views. And my assumption, as
far as I can tell, was also consistent with the available documentation.
Unless I've missed something, the documentation needs clarification on this
point, *especially* that tech note.
--
Scott Ribe
email@hidden
http://www.killerbytes.com/
(303) 722-0567 voice
_______________________________________________
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