SCH_PAINTER, DrawLine: gives a minimal length to lines having a 0 length

Lines with start point = end point always create problems in OpenGL (not drawn).
This commit is contained in:
jean-pierre charras 2022-01-12 09:44:30 +01:00
parent 8c6c87eaf4
commit b3072cc16b
1 changed files with 12 additions and 2 deletions

View File

@ -1326,7 +1326,12 @@ void SCH_PAINTER::draw( const SCH_LINE *aLine, int aLayer )
STROKE_PARAMS::Stroke( &line, lineStyle, width, &m_schSettings,
[&]( const VECTOR2I& a, const VECTOR2I& b )
{
m_gal->DrawLine( a, b );
// DrawLine has problem with 0 length lines
// so draw a line with a minimal length
if( a == b )
m_gal->DrawLine( a+1, b );
else
m_gal->DrawLine( a, b );
} );
}
}
@ -1429,7 +1434,12 @@ void SCH_PAINTER::draw( const SCH_SHAPE* aShape, int aLayer )
STROKE_PARAMS::Stroke( shape, lineStyle, lineWidth, &m_schSettings,
[&]( const VECTOR2I& a, const VECTOR2I& b )
{
m_gal->DrawLine( a, b );
// DrawLine has problem with 0 length lines
// so draw a line with a minimal length
if( a == b )
m_gal->DrawLine( a+1, b );
else
m_gal->DrawLine( a, b );
} );
}