]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/beaming-info.cc
* lily/beam.cc (set_beaming): don't clip edges.
[lilypond.git] / lily / beaming-info.cc
index 50b94a6fb9d24b3e3aa7f56e6f43767a03cccc35..63f845489b09b96866dc961f66a22edc19050c47 100644 (file)
@@ -27,7 +27,7 @@ const int at_beat = 1 << 15;
 int
 Beaming_info_list::best_splitpoint_index (Moment &beat_length, bool subdivide) const
 {
-  int minden = INT_MAX;        
+  int minden = INT_MAX;
   int minidx = -1;
   Moment beat_pos;
 
@@ -56,7 +56,7 @@ Beaming_info_list::beam_extend_count (Direction d) const
   Beaming_info thisbeam = infos_.boundary (d, 0);
   Beaming_info next = infos_.boundary (d, 1);
 
-  return thisbeam.beams_i_drul_[-d] <? next.beams_i_drul_[d];
+  return min (thisbeam.beams_i_drul_[-d], next.beams_i_drul_[d]);
 }
 
 void
@@ -74,14 +74,13 @@ Beaming_info_list::beamify (Moment &beat_length, bool subdivide)
   Direction d = LEFT;
 
   do
-    {
-      splits[d].beamify (beat_length, subdivide);
-    }
-  while (flip (&d) != LEFT);
+    splits[d].beamify (beat_length, subdivide);
+  while (flip (&d) != LEFT)
+    ;
 
   int middle_beams = (split ? 1
-                     : splits[RIGHT].beam_extend_count (LEFT) <?
-                     splits[LEFT].beam_extend_count (RIGHT));
+                     : min (splits[RIGHT].beam_extend_count (LEFT),
+                            splits[LEFT].beam_extend_count (RIGHT)));
 
   do
     {
@@ -92,6 +91,8 @@ Beaming_info_list::beamify (Moment &beat_length, bool subdivide)
 
   infos_ = splits[LEFT].infos_;
   infos_.concat (splits[RIGHT].infos_);
+
+  clip_edges ();
 }
 
 void
@@ -99,3 +100,13 @@ Beaming_info_list::add_stem (Moment m, int b)
 {
   infos_.push (Beaming_info (m, b));
 }
+
+void
+Beaming_info_list::clip_edges ()
+{
+  if (infos_.size ())
+    {
+      infos_[0].beams_i_drul_[LEFT] = 0;
+      infos_.top().beams_i_drul_[RIGHT] = 0;
+    }
+}