From decbb65f092ff153d80a66e0812cd71633d28876 Mon Sep 17 00:00:00 2001 From: Fabien Corona Date: Sat, 9 Nov 2019 16:45:51 +0100 Subject: [PATCH] High contrast color for holes in microvias and buried bias In high contrast mode, the holes of buried vias and microvias were no darkened when not on the active layer. In high contrast mode, the outer circle of buried vias and microvias were alway darkened. In high contrast mode, when the selected layer is non visible through-vias are now darkend. Fixes: lp:1844982 * https://bugs.launchpad.net/kicad/+bug/1844982 (cherry picked from commit 04edc6ceffdc3deca6e1c9ed420842b48027ac8c) --- pcbnew/pcb_painter.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index 3960aded40..18932c4827 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -243,6 +243,29 @@ const COLOR4D& PCB_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer if( item->Type() == PCB_MARKER_T ) return m_layerColors[aLayer]; + + // For vias, some layers depend on other layers in high contrast mode + if( m_hiContrastEnabled && item->Type() == PCB_VIA_T && + ( aLayer == LAYER_VIAS_HOLES || + aLayer == LAYER_VIA_THROUGH || + aLayer == LAYER_VIA_MICROVIA || + aLayer == LAYER_VIA_BBLIND ) ) + { + const VIA* via = static_cast( item ); + const BOARD* pcb = static_cast( item->GetParent() ); + bool viaActiveLayer = false; + + for( auto activeLayer : m_activeLayers ) + { + auto lay_id = static_cast( activeLayer ); + viaActiveLayer |= via->IsOnLayer( lay_id ) && pcb->IsLayerVisible( lay_id ); + } + + if( viaActiveLayer ) + return m_layerColors[aLayer]; + else + return m_hiContrastColor[aLayer]; + } } // Single net highlight mode