From 45b10f0f0961ab64c0ec1b91d440e54c45416fdc Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Wed, 22 Mar 2017 08:40:48 +0100 Subject: [PATCH] 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 --- pcbnew/convert_drawsegment_list_to_polygon.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pcbnew/convert_drawsegment_list_to_polygon.cpp b/pcbnew/convert_drawsegment_list_to_polygon.cpp index 9c233a8bde..704832a0a2 100644 --- a/pcbnew/convert_drawsegment_list_to_polygon.cpp +++ b/pcbnew/convert_drawsegment_list_to_polygon.cpp @@ -630,11 +630,15 @@ bool BuildBoardPolygonOutlines( BOARD* aBoard, // Creates a valid polygon outline is not possible. // So uses the board edge cuts bounding box to create a // rectangular outline - // (when no edge cuts items, fillBOUNDARY build a contour + // When no edge cuts items, build a contour // from global bounding box 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. if( ( bbbox.GetWidth() ) == 0 || ( bbbox.GetHeight() == 0 ) ) bbbox.Inflate( Millimeter2iu( 1.0 ) ); @@ -643,21 +647,17 @@ bool BuildBoardPolygonOutlines( BOARD* aBoard, aOutlines.NewOutline(); wxPoint corner; - corner.x = bbbox.GetOrigin().x; - corner.y = bbbox.GetOrigin().y; - aOutlines.Append( corner.x, corner.y ); + aOutlines.Append( bbbox.GetOrigin() ); corner.x = bbbox.GetOrigin().x; corner.y = bbbox.GetEnd().y; - aOutlines.Append( corner.x, corner.y ); + aOutlines.Append( corner ); - corner.x = bbbox.GetEnd().x; - corner.y = bbbox.GetEnd().y; - aOutlines.Append( corner.x, corner.y ); + aOutlines.Append( bbbox.GetEnd() ); corner.x = bbbox.GetEnd().x; corner.y = bbbox.GetOrigin().y; - aOutlines.Append( corner.x, corner.y ); + aOutlines.Append( corner ); } return success;