[vlc-commits] [Git][videolan/vlc][master] qml: introduce `pixelAlignedForDPR` property in `FadingEdge`
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Sat Apr 25 14:23:57 UTC 2026
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
95d3f813 by Fatih Uzunoglu at 2026-04-25T15:56:57+02:00
qml: introduce `pixelAlignedForDPR` property in `FadingEdge`
Currently we are already ceiling the size, but
that is not really enough if the display scale
is fractional.
- - - - -
1 changed file:
- modules/gui/qt/widgets/qml/FadingEdge.qml
Changes:
=====================================
modules/gui/qt/widgets/qml/FadingEdge.qml
=====================================
@@ -16,6 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
import QtQuick
+import QtQuick.Window
import VLC.MainInterface
import VLC.Style
@@ -46,6 +47,17 @@ Item {
property real fadeSize: VLCStyle.margin_normal
+ // Display scale may be a fractional size, but textures can not. Pixel aligned
+ // aligns the visual size to the nearest multiple of number, depending on
+ // the window/screen fraction, so that the layer texture can be displayed
+ // without stretching. For example, if the display scale is 1.25, the
+ // visual size would be aligned up to the nearest multiple of 4. Note that
+ // using this property is going to make the visual to deviate from the
+ // size intended, which may increase greatly depending on the fraction
+ // of the display scale. Also note that if the QML item size is fractional
+ // itself, it is ceiled regardless of the display scale or this property.
+ property bool pixelAlignedForDPR: true
+
readonly property bool effectCompatible: (GraphicsInfo.shaderType === GraphicsInfo.RhiShader)
Rectangle {
@@ -159,13 +171,24 @@ Item {
topMargin: (root.orientation === Qt.Vertical ? -root.beginningMargin : 0)
}
- implicitWidth: Math.ceil(parent.width + (root.orientation === Qt.Horizontal ? (root.beginningMargin + root.endMargin) : 0))
- implicitHeight: Math.ceil(parent.height + (root.orientation === Qt.Vertical ? (root.beginningMargin + root.endMargin) : 0))
+ property real eDPR: MainCtx.effectiveDevicePixelRatio(Window.window) || 1.0
+ readonly property int alignNumber: pixelAlignedForDPR ? Helpers.denominatorForFloat(eDPR) : 1
+
+ Connections {
+ target: MainCtx
+
+ function onIntfDevicePixelRatioChanged() {
+ shaderEffectSource.eDPR = MainCtx.effectiveDevicePixelRatio(shaderEffectSource.Window.window) || 1.0
+ }
+ }
+
+ implicitWidth: Helpers.alignUp((parent.width + (root.orientation === Qt.Horizontal ? (root.beginningMargin + root.endMargin) : 0)), alignNumber)
+ implicitHeight: Helpers.alignUp((parent.height + (root.orientation === Qt.Vertical ? (root.beginningMargin + root.endMargin) : 0)), alignNumber)
sourceRect: Qt.rect(root.sourceX - (root.orientation === Qt.Horizontal ? root.beginningMargin : 0),
root.sourceY - (root.orientation === Qt.Vertical ? root.beginningMargin : 0),
- width,
- height)
+ width, // Texture width is (width * dpr)
+ height) // Texture height is (height * dpr)
// Make sure sourceItem is not rendered twice:
hideSource: visible
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/95d3f813e15f78cc190a72063e96d5fad84e4402
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/95d3f813e15f78cc190a72063e96d5fad84e4402
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list