Re: Drawing Invalidation Question
Re: Drawing Invalidation Question
- Subject: Re: Drawing Invalidation Question
- From: Kyle Sluder <email@hidden>
- Date: Sun, 1 Feb 2009 05:09:03 -0500
>From the View Programming Guide for Cocoa (
http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/CocoaViewsGuide/Optimizing/chapter_8_section_5.html#//apple_ref/doc/uid/TP40002978-CH11-SW4
):
"In Mac OS X version 10.3 and later, views can constrain their drawing
even further by using the NSView methods getRectsBeingDrawn:count: and
needsToDrawRect:. These methods provide direct and indirect access,
respectively, to the detailed representation of a view's invalid
areas—that is, its list of non-overlapping rectangles—that the
Application Kit maintains for each NSView instance. The Application
Kit automatically enforces clipping to this list of rectangles, and
you can further improve performance in views that do complex or
expensive drawing by having them limit their drawing to objects that
intersect any of the rectangles in this list."
The parameter to -drawRect: specifies a rectangle that includes all
those dirty rectangles. If, for example, your view consists of lots
of expensive-to-draw regions, you can test each of those regions using
-needsToDrawRect: to avoid drawing ones that aren't in a dirty region
but wind up being included in the big rectangle.
--Kyle Sluder
_______________________________________________
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