Pcbnew: fix a Regression in fallback to bounding box for board render in 3d-viewer

Fixes: lp: 1674844
https://bugs.launchpad.net/kicad/+bug/1674844
This commit is contained in:
jean-pierre charras 2017-03-22 08:40:48 +01:00
parent 72cfd38979
commit 45b10f0f09
1 changed files with 9 additions and 9 deletions

View File

@ -630,11 +630,15 @@ bool BuildBoardPolygonOutlines( BOARD* aBoard,
// Creates a valid polygon outline is not possible. // Creates a valid polygon outline is not possible.
// So uses the board edge cuts bounding box to create a // So uses the board edge cuts bounding box to create a
// rectangular outline // rectangular outline
// (when no edge cuts items, fillBOUNDARY build a contour // When no edge cuts items, build a contour
// from global bounding box // from global bounding box
EDA_RECT bbbox = aBoard->GetBoardEdgesBoundingBox(); EDA_RECT bbbox = aBoard->GetBoardEdgesBoundingBox();
// If null area, uses the global bounding box.
if( ( bbbox.GetWidth() ) == 0 || ( bbbox.GetHeight() == 0 ) )
bbbox = aBoard->ComputeBoundingBox();
// Ensure non null area. If happen, gives a minimal size. // Ensure non null area. If happen, gives a minimal size.
if( ( bbbox.GetWidth() ) == 0 || ( bbbox.GetHeight() == 0 ) ) if( ( bbbox.GetWidth() ) == 0 || ( bbbox.GetHeight() == 0 ) )
bbbox.Inflate( Millimeter2iu( 1.0 ) ); bbbox.Inflate( Millimeter2iu( 1.0 ) );
@ -643,21 +647,17 @@ bool BuildBoardPolygonOutlines( BOARD* aBoard,
aOutlines.NewOutline(); aOutlines.NewOutline();
wxPoint corner; wxPoint corner;
corner.x = bbbox.GetOrigin().x; aOutlines.Append( bbbox.GetOrigin() );
corner.y = bbbox.GetOrigin().y;
aOutlines.Append( corner.x, corner.y );
corner.x = bbbox.GetOrigin().x; corner.x = bbbox.GetOrigin().x;
corner.y = bbbox.GetEnd().y; corner.y = bbbox.GetEnd().y;
aOutlines.Append( corner.x, corner.y ); aOutlines.Append( corner );
corner.x = bbbox.GetEnd().x; aOutlines.Append( bbbox.GetEnd() );
corner.y = bbbox.GetEnd().y;
aOutlines.Append( corner.x, corner.y );
corner.x = bbbox.GetEnd().x; corner.x = bbbox.GetEnd().x;
corner.y = bbbox.GetOrigin().y; corner.y = bbbox.GetOrigin().y;
aOutlines.Append( corner.x, corner.y ); aOutlines.Append( corner );
} }
return success; return success;