Optimize drawings for degenerated oval pads (in fact circle) and for round pad holes
This commit is contained in:
parent
d7a1a4f822
commit
87ebd34ea2
|
@ -277,13 +277,14 @@ void D_PAD::BuildEffectiveShapes() const
|
|||
break;
|
||||
|
||||
case PAD_SHAPE_OVAL:
|
||||
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;
|
||||
|
|
|
@ -812,6 +812,10 @@ 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();
|
||||
|
||||
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 )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue