Don't call GetSide in FOOTPRINT::GetBoundingBox when not needed.

CPU usage: -13% when moving a board.
This commit is contained in:
Alex Shvartzkop 2024-06-20 06:01:25 +03:00
parent 48f6f837a1
commit f5be388acd
1 changed files with 3 additions and 1 deletions

View File

@ -1246,7 +1246,6 @@ const BOX2I FOOTPRINT::GetBoundingBox( bool aIncludeText, bool aIncludeInvisible
std::vector<PCB_TEXT*> texts;
const BOARD* board = GetBoard();
bool isFPEdit = board && board->IsFootprintHolder();
PCB_LAYER_ID footprintSide = GetSide();
if( board )
{
@ -1270,6 +1269,9 @@ const BOX2I FOOTPRINT::GetBoundingBox( bool aIncludeText, bool aIncludeInvisible
BOX2I bbox( m_pos );
bbox.Inflate( pcbIUScale.mmToIU( 0.25 ) ); // Give a min size to the bbox
// Calculate the footprint side
PCB_LAYER_ID footprintSide = GetSide();
for( BOARD_ITEM* item : m_drawings )
{
if( m_privateLayers.test( item->GetLayer() ) && !isFPEdit )