Regularize how penWidths are fetched.
Fixes https://gitlab.com/kicad/code/kicad/issues/git
This commit is contained in:
parent
aedfe08bad
commit
0ffa1288ee
|
@ -149,8 +149,10 @@ public:
|
|||
// For historical reasons, a stored value of 0 means "default width" and negative
|
||||
// numbers meant "don't stroke".
|
||||
|
||||
if( GetPenWidth() <= 0 )
|
||||
return aSettings->GetDefaultPenWidth();
|
||||
if( GetPenWidth() < 0 )
|
||||
return 0;
|
||||
else if( GetPenWidth() == 0 )
|
||||
return std::max( aSettings->GetDefaultPenWidth(), aSettings->GetMinPenWidth() );
|
||||
else
|
||||
return std::max( GetPenWidth(), aSettings->GetMinPenWidth() );
|
||||
}
|
||||
|
|
|
@ -57,19 +57,6 @@ public:
|
|||
|
||||
int GetPenWidth() const override;
|
||||
|
||||
int GetEffectivePenWidth( const RENDER_SETTINGS* aSettings ) const override
|
||||
{
|
||||
// For historical reasons, a stored value of 0 means "default width" and negative
|
||||
// numbers meant "don't stroke".
|
||||
|
||||
if( GetPenWidth() < 0 )
|
||||
return 0;
|
||||
else if( GetPenWidth() == 0 )
|
||||
return aSettings->GetDefaultPenWidth();
|
||||
else
|
||||
return std::max( GetPenWidth(), aSettings->GetMinPenWidth() );
|
||||
}
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
|
||||
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||
|
|
|
@ -378,36 +378,21 @@ float SCH_PAINTER::getLineWidth( const EDA_ITEM* aItem, bool aDrawingShadows ) c
|
|||
{
|
||||
wxCHECK( aItem, static_cast<float>( Mils2iu( DEFAULT_LINE_WIDTH_MILS ) ) );
|
||||
|
||||
int pen;
|
||||
int pen = 0;
|
||||
|
||||
if( aItem->Type() == LIB_TEXTBOX_T )
|
||||
{
|
||||
pen = static_cast<const LIB_TEXTBOX*>( aItem )->GetStroke().GetWidth();
|
||||
}
|
||||
else if( aItem->Type() == SCH_TEXTBOX_T )
|
||||
{
|
||||
pen = static_cast<const SCH_TEXTBOX*>( aItem )->GetStroke().GetWidth();
|
||||
}
|
||||
else if( dynamic_cast<const LIB_ITEM*>( aItem ) )
|
||||
{
|
||||
if( dynamic_cast<const LIB_ITEM*>( aItem ) )
|
||||
pen = static_cast<const LIB_ITEM*>( aItem )->GetEffectivePenWidth( &m_schSettings );
|
||||
}
|
||||
else if( dynamic_cast<const SCH_ITEM*>( aItem ) )
|
||||
{
|
||||
pen = static_cast<const SCH_ITEM*>( aItem )->GetPenWidth();
|
||||
}
|
||||
else
|
||||
{
|
||||
pen = 0;
|
||||
UNIMPLEMENTED_FOR( aItem->GetClass() );
|
||||
}
|
||||
|
||||
float width = pen;
|
||||
|
||||
if( ( aItem->IsBrightened() || aItem->IsSelected() ) && aDrawingShadows )
|
||||
width += getShadowWidth( aItem->IsBrightened() );
|
||||
|
||||
return std::max( width, 1.0f );
|
||||
return width;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue