7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-20 00:21:31 +00:00

Optimize SHAPE_LINE_CHAIN::Segment slightly.

This commit is contained in:
Alex Shvartzkop 2025-01-13 05:48:44 +05:00
parent 41ef767676
commit 3a0df97dbf

View File

@ -1258,10 +1258,12 @@ int SHAPE_LINE_CHAIN::ShapeCount() const
SEG SHAPE_LINE_CHAIN::Segment( int aIndex ) const
{
if( aIndex < 0 )
aIndex += SegmentCount();
int segCount = SegmentCount();
wxCHECK( aIndex < SegmentCount() && aIndex >= 0,
if( aIndex < 0 )
aIndex += segCount;
wxCHECK( aIndex < segCount && aIndex >= 0,
m_points.size() > 0 ? SEG( m_points.back(), m_points.back() ) : SEG( 0, 0, 0, 0 ) );
if( aIndex == (int) ( m_points.size() - 1 ) && m_closed )