Fix the order of evaluation in the arc printing

MapAngles will adjust by small amounts the angles t1 and t2.  This
adjustment will determine the CW/CCW drawing.  Therefore, the MapAngles
needs to be called explicitly before the Normalize180() call.
Left-to-Right evaluation is not a given for MSVC

Fixes https://gitlab.com/kicad/code/kicad/issues/11050

(cherry picked from commit c9fb95b888)
This commit is contained in:
Seth Hillbrand 2022-03-07 16:41:26 -08:00
parent 1394509734
commit 38ac1b2f2d
1 changed files with 6 additions and 1 deletions

View File

@ -256,7 +256,12 @@ void LIB_SHAPE::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
CalcArcAngles( t1, t2 );
if( aTransform.MapAngles( &t1, &t2 ) == ( NormalizeAngle180( t1 - t2 ) > 0 ) )
// N.B. The order of evaluation is critical here as MapAngles will modify t1, t2
// and the Normalize routine depends on these modifications for the correct output
bool transformed = aTransform.MapAngles( &t1, &t2 );
bool transformed2 = ( ( t1 - t2 ).Normalize180() > 0 );
if( transformed == transformed2 )
std::swap( pt1, pt2 );
}