Fixed polygon DRAWSEGMENT rendering in OpenGL GAL

Fixes: lp:1704542
* https://bugs.launchpad.net/kicad/+bug/1704542
This commit is contained in:
Maciej Suminski 2017-07-28 10:34:45 +02:00
parent acbfea48f2
commit 7399759b3b
2 changed files with 12 additions and 6 deletions

View File

@ -1486,6 +1486,10 @@ void OPENGL_GAL::drawPolygon( GLdouble* aPoints, int aPointCount )
// Free allocated intersecting points
tessIntersects.clear();
if( isStrokeEnabled )
drawPolyline( [&](int idx) { return VECTOR2D( aPoints[idx * 3], aPoints[idx * 3 + 1] ); },
aPointCount );
}

View File

@ -896,12 +896,13 @@ void PCB_PAINTER::draw( const DRAWSEGMENT* aSegment, int aLayer )
case S_POLYGON:
{
const auto& points = aSegment->GetPolyPoints();
std::deque<VECTOR2D> pointsList;
m_gal->SetIsFill( true ); // draw polygons the legacy way
m_gal->SetIsStroke( false );
if( points.empty() )
break;
m_gal->Save();
m_gal->SetLineWidth( thickness );
if( MODULE* module = aSegment->GetParentModule() )
{
@ -914,11 +915,12 @@ void PCB_PAINTER::draw( const DRAWSEGMENT* aSegment, int aLayer )
m_gal->Rotate( DECIDEG2RAD( -aSegment->GetAngle() ) );
}
std::copy( aSegment->GetPolyPoints().begin(), aSegment->GetPolyPoints().end(),
std::back_inserter( pointsList ) );
std::copy( points.begin(), points.end(), std::back_inserter( pointsList ) );
pointsList.push_back( points[0] );
m_gal->SetLineWidth( aSegment->GetWidth() );
m_gal->DrawPolyline( pointsList );
m_gal->SetIsFill( true ); // draw polygons the legacy way
m_gal->SetIsStroke( true );
m_gal->DrawPolygon( pointsList );
m_gal->Restore();