diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2014-06-18 11:20:10 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2014-06-18 11:20:10 -0400 |
commit | 36a34dc1a48552f6ef820ea964be7a79cc72f8bf (patch) | |
tree | 1ff82fe363e36e7cc75261ef106cb7c27a7109d0 | |
parent | becf857f48dd021307fca75082d29b95b4ffd539 (diff) | |
parent | 0bd17ed2e462578fee592a242b6d70c005d9e819 (diff) |
Merge branch 'canvas_tweaks' of https://github.com/nmains/ardour into cairocanvas
-rw-r--r-- | libs/canvas/canvas.cc | 25 | ||||
-rw-r--r-- | libs/canvas/item.cc | 12 |
2 files changed, 27 insertions, 10 deletions
diff --git a/libs/canvas/canvas.cc b/libs/canvas/canvas.cc index 574304e7dd..4ccf46b019 100644 --- a/libs/canvas/canvas.cc +++ b/libs/canvas/canvas.cc @@ -170,7 +170,9 @@ Canvas::item_shown_or_hidden (Item* item) { boost::optional<Rect> bbox = item->bounding_box (); if (bbox) { - queue_draw_item_area (item, bbox.get ()); + if (item->item_to_window (*bbox).intersection (visible_area ())) { + queue_draw_item_area (item, bbox.get ()); + } } } @@ -183,7 +185,9 @@ Canvas::item_visual_property_changed (Item* item) { boost::optional<Rect> bbox = item->bounding_box (); if (bbox) { - queue_draw_item_area (item, bbox.get ()); + if (item->item_to_window (*bbox).intersection (visible_area ())) { + queue_draw_item_area (item, bbox.get ()); + } } } @@ -195,15 +199,24 @@ Canvas::item_visual_property_changed (Item* item) void Canvas::item_changed (Item* item, boost::optional<Rect> pre_change_bounding_box) { + + Rect window_bbox = visible_area (); + if (pre_change_bounding_box) { - /* request a redraw of the item's old bounding box */ - queue_draw_item_area (item, pre_change_bounding_box.get ()); + + if (item->item_to_window (*pre_change_bounding_box).intersection (window_bbox)) { + /* request a redraw of the item's old bounding box */ + queue_draw_item_area (item, pre_change_bounding_box.get ()); + } } boost::optional<Rect> post_change_bounding_box = item->bounding_box (); if (post_change_bounding_box) { - /* request a redraw of the item's new bounding box */ - queue_draw_item_area (item, post_change_bounding_box.get ()); + + if (item->item_to_window (*post_change_bounding_box).intersection (window_bbox)) { + /* request a redraw of the item's new bounding box */ + queue_draw_item_area (item, post_change_bounding_box.get ()); + } } } diff --git a/libs/canvas/item.cc b/libs/canvas/item.cc index ce15782b9e..90bf0972f0 100644 --- a/libs/canvas/item.cc +++ b/libs/canvas/item.cc @@ -545,10 +545,12 @@ Item::begin_change () void Item::end_change () { - _canvas->item_changed (this, _pre_change_bounding_box); + if (_visible) { + _canvas->item_changed (this, _pre_change_bounding_box); - if (_parent) { - _parent->child_changed (); + if (_parent) { + _parent->child_changed (); + } } } @@ -560,7 +562,9 @@ Item::begin_visual_change () void Item::end_visual_change () { - _canvas->item_visual_property_changed (this); + if (_visible) { + _canvas->item_visual_property_changed (this); + } } void |