diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2014-03-11 07:36:09 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2014-03-11 07:36:09 -0400 |
commit | c2946ee00f6b5ec8205dd2fcb5b6d2ace2907436 (patch) | |
tree | a9d088f0e42209e0bab50686a54ac12290fbe776 /libs/canvas/line.cc | |
parent | 495c0de4ac2e5292a2ebaf276e57cb30fea414db (diff) |
don't queue redraws when various canvas item properties are "reset" to the same value, plus supporting functions
Diffstat (limited to 'libs/canvas/line.cc')
-rw-r--r-- | libs/canvas/line.cc | 98 |
1 files changed, 50 insertions, 48 deletions
diff --git a/libs/canvas/line.cc b/libs/canvas/line.cc index 09f9061c85..8f04e2b278 100644 --- a/libs/canvas/line.cc +++ b/libs/canvas/line.cc @@ -77,53 +77,55 @@ Line::render (Rect const & /*area*/, Cairo::RefPtr<Cairo::Context> context) cons void Line::set (Duple a, Duple b) { - begin_change (); - - _points[0] = a; - _points[1] = b; - - _bounding_box_dirty = true; - end_change (); - - DEBUG_TRACE (PBD::DEBUG::CanvasItemsDirtied, "canvas item dirty: line change\n"); + if (a != _points[0] || b != _points[1]) { + begin_change (); + + _points[0] = a; + _points[1] = b; + + _bounding_box_dirty = true; + end_change (); + } } void Line::set_x (Coord x0, Coord x1) { - begin_change (); - - _points[0].x = x0; - _points[1].x = x1; - - _bounding_box_dirty = true; - end_change (); - - DEBUG_TRACE (PBD::DEBUG::CanvasItemsDirtied, "canvas item dirty: line change\n"); + if (x0 != _points[0].x || x1 != _points[1].x) { + begin_change (); + + _points[0].x = x0; + _points[1].x = x1; + + _bounding_box_dirty = true; + end_change (); + } } void Line::set_x0 (Coord x0) { - begin_change (); - - _points[0].x = x0; - - _bounding_box_dirty = true; - end_change (); - - DEBUG_TRACE (PBD::DEBUG::CanvasItemsDirtied, "canvas item dirty: line change\n"); + if (x0 != _points[0].x) { + begin_change (); + + _points[0].x = x0; + + _bounding_box_dirty = true; + end_change (); + } } void Line::set_y0 (Coord y0) { - begin_change (); - - _points[0].y = y0; - - _bounding_box_dirty = true; - end_change (); + if (y0 != _points[0].y) { + begin_change (); + + _points[0].y = y0; + + _bounding_box_dirty = true; + end_change (); + } DEBUG_TRACE (PBD::DEBUG::CanvasItemsDirtied, "canvas item dirty: line change\n"); } @@ -131,27 +133,27 @@ Line::set_y0 (Coord y0) void Line::set_x1 (Coord x1) { - begin_change (); - - _points[1].x = x1; - - _bounding_box_dirty = true; - end_change (); - - DEBUG_TRACE (PBD::DEBUG::CanvasItemsDirtied, "canvas item dirty: line change\n"); + if (x1 != _points[1].x) { + begin_change (); + + _points[1].x = x1; + + _bounding_box_dirty = true; + end_change (); + } } void Line::set_y1 (Coord y1) { - begin_change (); - - _points[1].y = y1; - - _bounding_box_dirty = true; - end_change (); - - DEBUG_TRACE (PBD::DEBUG::CanvasItemsDirtied, "canvas item dirty: line change\n"); + if (y1 != _points[1].y) { + begin_change (); + + _points[1].y = y1; + + _bounding_box_dirty = true; + end_change (); + } } bool |