From 7d62f14dd0745e79828ed1ce0cfcf2b0a4890c60 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Sun, 3 Jun 2018 16:44:13 -0700 Subject: [PATCH] Set ViewBBox to viewitem size Limit the bbox size of origin view item to item size. This prevents excessive redraw. This also side-steps a degeneracy in the RTree calculation under certain conditions in i386 where multiple, maximum-sized items are degenerate. Fixes: lp:1774316 * https://bugs.launchpad.net/kicad/+bug/1774316 --- common/origin_viewitem.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/common/origin_viewitem.cpp b/common/origin_viewitem.cpp index 0e05597f27..d7ae5fd249 100644 --- a/common/origin_viewitem.cpp +++ b/common/origin_viewitem.cpp @@ -53,7 +53,14 @@ ORIGIN_VIEWITEM* ORIGIN_VIEWITEM::Clone() const const BOX2I ORIGIN_VIEWITEM::ViewBBox() const { BOX2I bbox; - bbox.SetMaximum(); + + if( m_drawAtZero ) + bbox.SetOrigin( VECTOR2I( -m_size / 2, -m_size / 2 ) ); + else + bbox.SetOrigin( VECTOR2I( m_position.x, m_position.y ) - VECTOR2I( m_size / 2, m_size / 2 ) ); + + bbox.SetSize( VECTOR2I( m_size, m_size ) ); + return bbox; }