From 9266e7524aba32e93a6385547ce8b7888ef34a8c Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 5 Dec 2014 22:40:26 +0100 Subject: [PATCH] experimental drawing optimization. Q: is bounding_box(); etc more complex than queuing draw? either way, canvas should eventually switch to use an optimized OptimizingLookupTable. --- libs/canvas/lookup_table.cc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libs/canvas/lookup_table.cc b/libs/canvas/lookup_table.cc index 2396f59635..c50f010dc8 100644 --- a/libs/canvas/lookup_table.cc +++ b/libs/canvas/lookup_table.cc @@ -41,11 +41,22 @@ DumbLookupTable::DumbLookupTable (Item const & item) } vector -DumbLookupTable::get (Rect const &) +DumbLookupTable::get (Rect const &area) { list const & items = _item.items (); vector vitems; +#if 1 + for (list::const_iterator i = items.begin(); i != items.end(); ++i) { + boost::optional item_bbox = (*i)->bounding_box (); + if (!item_bbox) continue; + Rect item = (*i)->item_to_window (item_bbox.get()); + if (item.intersection (area)) { + vitems.push_back (*i); + } + } +#else copy (items.begin(), items.end(), back_inserter (vitems)); +#endif return vitems; }