Dear Kicad developers,

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.

The patch attached fixes this bug.

Cheers,
Andreas
>From 837eecbdae9b778525b12fdde19731456b7ffe26 Mon Sep 17 00:00:00 2001
From: Andreas Buhr <andr...@andreasbuhr.de>
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 63f08ee..2d50c3d 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<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;
-- 
2.7.4

_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to     : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp

Reply via email to