Skip to content

Commit

Permalink
Merge pull request #24031 from mathesoncalum/24019-tremolobar_linewid…
Browse files Browse the repository at this point in the history
…th-440

Fix #24019: Ensure proper conversion of `TremoloBar` line widths (4.4.0 port)
  • Loading branch information
RomanPudashkin committed Aug 14, 2024
2 parents 7453015 + fda13c5 commit 02b861d
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/engraving/rendering/dev/tdraw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3126,7 +3126,8 @@ void TDraw::draw(const TremoloBar* item, Painter* painter)
{
TRACE_DRAW_ITEM;
const TremoloBar::LayoutData* ldata = item->ldata();
Pen pen(item->curColor(), item->lineWidth().val(), PenStyle::SolidLine, PenCapStyle::RoundCap, PenJoinStyle::RoundJoin);
const double lw = item->absoluteFromSpatium(item->lineWidth());
Pen pen(item->curColor(), lw, PenStyle::SolidLine, PenCapStyle::RoundCap, PenJoinStyle::RoundJoin);
painter->setPen(pen);
painter->drawPolyline(ldata->polygon);
}
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/rendering/dev/tlayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6305,7 +6305,7 @@ void TLayout::layoutTremoloBar(const TremoloBar* item, TremoloBar::LayoutData* l
}
ldata->polygon = polygon;

double w = item->lineWidth().val();
const double w = item->absoluteFromSpatium(item->lineWidth());
ldata->setBbox(ldata->polygon.boundingRect().adjusted(-w, -w, w, w));
}

Expand Down
3 changes: 2 additions & 1 deletion src/engraving/rendering/single/singledraw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2439,7 +2439,8 @@ void SingleDraw::draw(const TremoloBar* item, Painter* painter)
{
TRACE_DRAW_ITEM;
const TremoloBar::LayoutData* ldata = item->ldata();
Pen pen(item->curColor(), item->lineWidth().val(), PenStyle::SolidLine, PenCapStyle::RoundCap, PenJoinStyle::RoundJoin);
const double lw = item->absoluteFromSpatium(item->lineWidth());
Pen pen(item->curColor(), lw, PenStyle::SolidLine, PenCapStyle::RoundCap, PenJoinStyle::RoundJoin);
painter->setPen(pen);
painter->drawPolyline(ldata->polygon);
}
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/rendering/single/singlelayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1638,7 +1638,7 @@ void SingleLayout::layout(TremoloBar* item, const Context&)
}
ldata->polygon = polygon;

double w = item->lineWidth().val();
const double w = item->absoluteFromSpatium(item->lineWidth());
ldata->setBbox(ldata->polygon.boundingRect().adjusted(-w, -w, w, w));
}

Expand Down
3 changes: 2 additions & 1 deletion src/engraving/rendering/stable/tdraw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3026,7 +3026,8 @@ void TDraw::draw(const TremoloBar* item, Painter* painter)
{
TRACE_DRAW_ITEM;
const TremoloBar::LayoutData* ldata = item->ldata();
Pen pen(item->curColor(), item->lineWidth().val(), PenStyle::SolidLine, PenCapStyle::RoundCap, PenJoinStyle::RoundJoin);
const double lw = item->absoluteFromSpatium(item->lineWidth());
Pen pen(item->curColor(), lw, PenStyle::SolidLine, PenCapStyle::RoundCap, PenJoinStyle::RoundJoin);
painter->setPen(pen);
painter->drawPolyline(ldata->polygon);
}
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/rendering/stable/tlayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6073,7 +6073,7 @@ void TLayout::layoutTremoloBar(const TremoloBar* item, TremoloBar::LayoutData* l
}
ldata->polygon = polygon;

double w = item->lineWidth().val();
const double w = item->absoluteFromSpatium(item->lineWidth());
ldata->setBbox(ldata->polygon.boundingRect().adjusted(-w, -w, w, w));
}

Expand Down

0 comments on commit 02b861d

Please sign in to comment.