Optimize drawings for degenerated oval pads (in fact circle) and for round pad holes
This commit is contained in:
parent
d7a1a4f822
commit
87ebd34ea2
|
@ -228,7 +228,7 @@ std::shared_ptr<SHAPE> D_PAD::GetEffectiveShape( PCB_LAYER_ID aLayer ) const
|
||||||
|
|
||||||
if( m_shapesDirty )
|
if( m_shapesDirty )
|
||||||
BuildEffectiveShapes();
|
BuildEffectiveShapes();
|
||||||
|
|
||||||
for( auto s : m_effectiveShapes )
|
for( auto s : m_effectiveShapes )
|
||||||
shape->AddShape( s->Clone() ); // fixme: use COMPOUND everywhere
|
shape->AddShape( s->Clone() ); // fixme: use COMPOUND everywhere
|
||||||
|
|
||||||
|
@ -277,15 +277,16 @@ void D_PAD::BuildEffectiveShapes() const
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PAD_SHAPE_OVAL:
|
case PAD_SHAPE_OVAL:
|
||||||
{
|
if( m_Size.x == m_Size.y ) // the oval pad is in fact a circle
|
||||||
wxSize half_size = m_Size / 2;
|
add( new SHAPE_CIRCLE( shapePos, m_Size.x / 2 ) );
|
||||||
int half_width = std::min( half_size.x, half_size.y );
|
else
|
||||||
wxPoint half_len( half_size.x - half_width, half_size.y - half_width );
|
{
|
||||||
|
wxSize half_size = m_Size / 2;
|
||||||
RotatePoint( &half_len, m_Orient );
|
int half_width = std::min( half_size.x, half_size.y );
|
||||||
|
wxPoint half_len( half_size.x - half_width, half_size.y - half_width );
|
||||||
add( new SHAPE_SEGMENT( shapePos - half_len, shapePos + half_len, half_width * 2 ) );
|
RotatePoint( &half_len, m_Orient );
|
||||||
}
|
add( new SHAPE_SEGMENT( shapePos - half_len, shapePos + half_len, half_width * 2 ) );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PAD_SHAPE_RECT:
|
case PAD_SHAPE_RECT:
|
||||||
|
|
|
@ -812,7 +812,11 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
|
||||||
if( aLayer == LAYER_PADS_PLATEDHOLES || aLayer == LAYER_NON_PLATEDHOLES )
|
if( aLayer == LAYER_PADS_PLATEDHOLES || aLayer == LAYER_NON_PLATEDHOLES )
|
||||||
{
|
{
|
||||||
const SHAPE_SEGMENT* seg = aPad->GetEffectiveHoleShape();
|
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
|
else
|
||||||
{
|
{
|
||||||
|
@ -879,7 +883,8 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
|
||||||
m_gal->SetStrokeColor( color );
|
m_gal->SetStrokeColor( color );
|
||||||
int clearance = aPad->GetClearance();
|
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 )
|
if( shapes && shapes->Size() == 1 && shapes->Shapes()[0]->Type() == SH_SEGMENT )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue