From 80af7b3158c50351e412cbe18632ed78a53f51e0 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Fri, 21 Aug 2020 15:17:15 -0700 Subject: [PATCH] Fix GAL check to account for shared function Cairo Polyline and Polygon draw functions share a common routine. While Polygons must have 3 points to allow triangulation, a polyline (like our text) need only have 2 --- common/gal/cairo/cairo_gal.cpp | 6 +++--- common/gal/opengl/opengl_gal.cpp | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/common/gal/cairo/cairo_gal.cpp b/common/gal/cairo/cairo_gal.cpp index 05f9dc2f64..92429f856c 100644 --- a/common/gal/cairo/cairo_gal.cpp +++ b/common/gal/cairo/cairo_gal.cpp @@ -1117,7 +1117,7 @@ void CAIRO_GAL_BASE::blitCursor( wxMemoryDC& clientDC ) void CAIRO_GAL_BASE::drawPoly( const std::deque& aPointList ) { - wxCHECK( aPointList.size() > 2, /* void */ ); + wxCHECK( aPointList.size() > 1, /* void */ ); // Iterate over the point list and draw the segments std::deque::const_iterator it = aPointList.begin(); @@ -1142,7 +1142,7 @@ void CAIRO_GAL_BASE::drawPoly( const std::deque& aPointList ) void CAIRO_GAL_BASE::drawPoly( const VECTOR2D aPointList[], int aListSize ) { - wxCHECK( aListSize > 2, /* void */ ); + wxCHECK( aListSize > 1, /* void */ ); // Iterate over the point list and draw the segments const VECTOR2D* ptr = aPointList; @@ -1166,7 +1166,7 @@ void CAIRO_GAL_BASE::drawPoly( const VECTOR2D aPointList[], int aListSize ) void CAIRO_GAL_BASE::drawPoly( const SHAPE_LINE_CHAIN& aLineChain ) { - wxCHECK( aLineChain.PointCount() > 2, /* void */ ); + wxCHECK( aLineChain.PointCount() > 1, /* void */ ); syncLineWidth(); diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index b2c7f98d9b..a94ef0ea40 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -1854,8 +1854,7 @@ void OPENGL_GAL::drawPolygon( GLdouble* aPoints, int aPointCount ) void OPENGL_GAL::drawPolyline( const std::function& aPointGetter, int aPointCount ) { - if( aPointCount < 2 ) - return; + wxCHECK( aPointCount >= 2, /* return */ ); currentManager->Color( strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a ); int i;