From 3ce8a4856aeaebe008a12cd28f757bca2018c466 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Wed, 30 May 2018 13:51:20 -0700 Subject: [PATCH] Remove ToLayer_ID calls from color checks Colors are assigned to virtual layers while the ToLayer_ID returns a physical layer enum. The GetLayerColor/SetLayerColor take LAYER_NUM (int) values that can be larger than the physical layer count. --- pcbnew/pcb_layer_box_selector.cpp | 2 +- pcbnew/pcb_layer_widget.cpp | 4 ++-- pcbnew/plot_brditems_plotter.cpp | 2 +- pcbnew/sel_layer.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pcbnew/pcb_layer_box_selector.cpp b/pcbnew/pcb_layer_box_selector.cpp index b2428f2df7..cf7f729e08 100644 --- a/pcbnew/pcb_layer_box_selector.cpp +++ b/pcbnew/pcb_layer_box_selector.cpp @@ -150,7 +150,7 @@ COLOR4D PCB_LAYER_BOX_SELECTOR::GetLayerColor( LAYER_NUM aLayer ) const { wxASSERT( m_boardFrame ); - return m_boardFrame->Settings().Colors().GetLayerColor( ToLAYER_ID( aLayer ) ); + return m_boardFrame->Settings().Colors().GetLayerColor( aLayer ); } diff --git a/pcbnew/pcb_layer_widget.cpp b/pcbnew/pcb_layer_widget.cpp index 2142e38349..ffcdd796d0 100644 --- a/pcbnew/pcb_layer_widget.cpp +++ b/pcbnew/pcb_layer_widget.cpp @@ -584,11 +584,11 @@ void PCB_LAYER_WIDGET::OnLayerColorChange( int aLayer, COLOR4D aColor ) // destroys the GAL color setup if( !myframe->IsGalCanvasActive() ) { - COLOR4D oldColor = myframe->Settings().Colors().GetLayerColor( ToLAYER_ID( aLayer ) ); + COLOR4D oldColor = myframe->Settings().Colors().GetLayerColor( aLayer ); aColor.a = oldColor.a; } - myframe->Settings().Colors().SetLayerColor( ToLAYER_ID( aLayer ), aColor ); + myframe->Settings().Colors().SetLayerColor( aLayer, aColor ); if( myframe->IsGalCanvasActive() ) { diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index 3c3316982a..b3ba678290 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -56,7 +56,7 @@ COLOR4D BRDITEMS_PLOTTER::getColor( LAYER_NUM aLayer ) { - COLOR4D color = m_board->Colors().GetLayerColor( ToLAYER_ID( aLayer ) ); + COLOR4D color = m_board->Colors().GetLayerColor( aLayer ); // A hack to avoid plotting ahite itmen in white color, expecting the paper // is also white: use a non white color: diff --git a/pcbnew/sel_layer.cpp b/pcbnew/sel_layer.cpp index 312013a1da..5fc59ec35a 100644 --- a/pcbnew/sel_layer.cpp +++ b/pcbnew/sel_layer.cpp @@ -61,7 +61,7 @@ protected: // Virtual function COLOR4D GetLayerColor( LAYER_NUM aLayer ) const override { - return m_frame->Settings().Colors().GetLayerColor( ToLAYER_ID( aLayer ) ); + return m_frame->Settings().Colors().GetLayerColor( aLayer ); } // Returns the name of the layer id