Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(309)

Unified Diff: lily/tuplet-bracket.cc

Issue 4668045: Fixes error for tuplet bracket direction calculation when tuplets contain rests. (Closed)
Patch Set: Adds TupletBracket to direction-polyphonic-grobs. Created 12 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « input/regression/tuplet-bracket-direction.ly ('k') | scm/music-functions.scm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lily/tuplet-bracket.cc
diff --git a/lily/tuplet-bracket.cc b/lily/tuplet-bracket.cc
index 3bf2d1b49e8487815b79d1ec8af0b89a526803b2..a7e1c6c2ba3cd78193352f465a439d1eadda9e06 100644
--- a/lily/tuplet-bracket.cc
+++ b/lily/tuplet-bracket.cc
@@ -730,12 +730,37 @@ Tuplet_bracket::get_default_dir (Grob *me)
for (vsize i = 0; i < columns.size (); i++)
{
Grob *nc = columns[i];
+ if (Note_column::has_rests (nc))
+ continue;
Direction d = Note_column::dir (nc);
if (d)
dirs[d]++;
}
- return dirs[UP] >= dirs[DOWN] ? UP : DOWN;
+ if (dirs[UP] == dirs[DOWN])
+ {
+ if (dirs[UP] == 0)
+ return UP;
+ Grob *staff = Staff_symbol_referencer::get_staff_symbol (me);
+ if (!staff)
+ return UP;
+ Interval staff_extent = staff->extent (staff, Y_AXIS);
+ Interval extremal_positions;
+ extremal_positions.set_empty ();
+ for (vsize i = 0; i < columns.size (); i++)
+ {
+ Direction d = Note_column::dir (columns[i]);
+ extremal_positions[d] = minmax (d, 1.0*Note_column::head_positions_interval (columns[i])[d], extremal_positions[d]);
+ }
+ Direction d = LEFT;
+ do
+ extremal_positions[d] = -d * (staff_extent[d] - extremal_positions[d]);
+ while (flip (&d) != LEFT);
+
+ return extremal_positions[UP] <= extremal_positions[DOWN] ? UP : DOWN;
+ }
+
+ return dirs[UP] > dirs[DOWN] ? UP : DOWN;
}
void
« no previous file with comments | « input/regression/tuplet-bracket-direction.ly ('k') | scm/music-functions.scm » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b