Fix Bezier reading.

Fixes https://gitlab.com/kicad/code/kicad/issues/9512
This commit is contained in:
Jeff Young 2021-11-02 22:19:12 +00:00
parent 4acff58c7a
commit 4d46445ce1
2 changed files with 17 additions and 5 deletions

View File

@ -590,8 +590,8 @@ void SCH_PAINTER::draw( const LIB_SHAPE *aShape, int aLayer )
{
std::deque<VECTOR2D> mappedPts;
for( const VECTOR2I &p : aShape->GetPolyShape().Outline( 0 ).CPoints() )
mappedPts.push_back( mapCoords( (wxPoint) p ) );
for( const wxPoint& p : aShape->GetBezierPoints() )
mappedPts.push_back( mapCoords( p ) );
m_gal->DrawPolygon( mappedPts );
}

View File

@ -1061,7 +1061,10 @@ LIB_SHAPE* SCH_SEXPR_PARSER::parseBezier()
switch( token )
{
case T_pts:
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
{
int ii = 0;
for( token = NextTok(); token != T_RIGHT; token = NextTok(), ++ii )
{
if( token != T_LEFT )
Expecting( T_LEFT );
@ -1071,11 +1074,18 @@ LIB_SHAPE* SCH_SEXPR_PARSER::parseBezier()
if( token != T_xy )
Expecting( "xy" );
bezier->AddPoint( parseXY() );
switch( ii )
{
case 0: bezier->SetStart( parseXY() ); break;
case 1: bezier->SetBezierC1( parseXY() ); break;
case 2: bezier->SetBezierC2( parseXY() ); break;
case 3: bezier->SetEnd( parseXY() ); break;
default: Unexpected( "control point" ); break;
}
NeedRIGHT();
}
}
break;
case T_stroke:
@ -1093,6 +1103,8 @@ LIB_SHAPE* SCH_SEXPR_PARSER::parseBezier()
}
}
bezier->RebuildBezierToSegmentsPointsList( bezier->GetWidth() );
return bezier.release();
}