From c9fb95b8886bc828de0986f3a031c2aa9159adae Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Mon, 7 Mar 2022 16:41:26 -0800 Subject: [PATCH] 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 --- eeschema/lib_shape.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/eeschema/lib_shape.cpp b/eeschema/lib_shape.cpp index 60a1078b63..56353b0466 100644 --- a/eeschema/lib_shape.cpp +++ b/eeschema/lib_shape.cpp @@ -265,7 +265,12 @@ void LIB_SHAPE::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset CalcArcAngles( t1, t2 ); - if( aTransform.MapAngles( &t1, &t2 ) == ( ( t1 - t2 ).Normalize180() > ANGLE_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() > ANGLE_0 ); + + if( transformed == transformed2 ) std::swap( pt1, pt2 ); }