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 11:11:19 +0200
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.
There must be something else.
Le 22 mai 07 à 10:19, Uli Kusterer a écrit :
On 22.05.2007, at 09:51, Eric MORAND wrote:
The problem is that the hash mark supposed to draw at bounds
origin is not drawn when I scroll to the right...and is drawn
multiple times when I scroll to the left ! Even so the entire
bounds area has already been filled by drawBackgroundInRect.
Can someone help me on this ?
You are asked to draw in a particular rect. Don't draw outside of
that (well, you can to make it easier, but really, it's just a
waste of cycles, because as you noticed it'll get clipped). If you
have to draw more because something was added to your ruler,
invalidate the area that needs to be redrawn (using one of the
setNeedsDisplay... methods, I'd guess). The OS tries to optimize
drawing by only drawing what has been marked as "dirty". If you
don't tell it what is dirty, it will never know to ask you to
redraw that area.
Could that be your problem?
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