On 04/13/2012 12:00 PM, Wayne Stambaugh wrote: > 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.
You are saying that this assert fires when precisely within wxDC::LogicalToDevice(), still within wx not inside gtk, correct? Can you give a filename and approximate line number of code please? Then we can and should add similar asserts. wxRound() use of c lib round() is not warranted, and removes compile time code reduction opportunities. > 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 > > _______________________________________________ > Mailing list: https://launchpad.net/~kicad-developers > Post to : kicad-developers@lists.launchpad.net > Unsubscribe : https://launchpad.net/~kicad-developers > More help : https://help.launchpad.net/ListHelp > _______________________________________________ Mailing list: https://launchpad.net/~kicad-developers Post to : kicad-developers@lists.launchpad.net Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp