From 42384bcbd00c0080b789f115c310a2d9e6e60d66 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 10 Oct 2023 18:29:42 +0200 Subject: [PATCH] OPENGL_GAL: ensure 0 sized rect with thickness is shown (already shown by Cairo) Fixes #15850 https://gitlab.com/kicad/code/kicad/-/issues/15850 --- common/gal/opengl/opengl_gal.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index 068e4379cb..ee8e6b7b46 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -1121,13 +1121,21 @@ void OPENGL_GAL::DrawRectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEn m_currentManager->Color( m_strokeColor.r, m_strokeColor.g, m_strokeColor.b, m_strokeColor.a ); - std::deque pointList; - pointList.push_back( aStartPoint ); - pointList.push_back( diagonalPointA ); - pointList.push_back( aEndPoint ); - pointList.push_back( diagonalPointB ); - pointList.push_back( aStartPoint ); - DrawPolyline( pointList ); + // DrawLine (and DrawPolyline ) + // has problem with 0 length lines so enforce minimum + if( aStartPoint == aEndPoint ) + DrawLine( aStartPoint + VECTOR2D( 1.0, 0.0 ), aEndPoint ); + else + { + std::deque pointList; + + pointList.push_back( aStartPoint ); + pointList.push_back( diagonalPointA ); + pointList.push_back( aEndPoint ); + pointList.push_back( diagonalPointB ); + pointList.push_back( aStartPoint ); + DrawPolyline( pointList ); + } } }