Browse Source

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
pull/16/head
Seth Hillbrand 5 years ago
parent
commit
80af7b3158
  1. 6
      common/gal/cairo/cairo_gal.cpp
  2. 3
      common/gal/opengl/opengl_gal.cpp

6
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<VECTOR2D>& aPointList )
{
wxCHECK( aPointList.size() > 2, /* void */ );
wxCHECK( aPointList.size() > 1, /* void */ );
// Iterate over the point list and draw the segments
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 )
{
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();

3
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<VECTOR2D (int)>& aPointGetter, int aPointCount )
{
if( aPointCount < 2 )
return;
wxCHECK( aPointCount >= 2, /* return */ );
currentManager->Color( strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a );
int i;

Loading…
Cancel
Save