Rename BuildPolyPointsList() to DupPolyPointsList() and optimize code

to avoid multiple useless copies of the list of polygon corners in code.
This commit is contained in:
jean-pierre charras
2021-09-11 14:21:36 +02:00
parent 09ddcdbbca
commit 3316f3998a
6 changed files with 19 additions and 21 deletions
+4 -9
View File
@@ -627,25 +627,20 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItem( const FP_SHAPE* aShape )
case SHAPE_T::POLY:
if( aShape->IsPolyShapeValid() )
{
const std::vector<wxPoint> &polyPoints = aShape->BuildPolyPointsList();
std::vector<wxPoint> cornerList;
aShape->DupPolyPointsList( cornerList );
// We must compute board coordinates from m_PolyList which are relative to the parent
// position at orientation 0
const FOOTPRINT *parentFootprint = aShape->GetParentFootprint();
std::vector<wxPoint> cornerList;
cornerList.reserve( polyPoints.size() );
for( wxPoint corner : polyPoints )
if( parentFootprint )
{
if( parentFootprint )
for( wxPoint corner : cornerList )
{
RotatePoint( &corner, parentFootprint->GetOrientation() );
corner += parentFootprint->GetPosition();
}
cornerList.push_back( corner );
}
if( sketch || thickness > 0 )