Hello,

I'm working on optimizing a document based application, and I've found that 
overdrawing is a significant contributor to the (tolerable, but non-ideal) 
performance issues I am experiencing.

The reason overdrawing occurs is as follows:

Let's say the user draws a line in the document from point A to point B.  The 
display rect is calculated using the points on this line and inset so that the 
selection highlight of the line is also within the display rect.  
setNeedsDisplayInRect is invoked for this rectangle.

In my document view class' drawRect: method, everything in the document 
overlapping the display rectangle is drawn.  However, my pages are drawn as 
rectangular bezier paths with attached NSShadows, so I draw an entire page if 
it overlaps the display rectangle.  The problem is that even though calling 
[pagePath fill] does not actually cause the document view to actually draw the 
entire contents of the fill (but rather what overlaps the display rectangle, as 
expected), subviews outside the display rectangle that overlap the page 
rectangle are recursively displayed in their entirety.

I find this behavior to be somewhat bizarre, but nonetheless the solution seems 
to be to only draw a white rectangle using the NSIntersectionRect of both 
relevant rectangles.  However, this causes a broken-up shadow appearance.  
Should I abandon the idea of a smooth NSShadow in favor of an additional black 
rectangle with 50% opacity instead?  Is there a better way to draw a smooth 
shadow?

Any advice would be of great help.

Thanks,
- Dave H
_______________________________________________

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

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

Reply via email to