Cairo GAL: fix incorrect arc position in mirror mode. It happens in print mode and also when the Pcb view is flipped.

Fixes: lp:1824720
https://bugs.launchpad.net/kicad/+bug/1824720

Fixes: lp:1822772
https://bugs.launchpad.net/kicad/+bug/1822772

Fixes: lp:1823147
https://bugs.launchpad.net/kicad/+bug/1823147
This commit is contained in:
jean-pierre charras 2019-05-06 11:28:14 +02:00
parent d3fd74246f
commit c56e540e5d
1 changed files with 23 additions and 0 deletions

View File

@ -259,6 +259,17 @@ void CAIRO_GAL_BASE::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, doub
{
syncLineWidth();
// When the view is flipped, the coordinates are flipped by the matrix transform
// However, arc angles need a small change: swapping start and end, *without changing*
// the arc orientation.
// TODO: see the changes if the flip is for the Y axis
if( IsFlippedX() )
{
double delta = aEndAngle - aStartAngle;
aEndAngle = aStartAngle;
aStartAngle -= delta;
}
SWAP( aStartAngle, >, aEndAngle );
auto startAngleS = angle_xform( aStartAngle );
auto endAngleS = angle_xform( aEndAngle );
@ -304,6 +315,18 @@ void CAIRO_GAL_BASE::DrawArcSegment( const VECTOR2D& aCenterPoint, double aRadiu
}
syncLineWidth();
// When the view is flipped, the coordinates are flipped by the matrix transform
// However, arc angles need a small change: swapping start and end, *without changing*
// the arc orientation.
// TODO: see the changes if the flip is for the Y axis
if( IsFlippedX() )
{
double delta = aEndAngle - aStartAngle;
aEndAngle = aStartAngle;
aStartAngle -= delta;
}
SWAP( aStartAngle, >, aEndAngle );
auto startAngleS = angle_xform( aStartAngle );
auto endAngleS = angle_xform( aEndAngle );