summaryrefslogtreecommitdiff
path: root/lily/beam.cc
diff options
context:
space:
mode:
authorBenkő Pál <benko.pal@gmail.com>2012-05-13 18:07:40 +0200
committerBenkő Pál <benko.pal@gmail.com>2012-06-01 21:44:14 +0200
commit2a872121379fffe7b1cd5d23048b7ea04b4d1f68 (patch)
treea85c8f54c2ec3f8b0410bdbe0f4802fd880d0991 /lily/beam.cc
parent542e0ccee05d181d62d54c18435d6dd0aa2740b3 (diff)
line_count fixes
1. implementation does not assume staff centred at zero 2. where used for determining whether something falls on a line, use Staff_symbol_referencer::on_line or on_staff_line 3. where used for determining whether something is within staff or not, use Staff_symbol_referencer::staff_span
Diffstat (limited to 'lily/beam.cc')
-rw-r--r--lily/beam.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/lily/beam.cc b/lily/beam.cc
index 49253434c0..d73169a917 100644
--- a/lily/beam.cc
+++ b/lily/beam.cc
@@ -675,7 +675,7 @@ Beam::print (SCM grob)
// we need two translations: the normal one and
// the one of the lowest segment
- int idx[] = {i, extreme};
+ size_t idx[] = {i, extreme};
Real translations[2];
for (int j = 0; j < 2; j++)
@@ -1274,16 +1274,16 @@ Beam::rest_collision_callback (SCM smob, SCM prev_offset)
Real shift = d * min (d * (beam_y - d * minimum_distance - rest_dim), 0.0);
shift /= staff_space;
- Real rad = Staff_symbol_referencer::line_count (rest) * staff_space / 2;
/* Always move discretely by half spaces */
shift = ceil (fabs (shift * 2.0)) / 2.0 * sign (shift);
+ Interval staff_span = Staff_symbol_referencer::staff_span (rest);
+ staff_span *= staff_space / 2;
+
/* Inside staff, move by whole spaces*/
- if ((rest_extent[d] + staff_space * shift) * d
- < rad
- || (rest_extent[-d] + staff_space * shift) * -d
- < rad)
+ if (staff_span.contains (rest_extent[d] + staff_space * shift)
+ || staff_span.contains (rest_extent[-d] + staff_space * shift))
shift = ceil (fabs (shift)) * sign (shift);
return scm_from_double (offset + staff_space * shift);