Skip to content

Commit 0a21299

Browse files
committed
src/qml/controls/player: fix subtitle aliasing
The subtitle was being aligned to sub-pixel Y positions due to anchors being continious. This caused aliasing in the text. This fixes the issue by manually calculating the y-coordinate rather than using anchors and rounding the result.
1 parent 8c40ef2 commit 0a21299

1 file changed

Lines changed: 12 additions & 16 deletions

File tree

src/qml/controls/Player.qml

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -465,23 +465,19 @@ MpvPlayer {
465465
root.controller.setSubtitleVisibility(!subtitleText.visible);
466466
}
467467

468-
anchors {
469-
horizontalCenter: root.horizontalCenter
470-
bottom: root.bottom
471-
472-
/* Makes sure UI elements don't obscure the subtitles or that they go offscreen */
473-
bottomMargin: {
474-
let minValue = controls.visible ? controls.height : 0;
475-
let maxValue = root.height - subtitleText.height;
476-
if (Features.platform !== Features.MacOS && menu.visible)
477-
{
478-
maxValue -= menu.height;
479-
}
480-
let margin = root.height * MementoSettings.interfaceSubtitleOffset;
481-
margin = Math.max(margin, minValue);
482-
margin = Math.min(margin, maxValue);
483-
return margin;
468+
anchors.horizontalCenter: root.horizontalCenter
469+
/* Makes sure UI elements don't obscure the subtitles or that they go offscreen */
470+
y: {
471+
let minValue = controls.visible ? controls.height : 0;
472+
let maxValue = root.height - subtitleText.height;
473+
if (Features.platform !== Features.MacOS && menu.visible)
474+
{
475+
maxValue -= menu.height;
484476
}
477+
let margin = root.height * MementoSettings.interfaceSubtitleOffset;
478+
margin = Math.max(margin, minValue);
479+
margin = Math.min(margin, maxValue);
480+
return Math.round(root.height - (subtitleText.height + margin));
485481
}
486482

487483
/* Prevents text from being wider than the window */

0 commit comments

Comments
 (0)