Optimize drawings for degenerated oval pads (in fact circle) and for round pad holes

This commit is contained in:
jean-pierre charras 2020-07-31 10:54:53 +02:00
parent d7a1a4f822
commit 87ebd34ea2
2 changed files with 18 additions and 12 deletions

View File

@ -277,15 +277,16 @@ void D_PAD::BuildEffectiveShapes() const
break;
case PAD_SHAPE_OVAL:
{
wxSize half_size = m_Size / 2;
int half_width = std::min( half_size.x, half_size.y );
wxPoint half_len( half_size.x - half_width, half_size.y - half_width );
RotatePoint( &half_len, m_Orient );
add( new SHAPE_SEGMENT( shapePos - half_len, shapePos + half_len, half_width * 2 ) );
}
if( m_Size.x == m_Size.y ) // the oval pad is in fact a circle
add( new SHAPE_CIRCLE( shapePos, m_Size.x / 2 ) );
else
{
wxSize half_size = m_Size / 2;
int half_width = std::min( half_size.x, half_size.y );
wxPoint half_len( half_size.x - half_width, half_size.y - half_width );
RotatePoint( &half_len, m_Orient );
add( new SHAPE_SEGMENT( shapePos - half_len, shapePos + half_len, half_width * 2 ) );
}
break;
case PAD_SHAPE_RECT:

View File

@ -812,7 +812,11 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
if( aLayer == LAYER_PADS_PLATEDHOLES || aLayer == LAYER_NON_PLATEDHOLES )
{
const SHAPE_SEGMENT* seg = aPad->GetEffectiveHoleShape();
m_gal->DrawSegment( seg->GetSeg().A, seg->GetSeg().B, seg->GetWidth() );
if( seg->GetSeg().A == seg->GetSeg().B ) // Circular hole
m_gal->DrawCircle( seg->GetSeg().A, seg->GetWidth()/2 );
else
m_gal->DrawSegment( seg->GetSeg().A, seg->GetSeg().B, seg->GetWidth() );
}
else
{
@ -879,7 +883,8 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
m_gal->SetStrokeColor( color );
int clearance = aPad->GetClearance();
const std::shared_ptr<SHAPE_COMPOUND> shapes = std::dynamic_pointer_cast<SHAPE_COMPOUND>( aPad->GetEffectiveShape() );
const std::shared_ptr<SHAPE_COMPOUND> shapes =
std::dynamic_pointer_cast<SHAPE_COMPOUND>( aPad->GetEffectiveShape() );
if( shapes && shapes->Size() == 1 && shapes->Shapes()[0]->Type() == SH_SEGMENT )
{