From: Mike Solomon Date: Thu, 22 Sep 2011 08:12:40 +0000 (+0200) Subject: Terminates Slur::outside_staff_callback early if grob is out of slur's range. X-Git-Tag: release/2.15.13-1~36 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=dd855b6da30a050359a94ac719e0fc37a2fca666;p=lilypond.git Terminates Slur::outside_staff_callback early if grob is out of slur's range. This reduces the chance that there will be a programming error when looking for a Bezier intersection, as grobs that no longer intersect with the slur will not be considered for shifting. --- diff --git a/input/regression/slur-vestigial-outside-staff-callback.ly b/input/regression/slur-vestigial-outside-staff-callback.ly new file mode 100644 index 0000000000..841ad8e6de --- /dev/null +++ b/input/regression/slur-vestigial-outside-staff-callback.ly @@ -0,0 +1,19 @@ + +\version "2.15.13" + +\header { + texidoc = "Outside staff callbacks that no longer apply to grobs +because they are outside the X boundary of a slur should terminate +early. The example below should generate no warnings about Bezier +curves and there should be no change in StrokeFinger position between +the first and second examples. +" +} + +\relative c'' { + \set strokeFingerOrientations = #'(up) + \override StrokeFinger #'avoid-slur = #'outside + \autoBeamOff + 16 b + 16( b) +} diff --git a/lily/slur.cc b/lily/slur.cc index 964a4d091b..7276df0e01 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -270,6 +270,16 @@ Slur::outside_slur_callback (SCM grob, SCM offset_scm) Interval yext = robust_relative_extent (script, cy, Y_AXIS); Interval xext = robust_relative_extent (script, cx, X_AXIS); + Interval slur_wid (curve.control_[0][X_AXIS], curve.control_[3][X_AXIS]); + + bool contains = false; + Direction d = LEFT; + do + contains |= slur_wid.contains (xext[d]); + while (flip (&d) != LEFT); + + if (!contains) + return offset_scm; Real offset = robust_scm2double (offset_scm, 0); yext.translate (offset);