[Y-devel] Re: Measuring lengths (pixels or something else?)
Chris Amshey ychris at amshey.net
Fri Feb 27 10:17:16 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. 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. 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.
If you have to do the math twice, that's going to degrade performance ...
Anyway, we don't measure widgets in screen coordinates, we measure
them in local (bounding-box) coordinates.
Scaling with pixels is not really a problem, anyway: everybody has to
do it anyway, just to be resizeable.
However, my fundamental objection to the idea is that object boundaries
will not fall on pixel lines, which will cause odd artifacts. OpenGL
is handling an entirely different problem, and in any case, does not
really define the screen to be 1.0 x 1.0, that's just the default
frustum. A frustum of 1.33x1.0 usually makes more sense, but that
can be scaled up or down depending on what you're viewing... (I suppose
you could say the screen is 1.0x1.0 and the frustum is just a matrix
multiplication of the screen, but that's semantics.) none of which
has to do with desktop display; a desktop display is not trying to represent
a virtual 3d world to the limitations of the hardware, it's trying to
provide clean, useable, and if the user likes to play with themes, then
perhaps attractive controls.
> Another nice length measurement would be to follow HTML/CSS and use
> base font size as basic measurement (em). That way, if the user
> thinks that the UI looks too small, he just adjusts the default font
> size and everything scales accordingly.
This idea I like much better. ;) It's actually a very natural scaling
factor considering how many widgets have text on them anyway (labels,
menus, many buttons, text boxes, tabs... ) It's probably not something
to put into code this instant but it should definitely get noted for
getting into the theme code as it evolves.
--Chris
More information about the Y-devel mailing list
2026 © www.Y-Windows.Org - All Rights Reserved