From 3d2ffc12c1dde15ebf82c5429fea73bff904ccd0 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 26 Oct 2021 22:26:11 +0100 Subject: [PATCH] Fix bugs in B&W plotting. Fixes https://gitlab.com/kicad/code/kicad/issues/9411 --- eeschema/dialogs/dialog_plot_schematic.cpp | 6 +++--- eeschema/lib_symbol.cpp | 25 +++++++++++----------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/eeschema/dialogs/dialog_plot_schematic.cpp b/eeschema/dialogs/dialog_plot_schematic.cpp index a508b8e49a..8fd3a73719 100644 --- a/eeschema/dialogs/dialog_plot_schematic.cpp +++ b/eeschema/dialogs/dialog_plot_schematic.cpp @@ -893,7 +893,7 @@ void DIALOG_PLOT_SCHEMATIC::restoreEnvironment( PDF_PLOTTER* aPlotter, void DIALOG_PLOT_SCHEMATIC::plotOneSheetPDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen, bool aPlotDrawingSheet ) { - if( m_plotBackgroundColor->GetValue() ) + if( m_plotBackgroundColor->GetValue() && aPlotter->GetColorMode() ) { aPlotter->SetColor( aPlotter->RenderSettings()->GetBackgroundColor() ); wxPoint end( aPlotter->PageSettings().GetWidthIU(), @@ -1084,7 +1084,7 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetPS( const wxString& aFileName, plotter->StartPlot(); - if( m_plotBackgroundColor->GetValue() ) + if( m_plotBackgroundColor->GetValue() && plotter->GetColorMode() ) { plotter->SetColor( plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) ); wxPoint end( plotter->PageSettings().GetWidthIU(), plotter->PageSettings().GetHeightIU() ); @@ -1213,7 +1213,7 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG( const wxString& aFileName, plotter->StartPlot(); - if( m_plotBackgroundColor->GetValue() ) + if( m_plotBackgroundColor->GetValue() && plotter->GetColorMode() ) { plotter->SetColor( plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) ); wxPoint end( plotter->PageSettings().GetWidthIU(), diff --git a/eeschema/lib_symbol.cpp b/eeschema/lib_symbol.cpp index 68433af3e3..27b7564ee0 100644 --- a/eeschema/lib_symbol.cpp +++ b/eeschema/lib_symbol.cpp @@ -550,26 +550,25 @@ void LIB_SYMBOL::Plot( PLOTTER* aPlotter, int aUnit, int aConvert, const wxPoint wxASSERT( aPlotter != nullptr ); aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) ); - bool fill = aPlotter->GetColorMode(); // draw background for filled items using background option // Solid lines will be drawn after the background for( const LIB_ITEM& item : m_drawings ) { - if( item.Type() == LIB_SHAPE_T ) - { - const LIB_SHAPE& shape = static_cast( item ); + if( item.Type() != LIB_SHAPE_T ) + continue; - // Do not draw items not attached to the current part - if( aUnit && shape.m_unit && ( shape.m_unit != aUnit ) ) - continue; + const LIB_SHAPE& shape = static_cast( item ); - if( aConvert && shape.m_convert && ( shape.m_convert != aConvert ) ) - continue; + // Do not draw items not attached to the current part + if( aUnit && shape.m_unit && ( shape.m_unit != aUnit ) ) + continue; - if( shape.GetFillType() == FILL_T::FILLED_WITH_BG_BODYCOLOR ) - shape.Plot( aPlotter, aOffset, fill, aTransform ); - } + if( aConvert && shape.m_convert && ( shape.m_convert != aConvert ) ) + continue; + + if( shape.GetFillType() == FILL_T::FILLED_WITH_BG_BODYCOLOR && aPlotter->GetColorMode() ) + shape.Plot( aPlotter, aOffset, true, aTransform ); } // Not filled items and filled shapes are now plotted @@ -595,7 +594,7 @@ void LIB_SYMBOL::Plot( PLOTTER* aPlotter, int aUnit, int aConvert, const wxPoint forceNoFill = shape.GetFillType() == FILL_T::FILLED_WITH_BG_BODYCOLOR; } - item.Plot( aPlotter, aOffset, fill && !forceNoFill, aTransform ); + item.Plot( aPlotter, aOffset, !forceNoFill, aTransform ); } }