Custom pads: fix a bug when plotting the custom shape.

This bug was seen only with some shapes, not all, and only for layers having a negative margin.

Fixes: lp:1831941
https://bugs.launchpad.net/kicad/+bug/
This commit is contained in:
jean-pierre charras 2019-06-07 10:50:40 +02:00
parent f1f26a9197
commit b0182abbb5
2 changed files with 6 additions and 9 deletions

View File

@ -254,7 +254,6 @@ bool D_PAD::buildCustomPadPolygon( SHAPE_POLY_SET* aMergedPolygon, int aError )
case S_POLYGON: // polygon
if( bshape.m_Poly.size() < 2 )
break; // Malformed polygon.
{
// Insert the polygon:
const std::vector< wxPoint>& poly = bshape.m_Poly;
@ -276,7 +275,6 @@ bool D_PAD::buildCustomPadPolygon( SHAPE_POLY_SET* aMergedPolygon, int aError )
aux_polyset.Append( polyset );
}
else
for( unsigned ii = 0; ii < poly.size(); ii++ )
aux_polyset.Append( poly[ii].x, poly[ii].y );

View File

@ -441,13 +441,6 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
// inflate/deflate a custom shape is a bit complex.
// so build a similar pad shape, and inflate/deflate the polygonal shape
{
// we expect margin.x = margin.y for custom pads
if( margin.x < 0 )
// be sure the anchor pad is not bigger than the deflated shape
// because this anchor will be added to the pad shape when plotting
// the pad
pad->SetSize( padPlotsSize );
D_PAD dummy( *pad );
SHAPE_POLY_SET shape;
pad->MergePrimitivesAsPolygon( &shape );
@ -462,6 +455,12 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
dummy.AddPrimitive( shape, 0 );
dummy.MergePrimitivesAsPolygon();
// Be sure the anchor pad is not bigger than the deflated shape
// because this anchor will be added to the pad shape when plotting
// the pad. So now the polygonal shape is built, we can clamp the anchor size
if( margin.x < 0 ) // we expect margin.x = margin.y for custom pads
dummy.SetSize( padPlotsSize );
itemplotter.PlotPad( &dummy, color, plotMode );
}
break;