]> git.donarmstrong.com Git - lilypond.git/commitdiff
Terminates Slur::outside_staff_callback early if grob is out of slur's range.
authorMike Solomon <mike@apollinemike.com>
Thu, 22 Sep 2011 08:12:40 +0000 (10:12 +0200)
committerMike Solomon <mike@apollinemike.com>
Thu, 22 Sep 2011 08:12:40 +0000 (10:12 +0200)
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.

input/regression/slur-vestigial-outside-staff-callback.ly [new file with mode: 0644]
lily/slur.cc

diff --git a/input/regression/slur-vestigial-outside-staff-callback.ly b/input/regression/slur-vestigial-outside-staff-callback.ly
new file mode 100644 (file)
index 0000000..841ad8e
--- /dev/null
@@ -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
+  <a-\rightHandFinger #2 >16 b
+  <a-\rightHandFinger #2 >16( b)
+}
index 964a4d091b210e0ab78f4bb8c980291679a317e1..7276df0e0107287968113fdf4f20a33193cfcda9 100644 (file)
@@ -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);