ensure_lut ();
vector<Item*> items = _lut->get (area);
- ++render_depth;
-
#ifdef CANVAS_DEBUG
if (DEBUG_ENABLED(PBD::DEBUG::CanvasRender)) {
- cerr << string_compose ("%1GROUP %2 render %3 items out of %4\n",
- _canvas->render_indent(), (name.empty() ? string ("[unnamed]") : name), items.size(), _items.size());
+ cerr << string_compose ("%1GROUP %2 render %5 %3 items out of %4\n",
+ _canvas->render_indent(), (name.empty() ? string ("[unnamed]") : name), items.size(), _items.size(), area);
}
#endif
+ ++render_depth;
+
for (vector<Item*>::const_iterator i = items.begin(); i != items.end(); ++i) {
if (!(*i)->visible ()) {
#ifdef CANVAS_DEBUG
if (DEBUG_ENABLED(PBD::DEBUG::CanvasRender)) {
- // cerr << _canvas->render_indent() << "Item " << (*i)->whatami() << " [" << (*i)->name << "] invisible - skipped\n";
+ cerr << _canvas->render_indent() << "Item " << (*i)->whatami() << " [" << (*i)->name << "] invisible - skipped\n";
}
#endif
continue;
if (!item_bbox) {
#ifdef CANVAS_DEBUG
if (DEBUG_ENABLED(PBD::DEBUG::CanvasRender)) {
- // cerr << _canvas->render_indent() << "Item " << (*i)->whatami() << " [" << (*i)->name << "] empty - skipped\n";
+ cerr << _canvas->render_indent() << "Item " << (*i)->whatami() << " [" << (*i)->name << "] empty - skipped\n";
}
#endif
continue;
}
+
+ Rect item = (*i)->item_to_window (item_bbox.get());
+ boost::optional<Rect> d = item.intersection (area);
+
+ if (d) {
+ Rect draw = d.get();
+ if (draw.width() && draw.height()) {
+#ifdef CANVAS_DEBUG
+ if (DEBUG_ENABLED(PBD::DEBUG::CanvasRender)) {
+ if (dynamic_cast<Group*>(*i) == 0) {
+ cerr << _canvas->render_indent() << "render "
+ << ' '
+ << (*i)->whatami()
+ << ' '
+ << (*i)->name
+ << " item = "
+ << item
+ << " intersect = "
+ << draw
+ << endl;
+ }
+ }
+#endif
- /* convert the render area to our child's coordinates */
- Rect const item_area = (*i)->parent_to_item (area);
+ (*i)->render (area, context);
+ ++render_count;
+ }
- /* intersect the child's render area with the child's bounding box */
- boost::optional<Rect> r = item_bbox.get().intersection (item_area);
+ } else {
- if (r) {
- /* render the intersection */
- context->save ();
- context->translate ((*i)->position().x, (*i)->position().y);
#ifdef CANVAS_DEBUG
if (DEBUG_ENABLED(PBD::DEBUG::CanvasRender)) {
- cerr << string_compose ("%1render %2 %3\n", _canvas->render_indent(), (*i)->whatami(),
+ cerr << string_compose ("%1skip render of %2 %3, no intersection\n", _canvas->render_indent(), (*i)->whatami(),
(*i)->name);
}
#endif
- (*i)->render (r.get(), context);
- ++render_count;
- context->restore ();
- } else {
-#ifdef CANVAS_DEBUG
- if (DEBUG_ENABLED(PBD::DEBUG::CanvasRender)) {
- //cerr << string_compose ("%1skip render of %2 %3, no intersection\n", _canvas->render_indent(), (*i)->whatami(),
- // (*i)->name);
- }
-#endif
+
}
}
bool have_one = false;
for (list<Item*>::const_iterator i = _items.begin(); i != _items.end(); ++i) {
+
boost::optional<Rect> item_bbox = (*i)->bounding_box ();
+
if (!item_bbox) {
continue;
}
{
boost::optional<Rect> const bbox = bounding_box ();
- if (!bbox || !bbox.get().contains (point)) {
+ /* Point is in canvas coordinate system */
+
+ if (!bbox || !item_to_canvas (bbox.get()).contains (point)) {
return;
}
- Item::add_items_at_point (point, items);
-
+ /* now recurse and add any items within our group that contain point */
+
ensure_lut ();
-
vector<Item*> our_items = _lut->items_at_point (point);
+
+ if (!our_items.empty()) {
+ /* this adds this group itself to the list of items at point */
+ Item::add_items_at_point (point, items);
+ }
+
for (vector<Item*>::iterator i = our_items.begin(); i != our_items.end(); ++i) {
- (*i)->add_items_at_point (point - (*i)->position(), items);
+ (*i)->add_items_at_point (point, items);
}
}
void
Group::dump (ostream& o) const
{
+#ifdef CANVAS_DEBUG
o << _canvas->indent();
o << "Group " << this << " [" << name << ']';
o << " @ " << position();
}
o << endl;
+#endif
ArdourCanvas::dump_depth++;