diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index ac00162b5b..db27a580fe 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -228,7 +228,7 @@ std::shared_ptr D_PAD::GetEffectiveShape( PCB_LAYER_ID aLayer ) const if( m_shapesDirty ) BuildEffectiveShapes(); - + for( auto s : m_effectiveShapes ) shape->AddShape( s->Clone() ); // fixme: use COMPOUND everywhere @@ -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: diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index 1c03d6bdc8..f0048cb5eb 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -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 shapes = std::dynamic_pointer_cast( aPad->GetEffectiveShape() ); + const std::shared_ptr shapes = + std::dynamic_pointer_cast( aPad->GetEffectiveShape() ); if( shapes && shapes->Size() == 1 && shapes->Shapes()[0]->Type() == SH_SEGMENT ) {