From cb830f74b7fb3d0b12b31812a0621205e772c387 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 26 Feb 2021 18:03:51 +0000 Subject: [PATCH] Bounding box caching comments. --- pcbnew/footprint.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pcbnew/footprint.h b/pcbnew/footprint.h index 3f227f27bf..8cfe04135a 100644 --- a/pcbnew/footprint.h +++ b/pcbnew/footprint.h @@ -689,6 +689,16 @@ private: int m_attributes; // Flag bits ( see FOOTPRINT_ATTR_T ) int m_fpStatus; // For autoplace: flags (LOCKED, FIELDS_AUTOPLACED) + // Bounding box caching strategy: + // While we attempt to notice the low-hanging fruit operations and update the bounding boxes + // accordingly, we rely mostly on a "if anything changed then the caches are stale" approach. + // We implement this by having PCB_BASE_FRAME's OnModify() method increment an operation + // counter, and storing that as a timestamp for the various caches. + // This means caches will get regenerated often -- but still far less often than if we had no + // caches at all. The principal opitmization would be to change to dirty flag and make sure + // that any edit that could affect the bounding boxes (including edits to the footprint + // children) marked the bounding boxes dirty. It would definitely be faster -- but also more + // fragile. mutable EDA_RECT m_cachedBoundingBox; mutable int m_boundingBoxCacheTimeStamp; mutable EDA_RECT m_cachedVisibleBBox;