kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #32304
[PATCH] bugfix: OPENGL_GAL::drawPolygon did not respect fill settings
Dear Kicad developers,
The OPENGL_GAL::drawPolygon function and all functions using it
did not respect the isFillEnabled member set by
GAL::SetIsFill. This is fixed by the attached patch.
I hope you find it useful.
Cheers,
Andreas
>From d99a51c99e03bc6c28f2c0bc12c4a2327ecc378e Mon Sep 17 00:00:00 2001
From: Andreas Buhr <andreas@xxxxxxxxxxxxxx>
Date: Fri, 8 Dec 2017 12:44:46 +0100
Subject: [PATCH] bugfix: OPENGL_GAL::drawPolygon did not respect fill settings
The OPENGL_GAL::drawPolygon function and all functions using it
did not respect the isFillEnabled member set by
GAL::SetIsFill. This is fixed by this patch.
---
common/gal/opengl/opengl_gal.cpp | 36 +++++++++++++++++++-----------------
1 file changed, 19 insertions(+), 17 deletions(-)
diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp
index 63f08ee..763d08f 100644
--- a/common/gal/opengl/opengl_gal.cpp
+++ b/common/gal/opengl/opengl_gal.cpp
@@ -1511,28 +1511,30 @@ void OPENGL_GAL::drawStrokedSemiCircle( const VECTOR2D& aCenterPoint, double aRa
void OPENGL_GAL::drawPolygon( GLdouble* aPoints, int aPointCount )
{
- currentManager->Shader( SHADER_NONE );
- currentManager->Color( fillColor.r, fillColor.g, fillColor.b, fillColor.a );
+ if(isFillEnabled){
+ currentManager->Shader( SHADER_NONE );
+ currentManager->Color( fillColor.r, fillColor.g, fillColor.b, fillColor.a );
- // Any non convex polygon needs to be tesselated
- // for this purpose the GLU standard functions are used
- TessParams params = { currentManager, tessIntersects };
- gluTessBeginPolygon( tesselator, ¶ms );
- gluTessBeginContour( tesselator );
+ // Any non convex polygon needs to be tesselated
+ // for this purpose the GLU standard functions are used
+ TessParams params = { currentManager, tessIntersects };
+ gluTessBeginPolygon( tesselator, ¶ms );
+ gluTessBeginContour( tesselator );
- GLdouble* point = aPoints;
+ GLdouble* point = aPoints;
- for( int i = 0; i < aPointCount; ++i )
- {
- gluTessVertex( tesselator, point, point );
- point += 3; // 3 coordinates
- }
+ for( int i = 0; i < aPointCount; ++i )
+ {
+ gluTessVertex( tesselator, point, point );
+ point += 3; // 3 coordinates
+ }
- gluTessEndContour( tesselator );
- gluTessEndPolygon( tesselator );
+ gluTessEndContour( tesselator );
+ gluTessEndPolygon( tesselator );
- // Free allocated intersecting points
- tessIntersects.clear();
+ // Free allocated intersecting points
+ tessIntersects.clear();
+ }
if( isStrokeEnabled )
drawPolyline( [&](int idx) { return VECTOR2D( aPoints[idx * 3], aPoints[idx * 3 + 1] ); },
--
2.7.4
Follow ups