From 2fdddb970f28e6926dca8898e4e573f59647d7a3 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 19 Jun 2022 11:57:29 +0100 Subject: [PATCH] Bug fixes for printing vias. Blind/buried and microvias didn't get their layers trimmed properly, nor did through vias with dropped pads. Fixes https://gitlab.com/kicad/code/kicad/issues/11851 (cherry picked from commit 231ac567b825df83b16529083eb8d7cad7583ce8) --- common/board_printout.cpp | 1 + include/render_settings.h | 4 ++++ pcbnew/pcb_painter.cpp | 18 ++++++++++++++++-- pcbnew/pcb_painter.h | 5 ----- pcbnew/pcbnew_printout.cpp | 3 --- 5 files changed, 21 insertions(+), 10 deletions(-) diff --git a/common/board_printout.cpp b/common/board_printout.cpp index 92ceec3ac3..03fc599169 100644 --- a/common/board_printout.cpp +++ b/common/board_printout.cpp @@ -136,6 +136,7 @@ void BOARD_PRINTOUT::DrawPage( const wxString& aLayerName, int aPageNum, int aPa setupPainter( *painter ); setupViewLayers( *view, m_settings.m_LayerSet ); + dstSettings->SetPrintLayers( m_settings.m_LayerSet ); dstSettings->SetLayerName( aLayerName ); diff --git a/include/render_settings.h b/include/render_settings.h index 7c04b42d50..4710b7b993 100644 --- a/include/render_settings.h +++ b/include/render_settings.h @@ -115,6 +115,9 @@ public: const wxString& GetLayerName() const { return m_layerName; } void SetLayerName( const wxString& aLayerName ) { m_layerName = aLayerName; } + LSET GetPrintLayers() const { return m_printLayers; } + void SetPrintLayers( LSET aLayerSet ) { m_printLayers = aLayerSet; } + /** * Clear the list of active layers. */ @@ -315,6 +318,7 @@ protected: // lines. This sets an absolute minimum. bool m_showPageLimits; bool m_isPrinting; + LSET m_printLayers; wxDC* m_printDC; // This can go away once the drawing sheet is moved to // Cairo-based printing. diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index 54c66540c8..8bce3e2b2f 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -847,9 +847,23 @@ void PCB_PAINTER::draw( const PCB_VIA* aVia, int aLayer ) { m_gal->DrawCircle( center, getDrillSize( aVia ) / 2.0 ); } - else if( aLayer == LAYER_VIA_THROUGH || m_pcbSettings.GetDrawIndividualViaLayers() ) + else if( aLayer == LAYER_VIA_THROUGH || m_pcbSettings.IsPrinting() ) { - m_gal->DrawCircle( center, aVia->GetWidth() / 2.0 ); + int annular_width = ( aVia->GetWidth() - getDrillSize( aVia ) ) / 2.0; + double radius = aVia->GetWidth() / 2.0; + bool draw = aLayer == LAYER_VIA_THROUGH; + + if( m_pcbSettings.IsPrinting() ) + draw = aVia->FlashLayer( m_pcbSettings.GetPrintLayers() ); + + if( !sketchMode ) + { + m_gal->SetLineWidth( annular_width ); + radius -= annular_width / 2.0; + } + + if( draw ) + m_gal->DrawCircle( center, radius ); } else if( aLayer == LAYER_VIA_BBLIND || aLayer == LAYER_VIA_MICROVIA ) { diff --git a/pcbnew/pcb_painter.h b/pcbnew/pcb_painter.h index 1438445845..c0b440c7be 100644 --- a/pcbnew/pcb_painter.h +++ b/pcbnew/pcb_painter.h @@ -171,9 +171,6 @@ public: inline bool GetGlobalRatsnestLinesEnabled() const { return m_globalRatsnestlines; } - bool GetDrawIndividualViaLayers() const { return m_drawIndividualViaLayers; } - void SetDrawIndividualViaLayers( bool aFlag ) { m_drawIndividualViaLayers = aFlag; } - NET_COLOR_MODE GetNetColorMode() const { return m_netColorMode; } void SetNetColorMode( NET_COLOR_MODE aMode ) { m_netColorMode = aMode; } @@ -207,8 +204,6 @@ protected: bool m_curvedRatsnestlines = true; bool m_globalRatsnestlines = true; - bool m_drawIndividualViaLayers = false; - ZONE_DISPLAY_MODE m_zoneDisplayMode; HIGH_CONTRAST_MODE m_contrastModeDisplay; RATSNEST_MODE m_ratsnestDisplayMode; diff --git a/pcbnew/pcbnew_printout.cpp b/pcbnew/pcbnew_printout.cpp index 21cc8c9f3c..07e8ee2d65 100644 --- a/pcbnew/pcbnew_printout.cpp +++ b/pcbnew/pcbnew_printout.cpp @@ -260,9 +260,6 @@ void PCBNEW_PRINTOUT::setupPainter( KIGFX::PAINTER& aPainter ) painter.GetSettings()->SetLayerColor( LAYER_VIA_HOLES, COLOR4D::BLACK ); break; } - - painter.GetSettings()->SetDrawIndividualViaLayers( - m_pcbnewSettings.m_Pagination == PCBNEW_PRINTOUT_SETTINGS::LAYER_PER_PAGE ); }