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:
parent
f1f26a9197
commit
b0182abbb5
|
@ -254,7 +254,6 @@ bool D_PAD::buildCustomPadPolygon( SHAPE_POLY_SET* aMergedPolygon, int aError )
|
||||||
case S_POLYGON: // polygon
|
case S_POLYGON: // polygon
|
||||||
if( bshape.m_Poly.size() < 2 )
|
if( bshape.m_Poly.size() < 2 )
|
||||||
break; // Malformed polygon.
|
break; // Malformed polygon.
|
||||||
|
|
||||||
{
|
{
|
||||||
// Insert the polygon:
|
// Insert the polygon:
|
||||||
const std::vector< wxPoint>& poly = bshape.m_Poly;
|
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 );
|
aux_polyset.Append( polyset );
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
for( unsigned ii = 0; ii < poly.size(); ii++ )
|
for( unsigned ii = 0; ii < poly.size(); ii++ )
|
||||||
aux_polyset.Append( poly[ii].x, poly[ii].y );
|
aux_polyset.Append( poly[ii].x, poly[ii].y );
|
||||||
|
|
|
@ -441,13 +441,6 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
|
||||||
// inflate/deflate a custom shape is a bit complex.
|
// inflate/deflate a custom shape is a bit complex.
|
||||||
// so build a similar pad shape, and inflate/deflate the polygonal shape
|
// 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 );
|
D_PAD dummy( *pad );
|
||||||
SHAPE_POLY_SET shape;
|
SHAPE_POLY_SET shape;
|
||||||
pad->MergePrimitivesAsPolygon( &shape );
|
pad->MergePrimitivesAsPolygon( &shape );
|
||||||
|
@ -462,6 +455,12 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
|
||||||
dummy.AddPrimitive( shape, 0 );
|
dummy.AddPrimitive( shape, 0 );
|
||||||
dummy.MergePrimitivesAsPolygon();
|
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 );
|
itemplotter.PlotPad( &dummy, color, plotMode );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue