Be a little more careful about courtyard caches
Rather than utilizing the board timestamp, we check cached hash of the courtyard results before rebuilding
This commit is contained in:
parent
df5dd15c6f
commit
0ea02fa2ff
|
@ -67,8 +67,7 @@ FOOTPRINT::FOOTPRINT( BOARD* parent ) :
|
|||
m_visibleBBoxCacheTimeStamp( 0 ),
|
||||
m_textExcludedBBoxCacheTimeStamp( 0 ),
|
||||
m_hullCacheTimeStamp( 0 ),
|
||||
m_initial_comments( nullptr ),
|
||||
m_courtyard_cache_timestamp( 0 )
|
||||
m_initial_comments( nullptr )
|
||||
{
|
||||
m_attributes = 0;
|
||||
m_layer = F_Cu;
|
||||
|
@ -2224,7 +2223,6 @@ void FOOTPRINT::Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle )
|
|||
m_visibleBBoxCacheTimeStamp = 0;
|
||||
m_textExcludedBBoxCacheTimeStamp = 0;
|
||||
m_hullCacheTimeStamp = 0;
|
||||
m_courtyard_cache_timestamp = 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2289,7 +2287,6 @@ void FOOTPRINT::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight )
|
|||
m_boundingBoxCacheTimeStamp = 0;
|
||||
m_visibleBBoxCacheTimeStamp = 0;
|
||||
m_textExcludedBBoxCacheTimeStamp = 0;
|
||||
m_courtyard_cache_timestamp = 0;
|
||||
|
||||
m_cachedHull.Mirror( aFlipLeftRight, !aFlipLeftRight, m_pos );
|
||||
|
||||
|
@ -2391,7 +2388,6 @@ void FOOTPRINT::SetOrientation( const EDA_ANGLE& aNewAngle )
|
|||
m_boundingBoxCacheTimeStamp = 0;
|
||||
m_visibleBBoxCacheTimeStamp = 0;
|
||||
m_textExcludedBBoxCacheTimeStamp = 0;
|
||||
m_courtyard_cache_timestamp = 0;
|
||||
|
||||
m_cachedHull.Rotate( angleChange, GetPosition() );
|
||||
}
|
||||
|
@ -2799,8 +2795,11 @@ const SHAPE_POLY_SET& FOOTPRINT::GetCourtyard( PCB_LAYER_ID aLayer ) const
|
|||
{
|
||||
std::lock_guard<std::mutex> lock( m_courtyard_cache_mutex );
|
||||
|
||||
if( GetBoard() && GetBoard()->GetTimeStamp() > m_courtyard_cache_timestamp )
|
||||
if( m_courtyard_cache_front_hash != m_courtyard_cache_front.GetHash()
|
||||
|| m_courtyard_cache_back_hash != m_courtyard_cache_back.GetHash() )
|
||||
{
|
||||
const_cast<FOOTPRINT*>( this )->BuildCourtyardCaches();
|
||||
}
|
||||
|
||||
if( IsBackLayer( aLayer ) )
|
||||
return m_courtyard_cache_back;
|
||||
|
@ -2815,8 +2814,6 @@ void FOOTPRINT::BuildCourtyardCaches( OUTLINE_ERROR_HANDLER* aErrorHandler )
|
|||
m_courtyard_cache_back.RemoveAllContours();
|
||||
ClearFlags( MALFORMED_COURTYARDS );
|
||||
|
||||
m_courtyard_cache_timestamp = GetBoard()->GetTimeStamp();
|
||||
|
||||
// Build the courtyard area from graphic items on the courtyard.
|
||||
// Only PCB_SHAPE_T have meaning, graphic texts are ignored.
|
||||
// Collect items:
|
||||
|
@ -2905,6 +2902,9 @@ void FOOTPRINT::BuildCourtyardCaches( OUTLINE_ERROR_HANDLER* aErrorHandler )
|
|||
{
|
||||
SetFlags( MALFORMED_B_COURTYARD );
|
||||
}
|
||||
|
||||
m_courtyard_cache_front_hash = m_courtyard_cache_front.GetHash();
|
||||
m_courtyard_cache_back_hash = m_courtyard_cache_back.GetHash();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1049,7 +1049,8 @@ private:
|
|||
|
||||
SHAPE_POLY_SET m_courtyard_cache_front; // Note that a footprint can have both front and back
|
||||
SHAPE_POLY_SET m_courtyard_cache_back; // courtyards populated.
|
||||
mutable int m_courtyard_cache_timestamp;
|
||||
mutable MD5_HASH m_courtyard_cache_front_hash;
|
||||
mutable MD5_HASH m_courtyard_cache_back_hash;
|
||||
mutable std::mutex m_courtyard_cache_mutex;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue