From 543faa385b79c74641dbebe07b5f8f233b7b6bb6 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Tue, 13 Mar 2018 21:01:01 -0400 Subject: [PATCH] PDF Plotter: handle edge-case arc/circle drawing correctly Fixes: lp:1752771 * https://bugs.launchpad.net/kicad/+bug/1752771 --- common/plotters/PDF_plotter.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/common/plotters/PDF_plotter.cpp b/common/plotters/PDF_plotter.cpp index 147c649a97..6e29188b52 100644 --- a/common/plotters/PDF_plotter.cpp +++ b/common/plotters/PDF_plotter.cpp @@ -187,6 +187,16 @@ void PDF_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_T aFill, int wi */ 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 // 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 ); if( radius <= 0 ) + { + Circle( centre, width, FILLED_SHAPE, 0 ); return; + } /* Arcs are not so easily approximated by beziers (in the general case), so we approximate them in the old way */