Don't recache items unnecessarily when toggling D-code display
This commit is contained in:
parent
f60c251c12
commit
f7d0c3997d
|
@ -488,9 +488,12 @@ void GERBVIEW_FRAME::ReFillLayerWidget()
|
|||
void GERBVIEW_FRAME::SetElementVisibility( GERBVIEW_LAYER_ID aItemIdVisible,
|
||||
bool aNewState )
|
||||
{
|
||||
bool dcodes_changed = false;
|
||||
|
||||
switch( aItemIdVisible )
|
||||
{
|
||||
case LAYER_DCODES:
|
||||
dcodes_changed = m_DisplayOptions.m_DisplayDCodes != aNewState;
|
||||
m_DisplayOptions.m_DisplayDCodes = aNewState;
|
||||
break;
|
||||
|
||||
|
@ -506,6 +509,19 @@ void GERBVIEW_FRAME::SetElementVisibility( GERBVIEW_LAYER_ID aItemIdVisible,
|
|||
wxLogDebug( wxT( "GERBVIEW_FRAME::SetElementVisibility(): bad arg %d" ), aItemIdVisible );
|
||||
}
|
||||
|
||||
if( dcodes_changed )
|
||||
{
|
||||
auto view = GetGalCanvas()->GetView();
|
||||
|
||||
for( int i = 0; i < GERBER_DRAWLAYERS_COUNT; i++ )
|
||||
{
|
||||
int layer = GERBER_DRAW_LAYER( i );
|
||||
int dcode_layer = GERBER_DCODE_LAYER( layer );
|
||||
view->SetLayerVisible( dcode_layer,
|
||||
aNewState && view->IsLayerVisible( layer ) );
|
||||
}
|
||||
}
|
||||
|
||||
applyDisplaySettingsToGAL();
|
||||
m_LayersManager->SetRenderState( aItemIdVisible, aNewState );
|
||||
}
|
||||
|
@ -520,7 +536,6 @@ void GERBVIEW_FRAME::applyDisplaySettingsToGAL()
|
|||
|
||||
settings->ImportLegacyColors( m_colorsSettings );
|
||||
|
||||
view->RecacheAllItems();
|
||||
view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
|
||||
}
|
||||
|
||||
|
@ -756,7 +771,8 @@ void GERBVIEW_FRAME::SetVisibleLayers( long aLayerMask )
|
|||
bool v = ( aLayerMask & ( 1 << i ) );
|
||||
int layer = GERBER_DRAW_LAYER( i );
|
||||
canvas->GetView()->SetLayerVisible( layer, v );
|
||||
canvas->GetView()->SetLayerVisible( GERBER_DCODE_LAYER( layer ), v );
|
||||
canvas->GetView()->SetLayerVisible( GERBER_DCODE_LAYER( layer ),
|
||||
m_DisplayOptions.m_DisplayDCodes && v );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -189,12 +189,9 @@ void GERBVIEW_PAINTER::draw( /*const*/ GERBER_DRAW_ITEM* aItem, int aLayer )
|
|||
// TODO(JE) This doesn't actually work properly for ImageNegative
|
||||
bool isNegative = ( aItem->GetLayerPolarity() ^ aItem->m_GerberImageFile->m_ImageNegative );
|
||||
|
||||
// Draw DCODEs if enabled
|
||||
// Draw DCODE overlay text
|
||||
if( IsDCodeLayer( aLayer ) )
|
||||
{
|
||||
if( !m_gerbviewSettings.m_showCodes )
|
||||
return;
|
||||
|
||||
wxString codeText;
|
||||
VECTOR2D textPosition;
|
||||
double textSize;
|
||||
|
|
Loading…
Reference in New Issue