projects
/
ardour.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
remove unused code
[ardour.git]
/
libs
/
canvas
/
poly_item.cc
diff --git
a/libs/canvas/poly_item.cc
b/libs/canvas/poly_item.cc
index ebf744a0b2fccacc2a35160148d74cbed65d4f3e..69afb5ac24b93df1efdd9703080e79cc079ec7fa 100644
(file)
--- a/
libs/canvas/poly_item.cc
+++ b/
libs/canvas/poly_item.cc
@@
-64,12
+64,17
@@
PolyItem::compute_bounding_box () const
}
void
}
void
-PolyItem::render_path (Rect const & /*
area
*/, Cairo::RefPtr<Cairo::Context> context) const
+PolyItem::render_path (Rect const & /*
area
*/, Cairo::RefPtr<Cairo::Context> context) const
{
{
+ if (_points.size() < 2) {
+ return;
+ }
+
Points::const_iterator i = _points.begin();
Duple c (item_to_window (Duple (i->x, i->y)));
context->move_to (c.x, c.y);
Points::const_iterator i = _points.begin();
Duple c (item_to_window (Duple (i->x, i->y)));
context->move_to (c.x, c.y);
+ ++i;
while (i != _points.end()) {
c = item_to_window (Duple (i->x, i->y));
while (i != _points.end()) {
c = item_to_window (Duple (i->x, i->y));
@@
-81,8
+86,6
@@
PolyItem::render_path (Rect const & /*area*/, Cairo::RefPtr<Cairo::Context> cont
void
PolyItem::render_curve (Rect const & area, Cairo::RefPtr<Cairo::Context> context, Points const & first_control_points, Points const & second_control_points) const
{
void
PolyItem::render_curve (Rect const & area, Cairo::RefPtr<Cairo::Context> context, Points const & first_control_points, Points const & second_control_points) const
{
- bool done_first = false;
-
if (_points.size() <= 2) {
render_path (area, context);
return;
if (_points.size() <= 2) {
render_path (area, context);
return;
@@
-90,26
+93,24
@@
PolyItem::render_curve (Rect const & area, Cairo::RefPtr<Cairo::Context> context
Points::const_iterator cp1 = first_control_points.begin();
Points::const_iterator cp2 = second_control_points.begin();
Points::const_iterator cp1 = first_control_points.begin();
Points::const_iterator cp2 = second_control_points.begin();
+ Points::const_iterator p = _points.begin();
- for (Points::const_iterator i = _points.begin(); i != _points.end(); ++i) {
-
- if (!done_first) {
-
- Duple c = item_to_window (Duple (i->x, i->y));
- context->move_to (c.x, c.y);
- done_first = true;
-
- } else {
+ Duple c = item_to_window (Duple (p->x, p->y));
+ context->move_to (c.x, c.y);
+ ++p;
- Duple c1 = item_to_window (Duple (cp1->x, cp1->y));
- Duple c2 = item_to_window (Duple (cp2->x, cp2->y));
- Duple c3 = item_to_window (Duple (i->x, i->y));
+ while (p != _points.end()) {
- context->curve_to (c1.x, c1.y, c2.x, c2.y, c3.x, c3.y);
+ Duple c1 = item_to_window (Duple (cp1->x, cp1->y));
+ Duple c2 = item_to_window (Duple (cp2->x, cp2->y));
- cp1++;
- cp2++;
- }
+ c = item_to_window (Duple (p->x, p->y));
+
+ context->curve_to (c1.x, c1.y, c2.x, c2.y, c.x, c.y);
+
+ ++cp1;
+ ++cp2;
+ ++p;
}
}
}
}