lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Terminates outside_staff_callback early if a grob is outside a slur's X-


From: mtsolo
Subject: Terminates outside_staff_callback early if a grob is outside a slur's X-extent (issue 5056041)
Date: Sat, 17 Sep 2011 08:54:52 +0000

Reviewers: ,

Message:
Hey all,

This patch fixes the programming error coming from the StrokeFinger
discussion.  Currently, none of my outstanding slur work would fix this
problem.

The issue is that the offset callback is tacked onto outside-staff
objects before we know if the object falls within the span of the slur.
Thus, even though these objects are weeded out of slur scoring in
score_extra_ecompasses, the callback function doesn't know they've been
weeded out and a separate weeding out needs to happen.  This patch does
that.

I'm not sure where/when/why this behavior would have changed, but I
think this is the appropriate fix.

Cheers,
MS

Description:
Terminates outside_staff_callback early if a grob is outside a slur's
X-extent

Please review this at http://codereview.appspot.com/5056041/

Affected files:
  M lily/slur.cc


Index: lily/slur.cc
diff --git a/lily/slur.cc b/lily/slur.cc
index 964a4d091b210e0ab78f4bb8c980291679a317e1..582803832165f8fb3f2a783cadcb3f50699b5c15 100644
--- a/lily/slur.cc
+++ b/lily/slur.cc
@@ -264,12 +264,22 @@ Slur::outside_slur_callback (SCM grob, SCM offset_scm)
   Grob *cy = script->common_refpoint (slur, Y_AXIS);

   Bezier curve = Slur::get_curve (slur);
-
+
   curve.translate (Offset (slur->relative_coordinate (cx, X_AXIS),
                            slur->relative_coordinate (cy, Y_AXIS)));

   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 = 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);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]