]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/optimal-page-breaking.cc
update outdated comments
[lilypond.git] / lily / optimal-page-breaking.cc
index a0ba883396d5874e0f7cd397660c2ac166b3b9eb..728e726a5e3e476e540018d7a9041a0b1bbb964b 100644 (file)
@@ -44,9 +44,9 @@ Optimal_page_breaking::solve ()
   message (_ ("Finding the ideal number of pages..."));
   set_to_ideal_line_configuration (0, end);
   
-  Line_division ideal_line_division = current_configuration (0);
   Page_spacing_result best = space_systems_on_best_pages (0, first_page_num);
   vsize page_count = best.systems_per_page_.size ();
+  Line_division ideal_line_division = current_configuration (0);
   Line_division best_division = ideal_line_division;
 
   vsize ideal_sys_count = best.system_count ();
@@ -92,15 +92,11 @@ Optimal_page_breaking::solve ()
          best_division = bound;
        }
 
-      if (best_for_this_sys_count.systems_per_page_.size () < page_count)
-       {
-         /* if the pages are stretched on average, stop trying to reduce sys_count */
-         Real avg_f = 0;
-         for (vsize i = 0; i < best_for_this_sys_count.systems_per_page_.size (); i++)
-           avg_f += best_for_this_sys_count.systems_per_page_[i];
-         if (avg_f > 0)
-           break;
-       }
+      /* if the pages are stretched on average, stop trying to reduce sys_count */
+      if (best_for_this_sys_count.page_count () < page_count
+         && best_for_this_sys_count.average_force () > 0)
+       break;
+       
 
       if (isinf (best_for_this_sys_count.demerits_))
        break;