From af366a78b3766ebfe87ea879fa3bad5af3bf2c21 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 13 Jan 2025 11:04:16 +0100 Subject: [PATCH] Eeschema: fix correct background area size when plotting a sheet. If a sheet is bigger than the page size selected in the plotter (PC, PDF , SVG) (i.a a A3 sheet plotted scaled to A4 page) the background area size actually plotted was to small. Fixes https://gitlab.com/kicad/code/kicad/-/issues/19611 --- eeschema/sch_plotter.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/eeschema/sch_plotter.cpp b/eeschema/sch_plotter.cpp index 4624c74958..d8c8902cbc 100644 --- a/eeschema/sch_plotter.cpp +++ b/eeschema/sch_plotter.cpp @@ -250,8 +250,12 @@ void SCH_PLOTTER::plotOneSheetPDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen, if( aPlotOpts.m_useBackgroundColor && aPlotter->GetColorMode() ) { aPlotter->SetColor( aPlotter->RenderSettings()->GetBackgroundColor() ); - VECTOR2I end( aPlotter->PageSettings().GetWidthIU( schIUScale.IU_PER_MILS ), - aPlotter->PageSettings().GetHeightIU( schIUScale.IU_PER_MILS ) ); + + // Use page size selected in schematic to know the schematic bg area + const PAGE_INFO& actualPage = aScreen->GetPageSettings(); // page size selected in schematic + VECTOR2I end( actualPage.GetWidthIU( schIUScale.IU_PER_MILS ), + actualPage.GetHeightIU( schIUScale.IU_PER_MILS ) ); + aPlotter->Rect( VECTOR2I( 0, 0 ), end, FILL_T::FILLED_SHAPE, 1.0 ); } @@ -460,8 +464,11 @@ bool SCH_PLOTTER::plotOneSheetPS( const wxString& aFileName, SCH_SCREEN* aScreen { plotter->SetColor( plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) ); - VECTOR2I end( plotter->PageSettings().GetWidthIU( schIUScale.IU_PER_MILS ), - plotter->PageSettings().GetHeightIU( schIUScale.IU_PER_MILS ) ); + // Use page size selected in schematic to know the schematic bg area + const PAGE_INFO& actualPage = aScreen->GetPageSettings(); // page size selected in schematic + VECTOR2I end( actualPage.GetWidthIU( schIUScale.IU_PER_MILS ), + actualPage.GetHeightIU( schIUScale.IU_PER_MILS ) ); + plotter->Rect( VECTOR2I( 0, 0 ), end, FILL_T::FILLED_SHAPE, 1.0 ); } @@ -635,8 +642,11 @@ bool SCH_PLOTTER::plotOneSheetSVG( const wxString& aFileName, SCH_SCREEN* aScree if( aPlotOpts.m_useBackgroundColor && plotter->GetColorMode() ) { plotter->SetColor( plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) ); - VECTOR2I end( plotter->PageSettings().GetWidthIU( schIUScale.IU_PER_MILS ), - plotter->PageSettings().GetHeightIU( schIUScale.IU_PER_MILS ) ); + + // Use page size selected in schematic to know the schematic bg area + VECTOR2I end( actualPage.GetWidthIU( schIUScale.IU_PER_MILS ), + actualPage.GetHeightIU( schIUScale.IU_PER_MILS ) ); + plotter->Rect( VECTOR2I( 0, 0 ), end, FILL_T::FILLED_SHAPE, 1.0 ); }