Re: setNeedsDisplayInRect
Re: setNeedsDisplayInRect
- Subject: Re: setNeedsDisplayInRect
- From: Shawn Erickson <email@hidden>
- Date: Fri, 30 Jul 2004 13:42:24 -0700
On Jul 30, 2004, at 1:20 PM, Rick Bischoff wrote:
Hello,
In my custom view, I make use of (what I thought to be anyway)
selectively drawing certain content depending on the rectangle passed
in via NSView's "drawRect:" method. However, after some testing, I
have determined that two calls to "setNeedsDisplayInRect:", when they
are close by in execution sequence, only the second one goes through.
Expected behavior would have been either to: (Let X be call 1's
rectangle and Y be call 2's)
1) Call drawRect:X and then drawRect:Y
2) Z = NSUnionRect(X,Y) and then drawRect:Z
Instead the framework is simply calling drawRect:Y, leaving a lot of
area in my view unupdated.
So, the questions are -- A) Why does it not choose options 1 or 2
above? and B) Did I waste my time checking rectangle intersections in
drawRect to selectively draw portions of my view?
The default behavior for the rectangle when drawRect: is called is
basically 2 as outlined above. For a given event cycle the overall
dirty rectangle for a view is the union of calls to
setNeedsDisplayInRect: against that view for that cycle.
So how are you calling setNeedsDisplayInRect: ? From multiple threads?
With the correct rectangles?
Note what is outline on the following page...
<
http://developer.apple.com/documentation/Cocoa/Conceptual/DrawViews/
Tasks/OptimizingDrawing.html>
-Shawn
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.