From 6205363b500691ce10d7b4a59d04fde55d619107 Mon Sep 17 00:00:00 2001 From: Andreas Buhr Date: Sun, 10 Dec 2017 22:56:06 +0100 Subject: [PATCH] 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. --- common/gal/opengl/opengl_gal.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index 6782a1170a..2113894f2e 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -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 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;