Re: need advice on subclassing NSScrollVIew
Re: need advice on subclassing NSScrollVIew
- Subject: Re: need advice on subclassing NSScrollVIew
- From: John Reppy <email@hidden>
- Date: Fri, 20 Mar 2009 07:46:24 -0500
On Mar 20, 2009, at 1:04 AM, Graham Cox wrote:
Double's are not going to help.
The drawing coordinates are floats. Even if you could persuade
NSScrollView to position your view to double precision, it will get
truncated to single precision for display. You'd have to rewrite all
of Quartz at 64 bit precision to see any benefit.
However, all is not lost.
A float easily exceeds a 10^9 range, so you merely need to scale
everything upwards. e.g. define 1nS to be, say, 10 points, then draw
everything else on that basis. You can then scale the whole view to
show the timeline scale you need. Scaling the view itself is
trivial, see -scaleUnitSquareToSize:
THanks for the suggestion, but I don't think that it solves my problem.
The problem is that a single-precision float only has 23+1 mantissa
bits, which
means that it cannot represent a number like 10000000001 exactly. If
I'm viewing
the log at the scale 1ns = 1pt, and my view's origin is at 10s, then
I've only
got about 10uS precision in my float values. Scaling the NSView
coordinates only
works if I keep near the origin, which is why I'm planning on tracking
the view's
origin using a double and then adjusting the coordinates before drawing.
- John
_______________________________________________
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