Use high-contrast layer to inform clearance rules for outline.

Fixes https://gitlab.com/kicad/code/kicad/issues/5797
This commit is contained in:
Jeff Young 2020-09-27 00:11:07 +01:00
parent 7f33c229d8
commit 4c21668940
2 changed files with 20 additions and 4 deletions

View File

@ -82,6 +82,17 @@ public:
return m_activeLayers;
}
PCB_LAYER_ID GetActiveLayer() const
{
for( int layer : m_activeLayers )
{
if( layer >= PCBNEW_LAYER_ID_START && layer < PCB_LAYER_ID_COUNT )
return (PCB_LAYER_ID) layer;
}
return UNDEFINED_LAYER;
}
/**
* Function ClearActiveLayers
* Clears the list of active layers.

View File

@ -235,8 +235,7 @@ COLOR4D PCB_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) cons
return COLOR4D::CLEAR;
// Hide net names in "dimmed" contrast mode
if( m_contrastModeDisplay != HIGH_CONTRAST_MODE::NORMAL && IsNetnameLayer( aLayer )
&& m_activeLayers.count( aLayer ) == 0 )
if( m_hiContrastEnabled && IsNetnameLayer( aLayer ) && m_activeLayers.count( aLayer ) == 0 )
return COLOR4D::CLEAR;
// Normal path: get the layer base color
@ -530,12 +529,18 @@ void PCB_PAINTER::draw( const TRACK* aTrack, int aLayer )
if( ( m_pcbSettings.m_clearance & clearanceFlags ) == clearanceFlags )
{
int clearance;
if( m_pcbSettings.m_hiContrastEnabled )
clearance = aTrack->GetClearance( m_pcbSettings.GetActiveLayer() );
else
clearance = aTrack->GetClearance( ToLAYER_ID( aLayer ) );
m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
m_gal->SetIsFill( false );
m_gal->SetIsStroke( true );
m_gal->SetStrokeColor( color );
m_gal->DrawSegment( start, end,
width + aTrack->GetClearance( ToLAYER_ID( aLayer ) ) * 2 );
m_gal->DrawSegment( start, end, width + clearance * 2 );
}
}
}