OLD | NEW |
1 /* | 1 /* |
2 This file is part of LilyPond, the GNU music typesetter. | 2 This file is part of LilyPond, the GNU music typesetter. |
3 | 3 |
4 Copyright (C) 1996--2020 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 1996--2020 Han-Wen Nienhuys <hanwen@xs4all.nl> |
5 Jan Nieuwenhuizen <janneke@gnu.org> | 5 Jan Nieuwenhuizen <janneke@gnu.org> |
6 | 6 |
7 TODO: This is way too hairy | 7 TODO: This is way too hairy |
8 | 8 |
9 TODO: fix naming. | 9 TODO: fix naming. |
10 | 10 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 86 |
87 int | 87 int |
88 Stem::get_beaming (Grob *me, Direction d) | 88 Stem::get_beaming (Grob *me, Direction d) |
89 { | 89 { |
90 SCM pair = me->get_property ("beaming"); | 90 SCM pair = me->get_property ("beaming"); |
91 if (!scm_is_pair (pair)) | 91 if (!scm_is_pair (pair)) |
92 return 0; | 92 return 0; |
93 | 93 |
94 SCM lst = index_get_cell (pair, d); | 94 SCM lst = index_get_cell (pair, d); |
95 | 95 |
96 int len = scm_ilength (lst); // -1 for dotted lists! | 96 long len = scm_ilength (lst); // -1 for dotted lists! |
97 return std::max (len, 0); | 97 // TODO: scm_ilength () is O(n), so we don't want to call it for long lists. |
| 98 // If scm_ilength () is OK, this cast should be OK too. The question is, are |
| 99 // we confident that the list is short? |
| 100 return static_cast<int> (std::max (len, 0L)); |
98 } | 101 } |
99 | 102 |
100 Interval | 103 Interval |
101 Stem::head_positions (Grob *me) | 104 Stem::head_positions (Grob *me) |
102 { | 105 { |
103 if (head_count (me)) | 106 if (head_count (me)) |
104 { | 107 { |
105 Drul_array<Grob *> e (extremal_heads (me)); | 108 Drul_array<Grob *> e (extremal_heads (me)); |
106 return Interval (Staff_symbol_referencer::get_position (e[DOWN]), | 109 return Interval (Staff_symbol_referencer::get_position (e[DOWN]), |
107 Staff_symbol_referencer::get_position (e[UP])); | 110 Staff_symbol_referencer::get_position (e[UP])); |
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 ideal_y_ = shortest_y_ = 0; | 1211 ideal_y_ = shortest_y_ = 0; |
1209 dir_ = CENTER; | 1212 dir_ = CENTER; |
1210 } | 1213 } |
1211 | 1214 |
1212 void | 1215 void |
1213 Stem_info::scale (Real x) | 1216 Stem_info::scale (Real x) |
1214 { | 1217 { |
1215 ideal_y_ *= x; | 1218 ideal_y_ *= x; |
1216 shortest_y_ *= x; | 1219 shortest_y_ *= x; |
1217 } | 1220 } |
OLD | NEW |