X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=libs%2Fcanvas%2Flookup_table.cc;h=3836ccd18a9af305a5b7b3b066a0eeb5a3338869;hb=b6c80153c3b0306514673202bc6dd611b8a02b3e;hp=2396f596354504798f0cdbc625da9c3c8bccd0b5;hpb=23e7cf10191270d70357ccf0ed9294f020c7b7ab;p=ardour.git diff --git a/libs/canvas/lookup_table.cc b/libs/canvas/lookup_table.cc index 2396f59635..3836ccd18a 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; } @@ -81,11 +92,11 @@ DumbLookupTable::has_item_at_point (Duple const & point) const if (!(*i)->visible()) { continue; } - + if ((*i)->covers (point)) { // std::cerr << "\t\t" << (*i)->whatami() << '/' << (*i)->name << " covers " << point << std::endl; return true; - + } } @@ -224,7 +235,7 @@ OptimizingLookupTable::items_at_point (Duple const & point) const if (y >= _dimension) { cout << "WARNING: y=" << y << ", dim=" << _dimension << ", py=" << point.y << " cellsize=" << _cell_size << "\n"; } - + /* XXX: hmm */ x = min (_dimension - 1, x); y = min (_dimension - 1, y); @@ -261,7 +272,7 @@ OptimizingLookupTable::has_item_at_point (Duple const & point) const if (y >= _dimension) { cout << "WARNING: y=" << y << ", dim=" << _dimension << ", py=" << point.y << " cellsize=" << _cell_size << "\n"; } - + /* XXX: hmm */ x = min (_dimension - 1, x); y = min (_dimension - 1, y); @@ -283,7 +294,7 @@ OptimizingLookupTable::has_item_at_point (Duple const & point) const return false; } - + /** @param area Area in our owning item's coordinates */ vector OptimizingLookupTable::get (Rect const & area) @@ -310,7 +321,7 @@ OptimizingLookupTable::get (Rect const & area) vector vitems; copy (items.begin (), items.end (), back_inserter (vitems)); - + return vitems; }