diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index f46bf85fdc..20f84a0fc9 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -247,6 +247,18 @@ PCB_PAINTER::PCB_PAINTER( GAL* aGal ) : } +int PCB_PAINTER::getLineThickness( int aActualThickness ) const +{ + // if items have 0 thickness, draw them with the outline + // width, otherwise respect the set value (which, no matter + // how small will produce something) + if( aActualThickness == 0 ) + return m_pcbSettings.m_outlineWidth; + + return aActualThickness; +} + + bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer ) { const EDA_ITEM* item = static_cast( aItem ); @@ -784,7 +796,7 @@ void PCB_PAINTER::draw( const DRAWSEGMENT* aSegment, int aLayer ) if( m_pcbSettings.m_sketchMode[aLayer] ) m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth ); // Outline mode else - m_gal->SetLineWidth( aSegment->GetWidth() ); // Filled mode + m_gal->SetLineWidth( getLineThickness( aSegment->GetWidth() ) ); // Filled mode switch( aSegment->GetShape() ) { @@ -871,7 +883,7 @@ void PCB_PAINTER::draw( const TEXTE_PCB* aText, int aLayer ) else { // Filled mode - m_gal->SetLineWidth( aText->GetThickness() ); + m_gal->SetLineWidth( getLineThickness( aText->GetThickness() ) ); } m_gal->SetStrokeColor( color ); @@ -899,7 +911,7 @@ void PCB_PAINTER::draw( const TEXTE_MODULE* aText, int aLayer ) else { // Filled mode - m_gal->SetLineWidth( aText->GetThickness() ); + m_gal->SetLineWidth( getLineThickness( aText->GetThickness() ) ); } m_gal->SetStrokeColor( color ); @@ -1021,7 +1033,7 @@ void PCB_PAINTER::draw( const DIMENSION* aDimension, int aLayer ) m_gal->SetStrokeColor( strokeColor ); m_gal->SetIsFill( false ); m_gal->SetIsStroke( true ); - m_gal->SetLineWidth( aDimension->GetWidth() ); + m_gal->SetLineWidth( getLineThickness( aDimension->GetWidth() ) ); // Draw an arrow m_gal->DrawLine( VECTOR2D( aDimension->m_crossBarO ), VECTOR2D( aDimension->m_crossBarF ) ); @@ -1050,7 +1062,7 @@ void PCB_PAINTER::draw( const PCB_TARGET* aTarget ) VECTOR2D position( aTarget->GetPosition() ); double size, radius; - m_gal->SetLineWidth( aTarget->GetWidth() ); + m_gal->SetLineWidth( getLineThickness( aTarget->GetWidth() ) ); m_gal->SetStrokeColor( strokeColor ); m_gal->SetIsFill( false ); m_gal->SetIsStroke( true ); diff --git a/pcbnew/pcb_painter.h b/pcbnew/pcb_painter.h index c869918620..718f619a12 100644 --- a/pcbnew/pcb_painter.h +++ b/pcbnew/pcb_painter.h @@ -228,6 +228,15 @@ protected: void draw( const DIMENSION* aDimension, int aLayer ); void draw( const PCB_TARGET* aTarget ); void draw( const MARKER_PCB* aMarker ); + + /** + * Function getLineThickness() + * Get the thickness to draw for a line (e.g. 0 thickness lines + * get a minimum value). + * @param aActualThickness line own thickness + * @return the thickness to draw + */ + int getLineThickness( int aActualThickness ) const; }; } // namespace KIGFX