Don't double-save transform for plotting DNP.

This commit is contained in:
Jeff Young 2024-04-18 11:03:37 +01:00
parent cc78196f81
commit d2c512f422
2 changed files with 16 additions and 36 deletions

View File

@ -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<LIB_PIN*> 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 )

View File

@ -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)