Gerbview: fix a long standing issue: negative objects are now correctly printed.

This commit is contained in:
jean-pierre charras 2022-02-12 11:44:34 +01:00
parent 7e6829e834
commit f8d6dd1efd
3 changed files with 20 additions and 10 deletions

View File

@ -1,8 +1,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2009 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2018 CERN
* Author: Maciej Suminski <maciej.suminski@cern.ch>
*
@ -70,6 +70,7 @@ BOARD_PRINTOUT::BOARD_PRINTOUT( const BOARD_PRINTOUT_SETTINGS& aParams,
m_settings( aParams )
{
m_view = aView;
m_gerbviewPrint = false;
}
@ -85,12 +86,12 @@ void BOARD_PRINTOUT::GetPageInfo( int* minPage, int* maxPage, int* selPageFrom,
void BOARD_PRINTOUT::DrawPage( const wxString& aLayerName, int aPageNum, int aPageCount )
{
auto dc = GetDC();
wxDC* dc = GetDC();
KIGFX::GAL_DISPLAY_OPTIONS options;
auto galPrint = KIGFX::GAL_PRINT::Create( options, dc );
auto gal = galPrint->GetGAL();
auto printCtx = galPrint->GetPrintCtx();
auto painter = getPainter( gal );
std::unique_ptr<KIGFX::GAL_PRINT> galPrint = KIGFX::GAL_PRINT::Create( options, dc );
KIGFX::GAL* gal = galPrint->GetGAL();
KIGFX::PRINT_CONTEXT* printCtx = galPrint->GetPrintCtx();
std::unique_ptr<KIGFX::PAINTER> painter = getPainter( gal );
std::unique_ptr<KIGFX::VIEW> view( m_view->DataReference() );
// Target paper size
@ -175,6 +176,11 @@ void BOARD_PRINTOUT::DrawPage( const wxString& aLayerName, int aPageNum, int aPa
gal->SetClearColor( dstSettings->GetBackgroundColor() );
gal->ClearScreen();
if( m_gerbviewPrint )
// Mandatory in Gerbview to use the same order for printing as for screen redraw
// due to negative objects that need a specific order
view->UseDrawPriority( true );
{
KIGFX::GAL_DRAWING_CONTEXT ctx( gal );
view->Redraw();

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -38,6 +38,7 @@ GERBVIEW_PRINTOUT::GERBVIEW_PRINTOUT( GBR_LAYOUT* aLayout, const BOARD_PRINTOUT_
BOARD_PRINTOUT( aParams, aView, aTitle )
{
m_layout = aLayout;
m_gerbviewPrint = true;
}

View File

@ -1,8 +1,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2009 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2018 CERN
* Author: Maciej Suminski <maciej.suminski@cern.ch>
*
@ -119,6 +119,9 @@ protected:
///< Printout parameters
BOARD_PRINTOUT_SETTINGS m_settings;
/// True if the caller is Gerbview, false for Pcbnew
bool m_gerbviewPrint;
};
#endif // BOARD_PRINTOUT_H