Opengl gal: Fix bug: segments with 0 length are not drawn. However the are equivalent to circles.

Using 0 length segments happen with oval pads having the same X and Y size, and in some other cases.

Fixes: lp:1801923
https://bugs.launchpad.net/kicad/+bug/1801923
This commit is contained in:
jean-pierre charras 2018-11-15 13:10:42 +01:00
parent 1f3d5cee0e
commit ffe4b745dd
2 changed files with 14 additions and 14 deletions

View File

@ -564,6 +564,12 @@ void OPENGL_GAL::DrawLine( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoin
void OPENGL_GAL::DrawSegment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint,
double aWidth )
{
if( aStartPoint == aEndPoint ) // 0 length segments are just a circle.
{
DrawCircle( aStartPoint, aWidth/2 );
return;
}
if( isFillEnabled || aWidth == 1.0 )
{
currentManager->Color( fillColor.r, fillColor.g, fillColor.b, fillColor.a );

View File

@ -423,27 +423,21 @@ void GERBVIEW_PAINTER::drawFlashedShape( GERBER_DRAW_ITEM* aItem, bool aFilled )
int radius = code->m_Size.x >> 1;
VECTOR2D start( aItem->GetABPosition( aItem->m_Start ) );
if( !aFilled )
if( !aFilled || code->m_DrillShape == APT_DEF_NO_HOLE )
{
m_gal->DrawCircle( start, radius );
}
else
else // rectangular hole
{
if( code->m_DrillShape == APT_DEF_NO_HOLE )
{
m_gal->DrawCircle( start, radius );
}
else // rectangular hole
{
if( code->m_Polygon.OutlineCount() == 0 )
code->ConvertShapeToPolygon();
if( code->m_Polygon.OutlineCount() == 0 )
code->ConvertShapeToPolygon();
SHAPE_POLY_SET poly = code->m_Polygon;
poly.Move( aItem->m_Start );
SHAPE_POLY_SET poly = code->m_Polygon;
poly.Move( aItem->m_Start );
drawPolygon( aItem, poly, aFilled );
}
drawPolygon( aItem, poly, aFilled );
}
break;
}