diff options
author | Robin Gareus <robin@gareus.org> | 2014-12-05 22:40:26 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2014-12-05 22:40:26 +0100 |
commit | 9266e7524aba32e93a6385547ce8b7888ef34a8c (patch) | |
tree | b19c4df20ab0f8bad3981c46f2b935437d3c4bc9 /libs/canvas | |
parent | 587dc283ead31efeb5e0c00eea640d862773186a (diff) |
experimental drawing optimization.
Q: is bounding_box(); etc more complex than queuing draw?
either way, canvas should eventually switch to
use an optimized OptimizingLookupTable.
Diffstat (limited to 'libs/canvas')
-rw-r--r-- | libs/canvas/lookup_table.cc | 13 |
1 files changed, 12 insertions, 1 deletions
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<Item *> -DumbLookupTable::get (Rect const &) +DumbLookupTable::get (Rect const &area) { list<Item *> const & items = _item.items (); vector<Item *> vitems; +#if 1 + for (list<Item *>::const_iterator i = items.begin(); i != items.end(); ++i) { + boost::optional<Rect> 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; } |