Jeez.

Perhaps it would be better to explain your goals, rather than fragments of an 
implementation that appears to be, on the face of it, pointless.

In a scroll view, views that are fully clipped out by the clip view, and those 
which do not intersect the dirty rects, are simply not drawn. At all. No 
drawing is faster than any other mechanism for doing drawing.

Have you simply tried adding all the controls to the document view and testing 
to see if, in fact, drawing is too slow?

Another approach to get more speed with many subviews is to use Core Animation. 
You still have all the views there for hit-testing and event handling, but 
layers are used to draw them, which should be composited more quickly than 
classic view drawing.


-getRectsBeingDrawn: isn't slow itself, but what you're doing with those rects 
probably is. Drawing tens of thousands of objects efficiently is possible 
(though if those objects are actual NSViews, all bets may be off). Basically, 
once you're over a thousand or so, you'll need to do some sort of spatial 
hashing to efficiently determine which of a set of objects needs to be drawn. 
If you are iterating a list linearly, you'll get killed by that at around the 
thousand or so mark.

--Graham




On 28/02/2012, at 11:50 AM, Keith Knauber wrote:

> In my implementation, I know enough about my very large NSView hierarchy that 
> allows me to clip and draw the
> visible hierarchy very quickly.
> If there was a faster way to getRectsBeingDrawn for an entire view hierarchy 
> in an offscreen window,
> and then reset NSWindow dirty rects needing display manually, then my divide 
> and conquer strategy could
> smoothly support 1000's of views in several offscreen windows that feed into 
> one onscreen window NSScrollView.
> My questions:
> Is there a way to quickly reset needsDisplay for all views in an offscreen 
> windows' hierarchy after the
> viewWillDraw phase is complete, without incurring the huge overhead of 
> actually drawing the hierarchy?
> Most of the time my app only needs to display < 100 NSControls... However, I 
> need to provide the user the option
> of displaying a lot more in an NSScrollView.
[]


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to