From d2c512f4224d535ede7884ca6bc6cd677c4c0749 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Thu, 18 Apr 2024 11:03:37 +0100 Subject: [PATCH] Don't double-save transform for plotting DNP. --- eeschema/sch_symbol.cpp | 44 +++++++++++++++-------------------------- eeschema/sch_symbol.h | 8 -------- 2 files changed, 16 insertions(+), 36 deletions(-) diff --git a/eeschema/sch_symbol.cpp b/eeschema/sch_symbol.cpp index 18ad998d17..e6ee9c03de 100644 --- a/eeschema/sch_symbol.cpp +++ b/eeschema/sch_symbol.cpp @@ -2427,6 +2427,9 @@ void SCH_SYMBOL::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& if( aBackground ) return; + SCH_RENDER_SETTINGS* renderSettings = getRenderSettings( aPlotter ); + COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings(); + if( m_part ) { std::vector libPins; @@ -2462,8 +2465,7 @@ void SCH_SYMBOL::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& } } - SCH_RENDER_SETTINGS* renderSettings = getRenderSettings( aPlotter ); - TRANSFORM savedTransform = renderSettings->m_Transform; + TRANSFORM savedTransform = renderSettings->m_Transform; renderSettings->m_Transform = GetTransform(); aPlotter->StartBlock( nullptr ); @@ -2481,7 +2483,18 @@ void SCH_SYMBOL::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& } if( m_DNP ) - PlotDNP( aPlotter ); + { + BOX2I bbox = GetBodyAndPinsBoundingBox(); + int strokeWidth = 3.0 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ); + + aPlotter->SetColor( colors->GetColor( LAYER_DNP_MARKER ) ); + + aPlotter->ThickSegment( bbox.GetOrigin(), bbox.GetEnd(), strokeWidth, FILLED, nullptr ); + + aPlotter->ThickSegment( bbox.GetOrigin() + VECTOR2I( bbox.GetWidth(), 0 ), + bbox.GetOrigin() + VECTOR2I( 0, bbox.GetHeight() ), + strokeWidth, FILLED, nullptr ); + } SCH_SHEET_PATH* sheet = &Schematic()->CurrentSheet(); @@ -2520,31 +2533,6 @@ void SCH_SYMBOL::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& } -void SCH_SYMBOL::PlotDNP( PLOTTER* aPlotter ) const -{ - SCH_RENDER_SETTINGS* renderSettings = getRenderSettings( aPlotter ); - TRANSFORM savedTransform = renderSettings->m_Transform; - renderSettings->m_Transform = GetTransform(); - - BOX2I bbox = GetBodyAndPinsBoundingBox(); - - COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings(); - - aPlotter->SetColor( colors->GetColor( LAYER_DNP_MARKER ) ); - - aPlotter->ThickSegment( bbox.GetOrigin(), bbox.GetEnd(), - 3.0 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ), - FILLED, nullptr ); - - aPlotter->ThickSegment( bbox.GetOrigin() + VECTOR2I( bbox.GetWidth(), 0 ), - bbox.GetOrigin() + VECTOR2I( 0, bbox.GetHeight() ), - 3.0 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ), - FILLED, nullptr ); - - renderSettings->m_Transform = savedTransform; -} - - void SCH_SYMBOL::PlotPins( PLOTTER* aPlotter ) const { if( m_part ) diff --git a/eeschema/sch_symbol.h b/eeschema/sch_symbol.h index 1704cbf49f..af397e1e5b 100644 --- a/eeschema/sch_symbol.h +++ b/eeschema/sch_symbol.h @@ -813,14 +813,6 @@ public: */ void PlotPins( PLOTTER* aPlotter ) const; - /** - * Plot the red 'X' over the symbol. This is separated to allow it being used from the - * screen plot function, overlapping the pins - * - * @param aPlotter the #PLOTTER object used to draw the X - */ - void PlotDNP( PLOTTER* aPlotter ) const; - EDA_ITEM* Clone() const override; #if defined(DEBUG)