From 4eb0e70ddf13193d53f34ff069f15b6772dd2b00 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand <seth@kipro-pcb.com> Date: Sun, 2 Feb 2025 09:33:11 -0600 Subject: [PATCH] Fix issue preventing printing on some platforms Linux printing for some systems blanked the printouts when the gal screensize was set here. Restoring the screensize after clearing ensures that the view redraw is properly scaled Fixes https://gitlab.com/kicad/code/kicad/issues/19807 --- common/board_printout.cpp | 6 ++++++ eeschema/printing/sch_printout.cpp | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/common/board_printout.cpp b/common/board_printout.cpp index e0bf8ad316..4b193e686f 100644 --- a/common/board_printout.cpp +++ b/common/board_printout.cpp @@ -175,8 +175,14 @@ void BOARD_PRINTOUT::DrawPage( const wxString& aLayerName, int aPageNum, int aPa gal->SetLookAtPoint( drawingAreaBBox.Centre() ); gal->SetZoomFactor( m_settings.m_scale ); gal->SetClearColor( dstSettings->GetBackgroundColor() ); + + // Clearing the screen for the background color needs the screen set to the page size + // in pixels. This can ?somehow? prevent some but not all foreground elements from being printed + // TODO: figure out what's going on here and fix printing. See also sch_printout + VECTOR2I size = gal->GetScreenPixelSize(); gal->ResizeScreen( pageSizePx.GetWidth(),pageSizePx.GetHeight() ); gal->ClearScreen(); + gal->ResizeScreen( size.x, size.y ); if( m_gerbviewPrint ) // Mandatory in Gerbview to use the same order for printing as for screen redraw diff --git a/eeschema/printing/sch_printout.cpp b/eeschema/printing/sch_printout.cpp index 2000ad25a0..86b91bdeb8 100644 --- a/eeschema/printing/sch_printout.cpp +++ b/eeschema/printing/sch_printout.cpp @@ -429,8 +429,14 @@ bool SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen, wxDC* aDC, bool aForPrinting gal->SetLookAtPoint( drawingAreaBBox.Centre() ); gal->SetZoomFactor( print_scale ); gal->SetClearColor( dstSettings->GetBackgroundColor() ); + + // Clearing the screen for the background color needs the screen set to the page size + // in pixels. This can ?somehow? prevent some but not all foreground elements from being printed + // TODO: figure out what's going on here and fix printing. See also board_printout + VECTOR2I size = gal->GetScreenPixelSize(); gal->ResizeScreen( pageSizePix.GetWidth(),pageSizePix.GetHeight() ); gal->ClearScreen(); + gal->ResizeScreen( size.x, size.y ); // Needed to use the same order for printing as for screen redraw view->UseDrawPriority( true );