From 79f532569757da18c9a6fb809c00c31bcad61b33 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Thu, 10 Feb 2022 12:34:06 -0800 Subject: [PATCH] Fix float scaling to use single fn Function `scaletoIU` was updated in a8c275ae5d but this missed other conversion points that re-implemented the same routine. This unifies the scaling for both ReadIJCoord and ReadXYCoord to use the same routine as calls from am_primitive Fixes https://gitlab.com/kicad/code/kicad/issues/10800 (cherry picked from commit d937abb5b8210116f5e1b9158e7f4413c66d86bd) --- gerbview/rs274_read_XY_and_IJ_coordinates.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/gerbview/rs274_read_XY_and_IJ_coordinates.cpp b/gerbview/rs274_read_XY_and_IJ_coordinates.cpp index a82cc55c6a..fc4894b73d 100644 --- a/gerbview/rs274_read_XY_and_IJ_coordinates.cpp +++ b/gerbview/rs274_read_XY_and_IJ_coordinates.cpp @@ -110,11 +110,7 @@ VECTOR2I GERBER_FILE_IMAGE::ReadXYCoord( char*& aText, bool aExcellonMode ) if( is_float ) { - // When X or Y (or A) values are float numbers, they are given in mm or inches - if( m_GerbMetric ) // units are mm - current_coord = KiROUND( val * GERB_IU_PER_MM ); - else // units are inches - current_coord = KiROUND( val * GERB_IU_PER_MM * 0.0254 ); + current_coord = scaletoIU( val, m_GerbMetric ); } else { @@ -202,11 +198,7 @@ VECTOR2I GERBER_FILE_IMAGE::ReadIJCoord( char*& aText ) if( is_float ) { - // When X or Y (or A) values are float numbers, they are given in mm or inches - if( m_GerbMetric ) // units are mm - current_coord = KiROUND( val * GERB_IU_PER_MM ); - else // units are inches - current_coord = KiROUND( val * GERB_IU_PER_MM * 0.0254 ); + current_coord = scaletoIU( val, m_GerbMetric ); } else {