[Y-devel] Re: Measuring lengths (pixels or something else?)
Maurice van der Pot griffon26 at kfk4ever.com
Fri Feb 27 10:03:01 GMT 2004
On Fri, Feb 27, 2004 at 11:27:20AM +0200, Mikko Rantalainen wrote:
> I think not using floating point because "it causes poor
> performance" is premature optimization. Look at resent benchmarks.
> Most new CPUs achieve best throughput with floating point numbers.
> True, actual rendering of pixels must be done with integer math
> because you cannot use floating point for pointers. However,
> positioning and sizing widgets should be done with floating point
> numbers, IMO.
If you use floating point for positioning and sizing, you'll have
borders of widgets in between pixel rows. That will require anti-
aliasing that would not be necessary with integer positioning/sizing.
Users don't care if a certain widget is or isn't aligned with a
pixel boundary, they only care about how it looks and how fast it is.
Therefore I think it is a good idea to round to the nearest integer
pixel positions/sizes.
> As for the origin and length, I think it doesn't
> matter where the origin is, but I think that we should use
> mathematical coordinates like OpenGL does: positive numbers to
> towards right and top, just like in any math book.
Programmers aren't mathematicians. Most screen coordinate systems
use an origin at the top left and positive Y towards the bottom.
The only valid argument for choosing the properties of the coordinate
system is how easy it is for people to work with it.
> For nicer scaling
> with future high resolution displays, I think defining the screen to
> be always 1.0 in high and the width would be dependant on aspect
> ratio so that 1.0 would be equal length in all directions.
I can't understand what you are saying. First you are proposing to
define the screen width and heigth both as 1.0 and then you talk about
1.0 being equal length in all directions? Please clarify.
Regards,
Maurice.
More information about the Y-devel mailing list
2026 © www.Y-Windows.Org - All Rights Reserved