Fix crash with clearance is "too" negative. Same bug as #1663173

Fixes: lp:1663173
* https://bugs.launchpad.net/kicad/+bug/1663173
This commit is contained in:
Jean-Samuel Reynaud 2017-10-19 10:27:00 +02:00 committed by Wayne Stambaugh
parent 56d42c776a
commit 46edf6519c
1 changed files with 37 additions and 16 deletions

View File

@ -402,12 +402,18 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
TransformShapeWithClearanceToPolygon( outline, aDrawInfo.m_PadClearance, SEGCOUNT, 1.0 );
// Draw the polygon: Inflate creates only one convex polygon
if( outline.OutlineCount() > 0 )
{
SHAPE_LINE_CHAIN& poly = outline.Outline( 0 );
if( poly.PointCount() > 0 )
{
GRClosedPoly( aClipBox, aDC, poly.PointCount(),
(wxPoint*)&poly.Point( 0 ), false, 0,
aDrawInfo.m_Color, aDrawInfo.m_Color );
}
}
}
break;
case PAD_SHAPE_ROUNDRECT:
@ -434,12 +440,18 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
TransformRoundRectToPolygon( outline, shape_pos, size, GetOrientation(),
corner_radius, 64 );
if( outline.OutlineCount() > 0 )
{
SHAPE_LINE_CHAIN& poly = outline.Outline( 0 );
if( poly.PointCount() > 0 )
{
GRClosedPoly( aClipBox, aDC, poly.PointCount(),
(wxPoint*)&poly.Point( 0 ), aDrawInfo.m_ShowPadFilled, 0,
aDrawInfo.m_Color, aDrawInfo.m_Color );
}
}
}
if( aDrawInfo.m_PadClearance )
{
@ -452,14 +464,20 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
TransformRoundRectToPolygon( outline, shape_pos, size, GetOrientation(),
corner_radius, 32 );
if( outline.OutlineCount() > 0 )
{
// Draw the polygon: Inflate creates only one convex polygon
SHAPE_LINE_CHAIN& clearance_poly = outline.Outline( 0 );
if( clearance_poly.PointCount() > 0 )
{
GRClosedPoly( aClipBox, aDC, clearance_poly.PointCount(),
(wxPoint*)&clearance_poly.Point( 0 ), false, 0,
aDrawInfo.m_Color, aDrawInfo.m_Color );
}
}
}
}
break;
case PAD_SHAPE_CUSTOM:
@ -541,11 +559,14 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
{
poly = &clearance_outline.Outline( jj );
if( poly->PointCount() > 0 )
{
GRClosedPoly( aClipBox, aDC, poly->PointCount(),
(wxPoint*)&poly->Point( 0 ), false, 0,
aDrawInfo.m_Color, aDrawInfo.m_Color );
}
}
}
break;
}