Make sure bounding box is not degenerate.

This commit is contained in:
Jeff Young 2022-10-12 15:12:49 +01:00
parent efa14e501c
commit 5507748fa9
1 changed files with 3 additions and 4 deletions

View File

@ -190,14 +190,13 @@ void SCH_LINE::ViewGetLayers( int aLayers[], int& aCount ) const
const BOX2I SCH_LINE::GetBoundingBox() const
{
int width = m_stroke.GetWidth() / 2;
int extra = m_stroke.GetWidth() & 0x1;
int width = GetPenWidth() / 2;
int xmin = std::min( m_start.x, m_end.x ) - width;
int ymin = std::min( m_start.y, m_end.y ) - width;
int xmax = std::max( m_start.x, m_end.x ) + width + extra;
int ymax = std::max( m_start.y, m_end.y ) + width + extra;
int xmax = std::max( m_start.x, m_end.x ) + width + 1;
int ymax = std::max( m_start.y, m_end.y ) + width + 1;
BOX2I ret( VECTOR2I( xmin, ymin ), VECTOR2I( xmax - xmin, ymax - ymin ) );