Make sure parent pos is factored in for polygons.

Fixes https://gitlab.com/kicad/code/kicad/issues/11945
This commit is contained in:
Jeff Young 2022-08-16 17:28:16 +01:00
parent 30a72101f3
commit 6cfbf895fc
2 changed files with 19 additions and 17 deletions

View File

@ -2001,31 +2001,31 @@ void PCB_PAINTER::draw( const FP_TEXTBOX* aTextBox, int aLayer )
m_gal->SetIsFill( true ); m_gal->SetIsFill( true );
m_gal->SetIsStroke( false ); m_gal->SetIsStroke( false );
if( lineStyle <= PLOT_DASH_TYPE::FIRST_TYPE ) if( thickness > 0 )
{ {
if( thickness > 0 ) if( lineStyle <= PLOT_DASH_TYPE::FIRST_TYPE )
{ {
std::vector<VECTOR2I> pts = aTextBox->GetCorners(); std::vector<VECTOR2I> pts = aTextBox->GetCorners();
for( size_t ii = 0; ii < pts.size(); ++ii ) for( size_t ii = 0; ii < pts.size(); ++ii )
m_gal->DrawSegment( pts[ ii ], pts[ (ii + 1) % pts.size() ], thickness ); m_gal->DrawSegment( pts[ ii ], pts[ (ii + 1) % pts.size() ], thickness );
} }
} else
else
{
std::vector<SHAPE*> shapes = aTextBox->MakeEffectiveShapes( true );
for( SHAPE* shape : shapes )
{ {
STROKE_PARAMS::Stroke( shape, lineStyle, thickness, &m_pcbSettings, std::vector<SHAPE*> shapes = aTextBox->MakeEffectiveShapes( true );
[&]( const VECTOR2I& a, const VECTOR2I& b )
{
m_gal->DrawSegment( a, b, thickness );
} );
}
for( SHAPE* shape : shapes ) for( SHAPE* shape : shapes )
delete shape; {
STROKE_PARAMS::Stroke( shape, lineStyle, thickness, &m_pcbSettings,
[&]( const VECTOR2I& a, const VECTOR2I& b )
{
m_gal->DrawSegment( a, b, thickness );
} );
}
for( SHAPE* shape : shapes )
delete shape;
}
} }
wxString resolvedText( aTextBox->GetShownText() ); wxString resolvedText( aTextBox->GetShownText() );

View File

@ -105,8 +105,10 @@ std::vector<VECTOR2I> PCB_SHAPE::GetCorners() const
} }
else if( GetShape() == SHAPE_T::POLY ) else if( GetShape() == SHAPE_T::POLY )
{ {
VECTOR2I offset = getParentPosition();
for( const VECTOR2I& pt : GetPolyShape().Outline( 0 ).CPoints() ) for( const VECTOR2I& pt : GetPolyShape().Outline( 0 ).CPoints() )
pts.emplace_back( pt ); pts.emplace_back( pt + offset );
} }
else else
{ {