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
This commit is contained in:
Seth Hillbrand 2020-08-21 15:17:15 -07:00
parent a3a36ed4d6
commit 80af7b3158
2 changed files with 4 additions and 5 deletions

View File

@ -1117,7 +1117,7 @@ void CAIRO_GAL_BASE::blitCursor( wxMemoryDC& clientDC )
void CAIRO_GAL_BASE::drawPoly( const std::deque<VECTOR2D>& aPointList ) void CAIRO_GAL_BASE::drawPoly( const std::deque<VECTOR2D>& aPointList )
{ {
wxCHECK( aPointList.size() > 2, /* void */ ); wxCHECK( aPointList.size() > 1, /* void */ );
// Iterate over the point list and draw the segments // Iterate over the point list and draw the segments
std::deque<VECTOR2D>::const_iterator it = aPointList.begin(); std::deque<VECTOR2D>::const_iterator it = aPointList.begin();
@ -1142,7 +1142,7 @@ void CAIRO_GAL_BASE::drawPoly( const std::deque<VECTOR2D>& aPointList )
void CAIRO_GAL_BASE::drawPoly( const VECTOR2D aPointList[], int aListSize ) 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 // Iterate over the point list and draw the segments
const VECTOR2D* ptr = aPointList; 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 ) void CAIRO_GAL_BASE::drawPoly( const SHAPE_LINE_CHAIN& aLineChain )
{ {
wxCHECK( aLineChain.PointCount() > 2, /* void */ ); wxCHECK( aLineChain.PointCount() > 1, /* void */ );
syncLineWidth(); syncLineWidth();

View File

@ -1854,8 +1854,7 @@ void OPENGL_GAL::drawPolygon( GLdouble* aPoints, int aPointCount )
void OPENGL_GAL::drawPolyline( const std::function<VECTOR2D (int)>& aPointGetter, int aPointCount ) void OPENGL_GAL::drawPolyline( const std::function<VECTOR2D (int)>& aPointGetter, int aPointCount )
{ {
if( aPointCount < 2 ) wxCHECK( aPointCount >= 2, /* return */ );
return;
currentManager->Color( strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a ); currentManager->Color( strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a );
int i; int i;