When printing, pads are not always printed (especially on tech layers)

A printing mode is added, to force ViewGetLOD() to return 0 in printing mode (pads are always drawn)

Fixes: lp:1809528
https://bugs.launchpad.net/kicad/+bug/1809528
This commit is contained in:
jean-pierre charras 2018-12-22 13:44:49 +01:00
parent 4c184f07a6
commit dde933ba08
4 changed files with 30 additions and 5 deletions

View File

@ -119,12 +119,12 @@ void BOARD_PRINTOUT::DrawPage( const wxString& aLayerName, int aPageNum, int aPa
else // color enabled
{
for( int i = 0; i < LAYER_ID_COUNT; ++i )
{
// Cairo does not support translucent colors on PostScript surfaces
// see 'Features support by the PostScript surface' on
// ttps://www.cairographics.org/documentation/using_the_postscript_surface/
{
// Cairo does not support translucent colors on PostScript surfaces
// see 'Features support by the PostScript surface' on
// ttps://www.cairographics.org/documentation/using_the_postscript_surface/
dstSettings->SetLayerColor( i, srcSettings->GetLayerColor( i ).WithAlpha( 1.0 ) );
}
}
}
@ -165,6 +165,8 @@ void BOARD_PRINTOUT::DrawPage( const wxString& aLayerName, int aPageNum, int aPa
}
}
view->SetPrintMode( 1 );
setupGal( gal );
galPrint->SetNativePaperSize( pageSizeIn, printCtx->HasNativeLandscapeRotation() );
gal->SetLookAtPoint( bBox.Centre() );
@ -174,6 +176,8 @@ void BOARD_PRINTOUT::DrawPage( const wxString& aLayerName, int aPageNum, int aPa
KIGFX::GAL_DRAWING_CONTEXT ctx( gal );
view->Redraw();
}
view->SetPrintMode( 0 );
}

View File

@ -303,6 +303,7 @@ VIEW::VIEW( bool aIsDynamic ) :
double size = coord_limits::max() - coord_limits::epsilon();
m_boundary.SetOrigin( pos, pos );
m_boundary.SetSize( size, size );
SetPrintMode( 0 );
m_allItems.reset( new std::vector<VIEW_ITEM*> );
m_allItems->reserve( 32768 );

View File

@ -696,6 +696,19 @@ public:
*/
std::unique_ptr<VIEW> DataReference() const;
/**
* @return the printing mode.
* if return <= 0, the current mode is not a printing mode, just the draw mode
*/
int GetPrintMode() { return m_printMode; }
/**
* Set the printing mode.
* @param aPrintMode is the printing mode.
* If 0, the current mode is not a printing mode, just the draw mode
*/
void SetPrintMode( int aPrintMode ) { m_printMode = aPrintMode; }
static constexpr int VIEW_MAX_LAYERS = 512; ///< maximum number of layers that may be shown
protected:
@ -865,6 +878,10 @@ protected:
/// Flag to reverse the draw order when using draw priority
bool m_reverseDrawOrder;
/// A control for printing: m_printMode <= 0 means no printing mode (normal draw mode
/// m_printMode > 0 is a printing mode (currently means "we are in printing mode")
int m_printMode;
VIEW( const VIEW& ) = delete;
};
} // namespace KIGFX

View File

@ -1307,6 +1307,9 @@ void D_PAD::ViewGetLayers( int aLayers[], int& aCount ) const
unsigned int D_PAD::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
{
if( aView->GetPrintMode() > 0 ) // In printing mode the pad is always drawable
return 0;
const int HIDE = std::numeric_limits<unsigned int>::max();
BOARD* board = GetBoard();