Add some vector reservations

This commit is contained in:
Marek Roszko 2022-02-05 21:12:29 -05:00
parent 28ce11212c
commit 0a5ddb8d40
5 changed files with 16 additions and 2 deletions

View File

@ -160,6 +160,8 @@ bool OUTLINE_DECOMPOSER::approximateQuadraticBezierCurve( GLYPH_POINTS& aR
// cp0 = qp0, cp1 = qp0 + 2/3 * (qp1 - qp0), cp2 = qp2 + 2/3 * (qp1 - qp2), cp3 = qp2
GLYPH_POINTS cubic;
cubic.resize( 4 );
cubic.push_back( aBezier[0] ); // cp0
cubic.push_back( aBezier[0] + ( ( aBezier[1] - aBezier[0] ) * 2 / 3 ) ); // cp1
cubic.push_back( aBezier[2] + ( ( aBezier[1] - aBezier[2] ) * 2 / 3 ) ); // cp2

View File

@ -804,6 +804,8 @@ void GERBER_PLOTTER::Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill,
{
std::vector<VECTOR2I> cornerList;
cornerList.reserve( 5 );
// Build corners list
cornerList.push_back( p1 );
@ -1526,6 +1528,8 @@ void GERBER_PLOTTER::plotRoundRectAsRegion( const VECTOR2I& aRectCenter, const V
RR_EDGE curr_edge;
std::vector<RR_EDGE> rr_outline;
rr_outline.reserve( 4 );
// Build outline coordinates, relative to rectangle center, rotation 0:
// Top left corner 1 (and 4 to 1 left vertical side @ x=-hsizeX)

View File

@ -144,9 +144,9 @@ void PSLIKE_PLOTTER::FlashPadRect( const VECTOR2I& aPadPos, const VECTOR2I& aSiz
const EDA_ANGLE& aPadOrient, OUTLINE_MODE aTraceMode,
void* aData )
{
static std::vector<VECTOR2I> cornerList;
std::vector<VECTOR2I> cornerList;
VECTOR2I size( aSize );
cornerList.clear();
cornerList.reserve( 4 );
if( aTraceMode == FILLED )
SetCurrentLineWidth( 0 );

View File

@ -253,6 +253,8 @@ void PLOTTER::BezierCurve( const VECTOR2I& aStart, const VECTOR2I& aControl1,
int minSegLen = aLineThickness; // The segment min length to approximate a bezier curve
std::vector<VECTOR2I> ctrlPoints;
ctrlPoints.reserve( 4 );
ctrlPoints.push_back( aStart );
ctrlPoints.push_back( aControl1 );
ctrlPoints.push_back( aControl2 );
@ -295,6 +297,8 @@ void PLOTTER::markerSquare( const VECTOR2I& position, int radius )
std::vector<VECTOR2I> corner_list;
VECTOR2I corner;
corner_list.reserve( 4 );
corner.x = position.x + r;
corner.y = position.y + r;
corner_list.push_back( corner );
@ -326,6 +330,8 @@ void PLOTTER::markerLozenge( const VECTOR2I& position, int radius )
std::vector<VECTOR2I> corner_list;
VECTOR2I corner;
corner_list.reserve( 4 );
corner.x = position.x;
corner.y = position.y + radius;
corner_list.push_back( corner );

View File

@ -820,7 +820,9 @@ OPTIMIZER::BREAKOUT_LIST OPTIMIZER::rectBreakouts( int aWidth, const SHAPE* aSha
const SHAPE_RECT* rect = static_cast<const SHAPE_RECT*>(aShape);
VECTOR2I s = rect->GetSize();
VECTOR2I c = rect->GetPosition() + VECTOR2I( s.x / 2, s.y / 2 );
BREAKOUT_LIST breakouts;
breakouts.reserve( 12 );
VECTOR2I d_offset;