Push addition of shape width down into computeArcBBox.
Also improves performance by calling GetBoundingBox only once (this is not always an inexpensive routine for some items, such as polygons).
This commit is contained in:
parent
1733a23ac7
commit
6983bcd55b
|
@ -206,8 +206,9 @@ EDA_ITEM& EDA_ITEM::operator=( const EDA_ITEM& aItem )
|
|||
const BOX2I EDA_ITEM::ViewBBox() const
|
||||
{
|
||||
// Basic fallback
|
||||
return BOX2I( VECTOR2I( GetBoundingBox().GetOrigin() ),
|
||||
VECTOR2I( GetBoundingBox().GetSize() ) );
|
||||
EDA_RECT bbox = GetBoundingBox();
|
||||
|
||||
return BOX2I( bbox.GetOrigin(), bbox.GetSize() );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -958,14 +958,11 @@ const BOX2I PCB_SHAPE::ViewBBox() const
|
|||
EDA_RECT bbox;
|
||||
bbox.SetOrigin( m_end );
|
||||
computeArcBBox( bbox );
|
||||
BOX2I return_box( bbox.GetOrigin(), bbox.GetSize() );
|
||||
|
||||
return_box.Inflate( 2 * m_width );
|
||||
return return_box;
|
||||
return BOX2I( bbox.GetOrigin(), bbox.GetSize() );
|
||||
}
|
||||
|
||||
BOX2I return_box = EDA_ITEM::ViewBBox();
|
||||
return_box.Inflate( 2 * m_width );
|
||||
return_box.Inflate( m_width );
|
||||
|
||||
return return_box;
|
||||
}
|
||||
|
@ -1055,9 +1052,9 @@ void PCB_SHAPE::computeArcBBox( EDA_RECT& aBBox ) const
|
|||
{
|
||||
switch( quarter )
|
||||
{
|
||||
case 0: aBBox.Merge( wxPoint( m_start.x, m_start.y + radius ) ); break; // down
|
||||
case 0: aBBox.Merge( wxPoint( m_start.x, m_start.y + radius ) ); break; // down
|
||||
case 1: aBBox.Merge( wxPoint( m_start.x - radius, m_start.y ) ); break; // left
|
||||
case 2: aBBox.Merge( wxPoint( m_start.x, m_start.y - radius ) ); break; // up
|
||||
case 2: aBBox.Merge( wxPoint( m_start.x, m_start.y - radius ) ); break; // up
|
||||
case 3: aBBox.Merge( wxPoint( m_start.x + radius, m_start.y ) ); break; // right
|
||||
}
|
||||
|
||||
|
@ -1069,6 +1066,10 @@ void PCB_SHAPE::computeArcBBox( EDA_RECT& aBBox ) const
|
|||
quarter %= 4;
|
||||
angle -= 900;
|
||||
}
|
||||
|
||||
aBBox.Inflate( m_width ); // Technically m_width / 2, but it doesn't hurt to have the
|
||||
// bounding box a bit large to account for drawing clearances,
|
||||
// etc.
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue