PDF Plotter: handle edge-case arc/circle drawing correctly

Fixes: lp:1752771
* https://bugs.launchpad.net/kicad/+bug/1752771
This commit is contained in:
Jon Evans 2018-03-13 21:01:01 -04:00
parent 2f86b497d9
commit 543faa385b
1 changed files with 13 additions and 0 deletions

View File

@ -187,6 +187,16 @@ void PDF_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_T aFill, int wi
*/ */
SetCurrentLineWidth( width ); SetCurrentLineWidth( width );
// If diameter is less than width, switch to filled mode
if( aFill == NO_FILL && diametre < width )
{
aFill = FILLED_SHAPE;
SetCurrentLineWidth( 0 );
radius = userToDeviceSize( ( diametre / 2.0 ) + ( width / 2.0 ) );
}
double magic = radius * 0.551784; // You don't want to know where this come from double magic = radius * 0.551784; // You don't want to know where this come from
// This is the convex hull for the bezier approximated circle // This is the convex hull for the bezier approximated circle
@ -226,7 +236,10 @@ void PDF_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, i
{ {
wxASSERT( workFile ); wxASSERT( workFile );
if( radius <= 0 ) if( radius <= 0 )
{
Circle( centre, width, FILLED_SHAPE, 0 );
return; return;
}
/* Arcs are not so easily approximated by beziers (in the general case), /* Arcs are not so easily approximated by beziers (in the general case),
so we approximate them in the old way */ so we approximate them in the old way */