Safety for negative pen widths.
This commit is contained in:
parent
8cf291e423
commit
c7e865e4a2
|
@ -594,8 +594,7 @@ void PLOTTER::ThickArc( const VECTOR2D& centre, const EDA_ANGLE& aStartAngle,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PLOTTER::ThickArc( const EDA_SHAPE& aArcShape,
|
void PLOTTER::ThickArc( const EDA_SHAPE& aArcShape, OUTLINE_MODE aTraceMode, void* aData )
|
||||||
OUTLINE_MODE aTraceMode, void* aData )
|
|
||||||
{
|
{
|
||||||
VECTOR2D center = aArcShape.getCenter();
|
VECTOR2D center = aArcShape.getCenter();
|
||||||
VECTOR2D mid = aArcShape.GetArcMid();
|
VECTOR2D mid = aArcShape.GetArcMid();
|
||||||
|
|
|
@ -107,7 +107,7 @@ public:
|
||||||
void SetFillColor( const COLOR4D& aColor ) { m_fillColor = aColor; }
|
void SetFillColor( const COLOR4D& aColor ) { m_fillColor = aColor; }
|
||||||
|
|
||||||
void SetWidth( int aWidth ) { m_stroke.SetWidth( aWidth ); }
|
void SetWidth( int aWidth ) { m_stroke.SetWidth( aWidth ); }
|
||||||
int GetWidth() const { return m_stroke.GetWidth(); }
|
virtual int GetWidth() const { return m_stroke.GetWidth(); }
|
||||||
virtual int GetEffectiveWidth() const { return GetWidth(); }
|
virtual int GetEffectiveWidth() const { return GetWidth(); }
|
||||||
|
|
||||||
void SetLineStyle( const PLOT_DASH_TYPE aStyle );
|
void SetLineStyle( const PLOT_DASH_TYPE aStyle );
|
||||||
|
|
|
@ -382,8 +382,8 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aShapeList, SHAPE_POLY_SE
|
||||||
// Ensure the approximated Bezier shape is built
|
// Ensure the approximated Bezier shape is built
|
||||||
// a good value is between (Bezier curve width / 2) and (Bezier curve width)
|
// a good value is between (Bezier curve width / 2) and (Bezier curve width)
|
||||||
// ( and at least 0.05 mm to avoid very small segments)
|
// ( and at least 0.05 mm to avoid very small segments)
|
||||||
int min_segm_lenght = std::max( pcbIUScale.mmToIU( 0.05 ), graphic->GetWidth() );
|
int min_segm_length = std::max( pcbIUScale.mmToIU( 0.05 ), graphic->GetWidth() );
|
||||||
graphic->RebuildBezierToSegmentsPointsList( min_segm_lenght );
|
graphic->RebuildBezierToSegmentsPointsList( min_segm_length );
|
||||||
|
|
||||||
if( reverse )
|
if( reverse )
|
||||||
{
|
{
|
||||||
|
|
|
@ -146,6 +146,16 @@ std::vector<VECTOR2I> PCB_SHAPE::GetConnectionPoints() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int PCB_SHAPE::GetWidth() const
|
||||||
|
{
|
||||||
|
// A stroke width of 0 in PCBNew means no-border, but negative stroke-widths are only used
|
||||||
|
// in EEschema (see SCH_SHAPE::GetPenWidth()).
|
||||||
|
// Since negative stroke widths can trip up down-stream code (such as the Gerber plotter), we
|
||||||
|
// weed them out here.
|
||||||
|
return std::max( EDA_SHAPE::GetWidth(), 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_SHAPE::StyleFromSettings( const BOARD_DESIGN_SETTINGS& settings )
|
void PCB_SHAPE::StyleFromSettings( const BOARD_DESIGN_SETTINGS& settings )
|
||||||
{
|
{
|
||||||
m_stroke.SetWidth( settings.GetLineThickness( GetLayer() ) );
|
m_stroke.SetWidth( settings.GetLineThickness( GetLayer() ) );
|
||||||
|
|
|
@ -82,6 +82,8 @@ public:
|
||||||
STROKE_PARAMS GetStroke() const override { return m_stroke; }
|
STROKE_PARAMS GetStroke() const override { return m_stroke; }
|
||||||
void SetStroke( const STROKE_PARAMS& aStroke ) override { m_stroke = aStroke; }
|
void SetStroke( const STROKE_PARAMS& aStroke ) override { m_stroke = aStroke; }
|
||||||
|
|
||||||
|
int GetWidth() const override;
|
||||||
|
|
||||||
void StyleFromSettings( const BOARD_DESIGN_SETTINGS& settings ) override;
|
void StyleFromSettings( const BOARD_DESIGN_SETTINGS& settings ) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue