GAL: Respect SHAPE_LINE_CHAIN closed setting
When drawing polylines using SHAPE_LINE_CHAIN, the polyline is always was drawn closed in GAL and open in Cairo, regardless of the state of SHAPE_LINE_CHAIN.
This commit is contained in:
parent
45d1082517
commit
c86773462f
|
@ -1081,10 +1081,15 @@ void CAIRO_GAL::drawPoly( const SHAPE_LINE_CHAIN& aLineChain )
|
|||
if( aLineChain.PointCount() < 2 )
|
||||
return;
|
||||
|
||||
auto numPoints = aLineChain.PointCount();
|
||||
|
||||
if( aLineChain.IsClosed() )
|
||||
numPoints += 1;
|
||||
|
||||
const VECTOR2I start = aLineChain.CPoint( 0 );
|
||||
cairo_move_to( currentContext, start.x, start.y );
|
||||
|
||||
for( int i = 1; i < aLineChain.PointCount(); ++i )
|
||||
for( int i = 1; i < numPoints; ++i )
|
||||
{
|
||||
const VECTOR2I& p = aLineChain.CPoint( i );
|
||||
cairo_line_to( currentContext, p.x, p.y );
|
||||
|
|
|
@ -640,7 +640,12 @@ void OPENGL_GAL::DrawPolyline( const VECTOR2D aPointList[], int aListSize )
|
|||
|
||||
void OPENGL_GAL::DrawPolyline( const SHAPE_LINE_CHAIN& aLineChain )
|
||||
{
|
||||
drawPolyline( [&](int idx) { return aLineChain.CPoint(idx); }, aLineChain.PointCount() + 1 );
|
||||
auto numPoints = aLineChain.PointCount();
|
||||
|
||||
if( aLineChain.IsClosed() )
|
||||
numPoints += 1;
|
||||
|
||||
drawPolyline( [&](int idx) { return aLineChain.CPoint(idx); }, numPoints );
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue