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

CPU usage: -13% when moving a board.

(cherry picked from commit f5be388acd)
This commit is contained in:
Alex Shvartzkop 2024-06-20 06:01:25 +03:00
parent 4ede6f61b2
commit a5cbcd4abe
1 changed files with 3 additions and 1 deletions

View File

@ -986,7 +986,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 )
{
@ -1010,6 +1009,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 )