← Back to team overview

kicad-developers team mailing list archive

Re: specctra roundtripper

 

On 4/13/2012 10:04 AM, Dick Hollenbeck wrote:
>> Also, you may want to
>> change Mils2iu to use wxRound() so it will work for negative values.
> 
> wxRound()'s use of C lib's round() seems like overkill to me.
> Since the objective is to produce an integer, not a double, there is an easier way that
> has the possibility of letting the compiler do some of the work, i.e. in advance, on
> constants,
> without the overhead of a mandatory floating point function call.
> 
> See my latest DMils2iu() as a suggestion.
> 
> 
> Dick

wxRound may be overkill but it does one important thing that will become
apparent when I commit the code that scales the PCB_SCREEN zoom factors
to work properly with nanometer internal units.  In debug builds,
wxRound tests if the floating point result is within INT_MIN and INT_MAX
and raises an assertion if it is not.  I found out that this assertion
occurs in the wxDC::LogicalToDevice() functions when zooming way out
when Pcbnew is compiled for nanometers.  This may not bode well for
nanometers until we change to a new device context such as OpenGL.  In
the interim, I will make the new file loader support both nanometer and
deci-mil internal units just in case.

Wayne


Follow ups

References