diff --git a/include/layers_id_colors_and_visibility.h b/include/layers_id_colors_and_visibility.h index e7dea01309..af7542d19f 100644 --- a/include/layers_id_colors_and_visibility.h +++ b/include/layers_id_colors_and_visibility.h @@ -783,6 +783,22 @@ inline bool IsNonCopperLayer( LAYER_NUM aLayerId ) return aLayerId > B_Cu && aLayerId <= PCB_LAYER_ID_COUNT; } +/** + * Tests whether a layer is a copper layer, optionally including synthetic copper layers such + * as LAYER_VIA_THROUGH, LAYER_PAD_FR, etc. + * + * @param aLayerId + * @param aIncludeSyntheticCopperLayers + * @return + */ +inline bool IsCopperLayer( LAYER_NUM aLayerId, bool aIncludeSyntheticCopperLayers ) +{ + if( aIncludeSyntheticCopperLayers ) + return !IsNonCopperLayer( aLayerId ); + else + return IsCopperLayer( aLayerId ); +} + /** * Test whether a layer is a non copper and a non tech layer. * diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index f17076fdbb..99b661720c 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -346,7 +346,7 @@ COLOR4D PCB_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) cons // m_highContrastLayers, but it's not sufficiently fine-grained as it can't differentiate // between (for instance) a via which is flashed on the primary layer and one that is not. // So we need to refine isActive to be more discriminating for some items. - if( primary != UNDEFINED_LAYER && IsCopperLayer( primary ) ) + if( IsCopperLayer( primary ) ) { if( item->Type() == PCB_TRACE_T || item->Type() == PCB_ARC_T ) { @@ -364,8 +364,9 @@ COLOR4D PCB_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) cons flashed = static_cast( item )->FlashLayer( primary, true ); // For pads and vias, we only want to override the active state for copper layers - // (this includes synthetic layers) - if( !IsNonCopperLayer( aLayer ) ) + // (both board copper layers such as F_Cu *and* synthetic copper layers such as + // LAYER_VIA_THROUGH). + if( IsCopperLayer( aLayer, true ) ) isActive = flashed; } }