diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index 36ab6588ee..59da4f9770 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -570,10 +570,40 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer ) break; case PAD_RECT: - case PAD_TRAPEZOID: m_gal->DrawRectangle( VECTOR2D( -size.x, -size.y ), VECTOR2D( size.x, size.y ) ); break; + case PAD_TRAPEZOID: + { + std::deque pointList; + wxPoint corners[4]; + + VECTOR2D padSize = VECTOR2D( aPad->GetSize().x, aPad->GetSize().y ) / 2; + VECTOR2D deltaPadSize = size - padSize; // = solder[Paste/Mask]Margin or 0 + VECTOR2D delta = VECTOR2D( aPad->GetDelta().x / 2, + aPad->GetDelta().y / 2 ); + VECTOR2D inflate = VECTOR2D( delta.y * ( deltaPadSize.x / size.x ), + delta.x * ( deltaPadSize.y / size.y ) ); + + aPad->BuildPadPolygon( corners, wxSize( deltaPadSize.x, deltaPadSize.y ), 0.0 ); + pointList.push_back( VECTOR2D( corners[0] ) ); + pointList.push_back( VECTOR2D( corners[1] ) ); + pointList.push_back( VECTOR2D( corners[2] ) ); + pointList.push_back( VECTOR2D( corners[3] ) ); + + if( m_pcbSettings->m_sketchModeSelect[PADS_VISIBLE] ) + { + // Add the beginning point to close the outline + pointList.push_back( pointList.front() ); + m_gal->DrawPolyline( pointList ); + } + else + { + m_gal->DrawPolygon( pointList ); + } + } + break; + case PAD_CIRCLE: m_gal->DrawCircle( VECTOR2D( 0.0, 0.0 ), size.x ); break;