Restore BBoxCache usage for zone fill performance.

This commit is contained in:
Jeff Young
2021-09-09 16:43:47 +01:00
parent 451f8eefc0
commit f64abcba36
4 changed files with 8 additions and 8 deletions
+2
View File
@@ -308,6 +308,8 @@ public:
virtual size_t GetPointCount() const = 0;
virtual size_t GetSegmentCount() const = 0;
virtual bool IsClosed() const = 0;
virtual BOX2I* GetCachedBBox() const { return nullptr; }
};
#endif // __SHAPE_H
@@ -413,9 +413,9 @@ public:
m_bbox.Inflate( m_width );
}
const BOX2I BBoxFromCache() const
BOX2I* GetCachedBBox() const override
{
return m_bbox;
return &m_bbox;
}
/**
@@ -1323,10 +1323,8 @@ bool SHAPE_LINE_CHAIN_BASE::PointInside( const VECTOR2I& aPt, int aAccuracy,
* Don't check the bounding box unless it's cached. Building it is about the same speed as
* the rigorous test below and so just slows things down by doing potentially two tests.
*/
//if( aUseBBoxCache && !m_bbox.Contains( aPt ) )
//return false;
// fixme: bbox cache...
if( aUseBBoxCache && GetCachedBBox() && !GetCachedBBox()->Contains( aPt ) )
return false;
if( !IsClosed() || GetPointCount() < 3 )
return false;
+2 -2
View File
@@ -1402,9 +1402,9 @@ const BOX2I SHAPE_POLY_SET::BBoxFromCaches() const
for( unsigned i = 0; i < m_polys.size(); i++ )
{
if( i == 0 )
bb = m_polys[i][0].BBoxFromCache();
bb = *m_polys[i][0].GetCachedBBox();
else
bb.Merge( m_polys[i][0].BBoxFromCache() );
bb.Merge( *m_polys[i][0].GetCachedBBox() );
}
return bb;