bugfix: OPENGL_GAL::DrawPolygon did not close closed polygons

The polygon drawing routing in the OpenGL-GAL did
not plot polygons which are "closed", i.e. have a segment
from their last point to their first point, correctly.
That segment was omitted.
This commit fixes this bug.
This commit is contained in:
Andreas Buhr 2017-12-10 22:56:06 +01:00 committed by Maciej Suminski
parent df76380a2d
commit 6205363b50
1 changed files with 2 additions and 2 deletions

View File

@ -826,11 +826,11 @@ void OPENGL_GAL::DrawPolygon( const SHAPE_POLY_SET& aPolySet )
for( int j = 0; j < aPolySet.OutlineCount(); ++j )
{
const SHAPE_LINE_CHAIN& outline = aPolySet.COutline( j );
const int pointCount = outline.PointCount();
const int pointCount = outline.SegmentCount() + 1;
std::unique_ptr<GLdouble[]> points( new GLdouble[3 * pointCount] );
GLdouble* ptr = points.get();
for( int i = 0; i < outline.PointCount(); ++i )
for( int i = 0; i < pointCount; ++i )
{
const VECTOR2I& p = outline.CPoint( i );
*ptr++ = p.x;