projects
/
ardour.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
a couple of debug output statements to help diagnose a crash
[ardour.git]
/
libs
/
canvas
/
line.cc
diff --git
a/libs/canvas/line.cc
b/libs/canvas/line.cc
index 61acf892528a0d73c150008c400d63f2cef75c6a..8bd26b90678dfc49626169acbb7cab5b3fa44ea7 100644
(file)
--- a/
libs/canvas/line.cc
+++ b/
libs/canvas/line.cc
@@
-29,11
+29,14
@@
using namespace std;
using namespace ArdourCanvas;
using namespace std;
using namespace ArdourCanvas;
-Line::Line (Group* parent)
- : Item (parent)
- , Outline (parent)
+Line::Line (Canvas* c)
+ : Item (c)
{
{
+}
+Line::Line (Item* parent)
+ : Item (parent)
+{
}
void
}
void
@@
-60,64
+63,72
@@
Line::render (Rect const & /*area*/, Cairo::RefPtr<Cairo::Context> context) cons
Duple p0 = item_to_window (Duple (_points[0].x, _points[0].y));
Duple p1 = item_to_window (Duple (_points[1].x, _points[1].y));
Duple p0 = item_to_window (Duple (_points[0].x, _points[0].y));
Duple p1 = item_to_window (Duple (_points[1].x, _points[1].y));
- /* See Cairo FAQ on single pixel lines to understand why we add 0.5
- */
+ if (_outline_width <= 1.0) {
+ /* See Cairo FAQ on single pixel lines to understand why we add 0.5
+ */
+
+ const Duple half_a_pixel (0.5, 0.5);
+ p0 = p0.translate (half_a_pixel);
+ p1 = p1.translate (half_a_pixel);
+ }
- context->move_to (p0.x
+ 0.5, p0.y + 0.5
);
- context->line_to (p1.x
+ 0.5, p1.y + 0.5
);
+ context->move_to (p0.x
, p0.y
);
+ context->line_to (p1.x
, p1.y
);
context->stroke ();
}
void
Line::set (Duple a, Duple b)
{
context->stroke ();
}
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)
{
}
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)
{
}
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)
{
}
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");
}
DEBUG_TRACE (PBD::DEBUG::CanvasItemsDirtied, "canvas item dirty: line change\n");
}
@@
-125,33
+136,33
@@
Line::set_y0 (Coord y0)
void
Line::set_x1 (Coord x1)
{
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)
{
}
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
Line::covers (Duple const & point) const
{
}
bool
Line::covers (Duple const & point) const
{
- const Duple p =
canvas
_to_item (point);
+ const Duple p =
window
_to_item (point);
static const Distance threshold = 2.0;
/* this quick check works for vertical and horizontal lines, which are
static const Distance threshold = 2.0;
/* this quick check works for vertical and horizontal lines, which are
@@
-172,7
+183,7
@@
Line::covers (Duple const & point) const
double t;
Duple a (_points[0]);
Duple b (_points[1]);
double t;
Duple a (_points[0]);
Duple b (_points[1]);
- const Rect visible (
_canvas->visible_area(
));
+ const Rect visible (
window_to_item (_canvas->visible_area()
));
/*
Clamp the line endpoints to the visible area of the canvas. If we do
/*
Clamp the line endpoints to the visible area of the canvas. If we do