@@ -992,18 +992,18 @@ void SlurTieLayout::fixArticulations(Slur* item, PointF& pt, Chord* c, double up
992
992
993
993
TieSegment* SlurTieLayout::layoutTieWithNoEndNote (Tie* item)
994
994
{
995
- StaffType* st = item->staff ()->staffType (item->startNote () ? item-> startNote ()-> tick () : Fraction ( 0 , 1 ));
995
+ StaffType* st = item->staff ()->staffType (item->startNote ()-> tick ());
996
996
Chord* c1 = item->startNote ()->chord ();
997
997
item->setTick (c1->tick ());
998
998
999
999
if (item->slurDirection () == DirectionV::AUTO) {
1000
1000
bool simpleException = st && st->isSimpleTabStaff ();
1001
- if (st && st-> isSimpleTabStaff () ) {
1001
+ if (simpleException ) {
1002
1002
item->setUp (isUpVoice (c1->voice ()));
1003
1003
} else {
1004
1004
if (c1->measure ()->hasVoices (c1->staffIdx (), c1->tick (), c1->actualTicks ())) {
1005
1005
// in polyphonic passage, ties go on the stem side
1006
- item->setUp (simpleException ? isUpVoice (c1-> voice ()) : c1->up ());
1006
+ item->setUp (c1->up ());
1007
1007
} else {
1008
1008
item->setUp (!c1->up ());
1009
1009
}
@@ -1165,7 +1165,7 @@ void SlurTieLayout::computeStartAndEndSystem(Tie* item, SlurTiePos& slurTiePos)
1165
1165
slurTiePos.system2 = endSystem;
1166
1166
}
1167
1167
1168
- PointF SlurTieLayout::computeDefaultStartOrEndPoint (Tie* tie, Grip startOrEnd)
1168
+ PointF SlurTieLayout::computeDefaultStartOrEndPoint (const Tie* tie, Grip startOrEnd)
1169
1169
{
1170
1170
if (startOrEnd != Grip::START && startOrEnd != Grip::END) {
1171
1171
return PointF ();
@@ -1182,13 +1182,13 @@ PointF SlurTieLayout::computeDefaultStartOrEndPoint(Tie* tie, Grip startOrEnd)
1182
1182
1183
1183
PointF result = note->pos () + chord->pos () + chord->segment ()->pos () + chord->measure ()->pos ();
1184
1184
1185
- bool up = tie->up ();
1186
- bool inside = tie->isInside ();
1187
- int upSign = up ? -1 : 1 ;
1188
- int leftRightSign = start ? +1 : -1 ;
1189
- double noteWidth = note->width ();
1190
- double noteHeight = note->height ();
1191
- double spatium = tie->spatium ();
1185
+ const bool up = tie->up ();
1186
+ const bool inside = tie->isInside ();
1187
+ const int upSign = up ? -1 : 1 ;
1188
+ const int leftRightSign = start ? +1 : -1 ;
1189
+ const double noteWidth = note->width ();
1190
+ const double noteHeight = note->height ();
1191
+ const double spatium = tie->spatium ();
1192
1192
1193
1193
double baseX, baseY = 0.0 ;
1194
1194
if (inside) {
@@ -1208,7 +1208,7 @@ PointF SlurTieLayout::computeDefaultStartOrEndPoint(Tie* tie, Grip startOrEnd)
1208
1208
return result;
1209
1209
}
1210
1210
1211
- double SlurTieLayout::noteOpticalCenterForTie (Note* note, bool up)
1211
+ double SlurTieLayout::noteOpticalCenterForTie (const Note* note, bool up)
1212
1212
{
1213
1213
SymId symId = note->layoutData ()->cachedNoteheadSym ;
1214
1214
PointF cutOutLeft = note->symSmuflAnchor (symId, up ? SmuflAnchorId::cutOutNW : SmuflAnchorId::cutOutSW);
@@ -1312,10 +1312,10 @@ void SlurTieLayout::adjustX(TieSegment* tieSegment, SlurTiePos& sPos, Grip start
1312
1312
return !s.toItem || (s.toItem == note || s.toItem ->isHook () || s.toItem ->isLedgerLine ());
1313
1313
});
1314
1314
1315
- double arcSideMargin = 0.3 * spatium;
1316
- double pointsSideMargin = 0.15 * spatium;
1317
- double yBelow = tiePoint.y () - (tie->up () ? arcSideMargin : pointsSideMargin);
1318
- double yAbove = tiePoint.y () + (tie->up () ? pointsSideMargin : arcSideMargin);
1315
+ const double arcSideMargin = 0.3 * spatium;
1316
+ const double pointsSideMargin = 0.15 * spatium;
1317
+ const double yBelow = tiePoint.y () - (tie->up () ? arcSideMargin : pointsSideMargin);
1318
+ const double yAbove = tiePoint.y () + (tie->up () ? pointsSideMargin : arcSideMargin);
1319
1319
double pointToClear = start ? chordShape.rightMostEdgeAtHeight (yBelow, yAbove)
1320
1320
: chordShape.leftMostEdgeAtHeight (yBelow, yAbove);
1321
1321
@@ -1373,19 +1373,19 @@ void SlurTieLayout::adjustY(TieSegment* tieSegment)
1373
1373
bool up = tieSegment->tie ()->up ();
1374
1374
int upSign = up ? -1 : 1 ;
1375
1375
1376
- double spatium = tieSegment->spatium ();
1377
- double staffLineDist = staff->lineDistance (tick) * spatium;
1378
- double staffLineThickness = tieSegment->style ().styleMM (Sid::staffLineWidth);
1376
+ const double spatium = tieSegment->spatium ();
1377
+ const double staffLineDist = staff->lineDistance (tick) * spatium;
1378
+ const double staffLineThickness = tieSegment->style ().styleMM (Sid::staffLineWidth);
1379
1379
1380
1380
// 1. Check for bad end point protrusion
1381
1381
1382
- double endPointY = tieSegment->ups (Grip::START).p .y ();
1383
- int closestLineToEndpoints = up ? floor (endPointY / staffLineDist) : ceil (endPointY / staffLineDist);
1384
- bool isEndInsideStaff = closestLineToEndpoints >= 0 && closestLineToEndpoints < staff->lines (tick);
1385
- bool isEndInsideLedgerLines = !isEndInsideStaff && !tieSegment->tie ()->isOuterTieOfChord (Grip::START);
1382
+ const double endPointY = tieSegment->ups (Grip::START).p .y ();
1383
+ const int closestLineToEndpoints = up ? floor (endPointY / staffLineDist) : ceil (endPointY / staffLineDist);
1384
+ const bool isEndInsideStaff = closestLineToEndpoints >= 0 && closestLineToEndpoints < staff->lines (tick);
1385
+ const bool isEndInsideLedgerLines = !isEndInsideStaff && !tieSegment->tie ()->isOuterTieOfChord (Grip::START);
1386
1386
1387
- double halfLineThicknessCorrection = 0.5 * staffLineThickness * upSign;
1388
- double protrusion = abs (endPointY - (closestLineToEndpoints * spatium - halfLineThicknessCorrection));
1387
+ const double halfLineThicknessCorrection = 0.5 * staffLineThickness * upSign;
1388
+ const double protrusion = abs (endPointY - (closestLineToEndpoints * spatium - halfLineThicknessCorrection));
1389
1389
const double badIntersectionLimit = 0.20 * spatium; // TODO: style
1390
1390
1391
1391
bool badIntersection = protrusion < badIntersectionLimit && (isEndInsideStaff || isEndInsideLedgerLines);
0 commit comments