Fix footprint-relative coordinates when drawing polygons.

This commit is contained in:
Jeff Young 2020-11-14 13:20:13 +00:00
parent a3a409b438
commit 774a671b54
1 changed files with 11 additions and 10 deletions

View File

@ -1222,10 +1222,18 @@ void PCB_PAINTER::draw( const PCB_SHAPE* aShape, int aLayer )
case S_POLYGON:
{
SHAPE_POLY_SET& shape = const_cast<PCB_SHAPE*>( aShape )->GetPolyShape();
FOOTPRINT* parentFootprint = aShape->GetParentFootprint();
if( shape.OutlineCount() == 0 )
break;
if( parentFootprint )
{
m_gal->Save();
m_gal->Translate( parentFootprint->GetPosition() );
m_gal->Rotate( -parentFootprint->GetOrientationRadians() );
}
if( sketch )
{
for( int ii = 0; ii < shape.Outline( 0 ).SegmentCount(); ++ii )
@ -1257,21 +1265,14 @@ void PCB_PAINTER::draw( const PCB_SHAPE* aShape, int aLayer )
if( m_gal->IsOpenGlEngine() && !shape.IsTriangulationUpToDate() )
shape.CacheTriangulation();
m_gal->Save();
if( FOOTPRINT* parentFootprint = aShape->GetParentFootprint() )
{
m_gal->Translate( parentFootprint->GetPosition() );
m_gal->Rotate( -parentFootprint->GetOrientationRadians() );
m_gal->DrawPolygon( shape );
}
}
m_gal->DrawPolygon( shape );
if( parentFootprint )
m_gal->Restore();
}
}
break;
}
case S_CURVE:
if( sketch )