Re: Cutsom NSRulerView : strange problems with drawing
Re: Cutsom NSRulerView : strange problems with drawing
- Subject: Re: Cutsom NSRulerView : strange problems with drawing
- From: Eric MORAND <email@hidden>
- Date: Tue, 22 May 2007 12:15:09 +0200
Thanks for the clarifications.
Still, there is a mystery with the way NSRulverView draws. Since it
is drawing only its "dirty" rect most of the time (when the scale
change, you must be right and it must redraw its entire bounds area),
I'm wondering how its draws the areas not "dirty".
For instance, let's say I have a scroll view with a width of 650. The
ruler view is also 650 wide, and 16 pixels high. When I scroll my
scrollView 5 pixels to the right, the ruler view only draws the rect
(645, 0, 5, 16), that means only its 5 last pixels. How are the 645
previous pixels drawn ?
Is this some kind of magic ?
Le 22 mai 07 à 11:55, Uli Kusterer a écrit :
On 22.05.2007, at 11:11, Eric MORAND wrote:
Well, the standard behavior of NSRulerView tends to prove that the
drawRect... methods are allowed to draw outside the "dirty" rect :
when a ruler is scaled, it redisplays every hash marks in its
bound area (not only in the "dirty" rect) to match the stepUp and
stepDown cycles of the current measure unit.
My guess would be that either the ruler view itself or the owner of
it knows the thing is being scaled and invalidates that. The view
can draw wherever it wants, but it can't rely on being able to
redraw non-invalidated areas. That simply doesn't work reliably.
It's the API contract: To redraw something, first invalidate it.
Of course you can send off drawing commands for everything, but
it's up to AppKit to clip or draw as it pleases.
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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