From af65c48979707b89241a059f38a4adc4ed09d492 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 3 Dec 2018 20:07:39 +0100 Subject: [PATCH] Pcbnew: Partial revert of commit 0bceb69fe90f6a62c7a3fa583e99406e308a8371 In DRAWSEGMENT polygonal shape: the commit tried to use triangulation (CacheTriangulation) to draw the shape (similar to zones). It was much faster than using GLU tesselator (one order of magnitude). Unfortunately, CacheTriangulation() works only with simple polygons, not with any polygon. And simplifying a polygon with a lot of vertexes is very time consuming. So using CacheTriangulation() is now removed and GLU tesselator is used as previously. Fixes: lp:1806411 https://bugs.launchpad.net/kicad/+bug/1806411 --- pcbnew/pcb_painter.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index a7faeb3888..8843329aa4 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -973,11 +973,20 @@ void PCB_PAINTER::draw( const DRAWSEGMENT* aSegment, int aLayer ) if( shape.OutlineCount() == 0 ) break; +#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. + // And unfortunately, calling shape.Simplify( PM_FAST) is very slow. + // So 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() ) { shape.CacheTriangulation(); } - +#endif m_gal->Save(); if( MODULE* module = aSegment->GetParentModule() )