diff options
author | Tim Mayberry <mojofunk@gmail.com> | 2017-04-01 23:02:49 +1000 |
---|---|---|
committer | Tim Mayberry <mojofunk@gmail.com> | 2017-06-26 08:40:47 +1000 |
commit | c4e31fc32273a84c0436f32fce742ae21718b03c (patch) | |
tree | 3fac41d0063c4dc43112e1a65b43ede9b03f72aa /libs/canvas/item.cc | |
parent | 265f52535a73d996de0e6a61a5b30070c6226cf8 (diff) |
Add an optional ArdourCanvas::Item::prepare_for_render interface
Called when an item has requested a redraw and intersects with visible
canvas area.
Also add Canvas::prepare_for_render that will call Item::prepare_for_render for
items visible on the canvas.
Diffstat (limited to 'libs/canvas/item.cc')
-rw-r--r-- | libs/canvas/item.cc | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/libs/canvas/item.cc b/libs/canvas/item.cc index 589f1214b7..98fe6362db 100644 --- a/libs/canvas/item.cc +++ b/libs/canvas/item.cc @@ -831,6 +831,43 @@ Item::render_children (Rect const & area, Cairo::RefPtr<Cairo::Context> context) } void +Item::prepare_for_render_children (Rect const & area) const +{ + if (_items.empty()) { + return; + } + + ensure_lut (); + std::vector<Item*> items = _lut->get (area); + + for (std::vector<Item*>::const_iterator i = items.begin(); i != items.end(); ++i) { + + if (!(*i)->visible ()) { + continue; + } + + Rect item_bbox = (*i)->bounding_box (); + + if (!item_bbox) { + continue; + } + + Rect item = (*i)->item_to_window (item_bbox, false); + Rect d = item.intersection (area); + + if (d) { + Rect draw = d; + if (draw.width() && draw.height()) { + (*i)->prepare_for_render (area); + } + + } else { + // Item does not intersect with visible canvas area + } + } +} + +void Item::add_child_bounding_boxes (bool include_hidden) const { Rect self; |