Gerbview: fix draw issue when drawing a line using a rectangular aperture.
Lines using a rectangular aperture are not common, but this is legal in Gerber files. Fixes #5205 https://gitlab.com/kicad/code/kicad/issues/5205
This commit is contained in:
parent
d29edf6381
commit
bf71a4e012
|
@ -666,17 +666,18 @@ void GERBER_DRAW_ITEM::DrawGbrPoly( EDA_RECT* aClipBox,
|
||||||
const wxPoint& aOffset,
|
const wxPoint& aOffset,
|
||||||
bool aFilledShape )
|
bool aFilledShape )
|
||||||
{
|
{
|
||||||
std::vector<wxPoint> points;
|
|
||||||
SHAPE_LINE_CHAIN& poly = m_Polygon.Outline( 0 );
|
SHAPE_LINE_CHAIN& poly = m_Polygon.Outline( 0 );
|
||||||
int pointCount = poly.PointCount() - 1;
|
int pointCount = poly.PointCount() - 1;
|
||||||
|
|
||||||
|
std::vector<wxPoint> points;
|
||||||
points.reserve( pointCount );
|
points.reserve( pointCount );
|
||||||
|
|
||||||
for( int ii = 0; ii < pointCount; ii++ )
|
for( int ii = 0; ii < pointCount; ii++ )
|
||||||
{
|
{
|
||||||
wxPoint p( poly.Point( ii ).x, poly.Point( ii ).y );
|
wxPoint p( poly.Point( ii ).x, poly.Point( ii ).y );
|
||||||
points[ii] = p + aOffset;
|
p = p + aOffset;
|
||||||
points[ii] = GetABPosition( points[ii] );
|
p = GetABPosition( p );
|
||||||
|
points.push_back( p );
|
||||||
}
|
}
|
||||||
|
|
||||||
GRClosedPoly( aClipBox, aDC, pointCount, &points[0], aFilledShape, aColor, aColor );
|
GRClosedPoly( aClipBox, aDC, pointCount, &points[0], aFilledShape, aColor, aColor );
|
||||||
|
|
|
@ -360,11 +360,16 @@ void GERBVIEW_PAINTER::draw( /*const*/ GERBER_DRAW_ITEM* aItem, int aLayer )
|
||||||
|
|
||||||
// TODO(JE) Refactor this to allow const aItem
|
// TODO(JE) Refactor this to allow const aItem
|
||||||
D_CODE* code = aItem->GetDcodeDescr();
|
D_CODE* code = aItem->GetDcodeDescr();
|
||||||
|
|
||||||
if( code && code->m_Shape == APT_RECT )
|
if( code && code->m_Shape == APT_RECT )
|
||||||
{
|
{
|
||||||
if( aItem->m_Polygon.OutlineCount() == 0 )
|
if( aItem->m_Polygon.OutlineCount() == 0 )
|
||||||
aItem->ConvertSegmentToPolygon();
|
aItem->ConvertSegmentToPolygon();
|
||||||
drawPolygon( aItem, aItem->m_Polygon, isFilled );
|
|
||||||
|
// Warning: drawPolygon modify the polygon to draw, so use a copy
|
||||||
|
// of aItem->m_Polygon
|
||||||
|
SHAPE_POLY_SET poly = aItem->m_Polygon;
|
||||||
|
drawPolygon( aItem, poly, isFilled );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue