Fixed polygon DRAWSEGMENT rendering in OpenGL GAL
Fixes: lp:1704542 * https://bugs.launchpad.net/kicad/+bug/1704542
This commit is contained in:
parent
acbfea48f2
commit
7399759b3b
|
@ -1486,6 +1486,10 @@ void OPENGL_GAL::drawPolygon( GLdouble* aPoints, int aPointCount )
|
||||||
|
|
||||||
// Free allocated intersecting points
|
// Free allocated intersecting points
|
||||||
tessIntersects.clear();
|
tessIntersects.clear();
|
||||||
|
|
||||||
|
if( isStrokeEnabled )
|
||||||
|
drawPolyline( [&](int idx) { return VECTOR2D( aPoints[idx * 3], aPoints[idx * 3 + 1] ); },
|
||||||
|
aPointCount );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -896,12 +896,13 @@ void PCB_PAINTER::draw( const DRAWSEGMENT* aSegment, int aLayer )
|
||||||
|
|
||||||
case S_POLYGON:
|
case S_POLYGON:
|
||||||
{
|
{
|
||||||
|
const auto& points = aSegment->GetPolyPoints();
|
||||||
std::deque<VECTOR2D> pointsList;
|
std::deque<VECTOR2D> pointsList;
|
||||||
|
|
||||||
m_gal->SetIsFill( true ); // draw polygons the legacy way
|
if( points.empty() )
|
||||||
m_gal->SetIsStroke( false );
|
break;
|
||||||
|
|
||||||
m_gal->Save();
|
m_gal->Save();
|
||||||
m_gal->SetLineWidth( thickness );
|
|
||||||
|
|
||||||
if( MODULE* module = aSegment->GetParentModule() )
|
if( MODULE* module = aSegment->GetParentModule() )
|
||||||
{
|
{
|
||||||
|
@ -914,11 +915,12 @@ void PCB_PAINTER::draw( const DRAWSEGMENT* aSegment, int aLayer )
|
||||||
m_gal->Rotate( DECIDEG2RAD( -aSegment->GetAngle() ) );
|
m_gal->Rotate( DECIDEG2RAD( -aSegment->GetAngle() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
std::copy( aSegment->GetPolyPoints().begin(), aSegment->GetPolyPoints().end(),
|
std::copy( points.begin(), points.end(), std::back_inserter( pointsList ) );
|
||||||
std::back_inserter( pointsList ) );
|
pointsList.push_back( points[0] );
|
||||||
|
|
||||||
m_gal->SetLineWidth( aSegment->GetWidth() );
|
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->DrawPolygon( pointsList );
|
||||||
|
|
||||||
m_gal->Restore();
|
m_gal->Restore();
|
||||||
|
|
Loading…
Reference in New Issue