From 4433259c8019ada337cd4e70b9bac1cfd13507bb Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Mon, 7 Sep 2020 11:51:55 -0400 Subject: [PATCH] Fall back on copper color when net color is not found Fixes https://gitlab.com/kicad/code/kicad/-/issues/5540 --- pcbnew/pcb_painter.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index 0cafa6aa06..12b11012a2 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -283,24 +283,24 @@ COLOR4D PCB_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) cons netColor = jj->second; } - if( netColor != COLOR4D::UNSPECIFIED ) - { - if( item->IsSelected() ) - { - // Selection brightening overrides highlighting - netColor.Brighten( m_selectFactor ); - } - else if( m_highlightEnabled ) - { - // Highlight brightens objects on all layers and darkens everything else for contrast - if( highlighted ) - netColor.Brighten( m_highlightFactor ); - else - netColor.Darken( 1.0 - m_highlightFactor ); - } + if( netColor == COLOR4D::UNSPECIFIED ) + netColor = color; - color = netColor; + if( item->IsSelected() ) + { + // Selection brightening overrides highlighting + netColor.Brighten( m_selectFactor ); } + else if( m_highlightEnabled ) + { + // Highlight brightens objects on all layers and darkens everything else for contrast + if( highlighted ) + netColor.Brighten( m_highlightFactor ); + else + netColor.Darken( 1.0 - m_highlightFactor ); + } + + color = netColor; } else if( !item->IsSelected() && m_highlightEnabled ) {