diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index 259b052feb..5634edb4e6 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -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 ); } diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index bc27aa976e..1293384e05 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -896,12 +896,13 @@ void PCB_PAINTER::draw( const DRAWSEGMENT* aSegment, int aLayer ) case S_POLYGON: { + const auto& points = aSegment->GetPolyPoints(); std::deque 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();