X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fstem.cc;h=8069a456c814e48cf24bddec96bf9d8fae2279ac;hb=5824899210e6d05e3b8767ffff25c79dca6b038e;hp=47e679712519e198cbc295763c3009cd17706d88;hpb=820bbcbc38981f5a1866f291cdf40042ea686db0;p=lilypond.git diff --git a/lily/stem.cc b/lily/stem.cc index 47e6797125..8069a456c8 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -225,8 +225,7 @@ Stem::extremal_heads (Grob *me) Grob *n = heads[i]; int p = Staff_symbol_referencer::get_rounded_position (n); - Direction d = LEFT; - do + for (LEFT_and_RIGHT (d)) { if (d * p > d * extpos[d]) { @@ -234,7 +233,6 @@ Stem::extremal_heads (Grob *me) extpos[d] = p; } } - while (flip (&d) != DOWN); } return exthead; } @@ -319,10 +317,8 @@ Stem::internal_pure_height (Grob *me, bool calc_beam) { Interval overshoot; Direction dir = get_grob_direction (me); - Direction d = DOWN; - do + for (DOWN_and_UP (d)) overshoot[d] = d == dir ? dir * infinity_f : iv[d]; - while (flip (&d) != DOWN); vector heights; vector my_stems; @@ -370,10 +366,8 @@ Stem::cache_pure_height (Grob *me, Interval iv, Interval my_iv) { Interval overshoot; Direction dir = get_grob_direction (me); - Direction d = DOWN; - do + for (DOWN_and_UP (d)) overshoot[d] = d == dir ? dir * infinity_f : my_iv[d]; - while (flip (&d) != DOWN); iv.intersect (overshoot); dynamic_cast (me)->cache_pure_height (iv); @@ -695,7 +689,7 @@ Interval Stem::internal_height (Grob *me, bool calc_beam) { Grob *beam = get_beam (me); - if (!is_valid_stem (me) && ! beam) + if (!is_valid_stem (me) && !beam) return Interval (); Direction dir = get_grob_direction (me); @@ -706,6 +700,13 @@ Stem::internal_height (Grob *me, bool calc_beam) (void) beam->get_property ("quantized-positions"); } + /* + If there is a beam but no stem, slope calculations depend on this + routine to return where the stem end /would/ be. + */ + if (calc_beam && !beam && !unsmob_stencil (me->get_property ("stencil"))) + return Interval (); + Real y1 = robust_scm2double ((calc_beam ? me->get_property ("stem-begin-position") : me->get_pure_property ("stem-begin-position", 0, INT_MAX)),