From 2ec957a226666fabacc1d94dde7622abe5790efd Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 4 Dec 2018 15:47:32 +0100 Subject: [PATCH] polygon_triangulation.h: fix a missing call to updateList() in TesselatePolygon. --- include/geometry/polygon_triangulation.h | 3 +++ pcbnew/pcb_painter.cpp | 9 ++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/geometry/polygon_triangulation.h b/include/geometry/polygon_triangulation.h index be5b2286d3..c437e58bb1 100644 --- a/include/geometry/polygon_triangulation.h +++ b/include/geometry/polygon_triangulation.h @@ -624,6 +624,7 @@ public: return; outerNode->updateList(); + if( !earcutList( outerNode ) ) { m_vertices.clear(); @@ -635,9 +636,11 @@ public: for( auto path : simplified ) { outerNode = createList( path ); + if( !outerNode ) return; + outerNode->updateList(); earcutList( outerNode ); } } diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index 8843329aa4..dc5c525e24 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -975,12 +975,11 @@ void PCB_PAINTER::draw( const DRAWSEGMENT* aSegment, int aLayer ) #if 0 // On Opengl, a not convex filled polygon is usually drawn by using triangles as primitives. - // Although using CacheTriangulation() to create basic triangle primitives - // to draw the polygon solid shape on Opengl, it is not used because CacheTriangulation() - // does not work fine with any polygon. - // It must be a simple polygon. + // Although CacheTriangulation() can create basic triangle primitives + // to draw the polygon solid shape on Opengl, it is not used because it does not work fine + // with any polygon. It must be a simple polygon. // And unfortunately, calling shape.Simplify( PM_FAST) is very slow. - // So we just use GLU tesselation (much slower, but works with any polygon) + // So for now we just use GLU tesselation (much slower, but works with any polygon) // This section is left until a better way is found if( !shape.IsTriangulationUpToDate() ) {