Performance: don't look up map entry twice.

Fixes https://gitlab.com/kicad/code/kicad/issues/8157
This commit is contained in:
Jeff Young 2021-04-08 23:10:09 +01:00
parent a8b40bf683
commit b83380b2ba
1 changed files with 12 additions and 6 deletions

View File

@ -1623,22 +1623,28 @@ void OPENGL_GAL::EndGroup()
void OPENGL_GAL::DrawGroup( int aGroupNumber )
{
if( m_groups[aGroupNumber] )
m_cachedManager->DrawItem( *m_groups[aGroupNumber] );
auto group = m_groups.find( aGroupNumber );
if( group != m_groups.end() )
m_cachedManager->DrawItem( *group->second );
}
void OPENGL_GAL::ChangeGroupColor( int aGroupNumber, const COLOR4D& aNewColor )
{
if( m_groups[aGroupNumber] )
m_cachedManager->ChangeItemColor( *m_groups[aGroupNumber], aNewColor );
auto group = m_groups.find( aGroupNumber );
if( group != m_groups.end() )
m_cachedManager->ChangeItemColor( *group->second, aNewColor );
}
void OPENGL_GAL::ChangeGroupDepth( int aGroupNumber, int aDepth )
{
if( m_groups[aGroupNumber] )
m_cachedManager->ChangeItemDepth( *m_groups[aGroupNumber], aDepth );
auto group = m_groups.find( aGroupNumber );
if( group != m_groups.end() )
m_cachedManager->ChangeItemDepth( *group->second, aDepth );
}