[vlc-commits] [Git][videolan/vlc][master] 2 commits: qml: fix `displayMarginEnd` of horizontal list view in `MusicArtist`

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Nov 14 08:19:34 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
d811d10d by Fatih Uzunoglu at 2025-11-14T07:58:16+00:00
qml: fix `displayMarginEnd` of horizontal list view in `MusicArtist`

- - - - -
b2ee499d by Fatih Uzunoglu at 2025-11-14T07:58:16+00:00
qml: do not use layering when background is opaque in `FadingEdge`

This is an optimization case for opaque background color.

With custom blending, we could potentially achieve the same
even if the background is not opaque, but that requires more
investigation since in such a case, not only the view elements
would be affected but the whole primitives drawn before in the
same area, while the fading edge effect should only be applied
to the primitives of the view (and not the background).

- - - - -


2 changed files:

- modules/gui/qt/medialibrary/qml/MusicArtist.qml
- modules/gui/qt/widgets/qml/FadingEdge.qml


Changes:

=====================================
modules/gui/qt/medialibrary/qml/MusicArtist.qml
=====================================
@@ -172,7 +172,7 @@ FocusScope {
                         bottomMargin: VLCStyle.gridItemSelectedBorder
 
                         displayMarginBeginning: root._contentLeftMargin
-                        displayMarginEnd: root._contentRightMargin
+                        displayMarginEnd: root._contentRightMargin + VLCStyle.gridItemSelectedBorder
 
                         focus: true
 


=====================================
modules/gui/qt/widgets/qml/FadingEdge.qml
=====================================
@@ -23,12 +23,11 @@ import VLC.Util
 Item {
     id: root
 
-    // backgroundColor is only needed for sub-pixel
-    // font rendering. Or, if the background color
-    // needs to be known during rendering in general.
-    // Ideally it should be fully opaque, otherwise
-    // the background here may blend with the actual
-    // background.
+    // Provide background color for sub-pixel font
+    // rendering, even if it is not fully opaque.
+    // If possible, provide a fully opaque color
+    // so that layering is not used for the view,
+    // which results lower memory consumption:
     property alias backgroundColor: backgroundRect.color
 
     property alias sourceItem: shaderEffectSource.sourceItem
@@ -62,6 +61,94 @@ Item {
         visible: shaderEffectSource.visible && (color.a > 0.0)
     }
 
+    // Fading edge effect provider when background is opaque:
+    // This is an optimization, because layering is not used.
+    component FadingEdgeRectangleForOpaqueBackground : Rectangle {
+        id: fadingEdgeRectangle
+
+        implicitHeight: root.fadeSize
+        implicitWidth: root.fadeSize
+
+        visible: (opacity > 0.0) && (root.backgroundColor.a > (1.0 - Number.EPSILON))
+
+        opacity: enabled ? 1.0 : 0.0
+
+        // Animating opacity is expected to be less expensive than animating gradient stop.
+        Behavior on opacity {
+            id: opacityBehavior
+
+            enabled: false
+
+            NumberAnimation {
+                duration: VLCStyle.duration_short
+                easing.type: Easing.InOutSine
+            }
+        }
+
+        // This is used to prevent animating at initialization.
+        Timer {
+            interval: 50
+            running: true
+            onTriggered: {
+                opacityBehavior.enabled = true
+            }
+        }
+
+        required property color colorStop0
+        required property color colorStop1
+
+        // FIXME: Qt 6.2 switching orientation within `Gradient` is problematic
+        gradient: (root.orientation === Qt.Horizontal) ? horizontalGradient
+                                                       : verticalGradient
+
+        Gradient {
+            id: horizontalGradient
+
+            orientation: Gradient.Horizontal
+
+            GradientStop { position: 0.0; color: fadingEdgeRectangle.colorStop0; }
+            GradientStop { position: 1.0; color: fadingEdgeRectangle.colorStop1; }
+        }
+
+        Gradient {
+            id: verticalGradient
+
+            orientation: Gradient.Vertical
+
+            GradientStop { position: 0.0; color: fadingEdgeRectangle.colorStop0; }
+            GradientStop { position: 1.0; color: fadingEdgeRectangle.colorStop1; }
+        }
+    }
+
+    FadingEdgeRectangleForOpaqueBackground {
+        anchors {
+            top: shaderEffectSource.top
+            left: shaderEffectSource.left
+
+            bottom: (root.orientation === Qt.Horizontal) ? shaderEffectSource.bottom : undefined
+            right: (root.orientation === Qt.Vertical) ? shaderEffectSource.right : undefined
+        }
+
+        enabled: root.enableBeginningFade
+        colorStop0: root.backgroundColor
+        colorStop1: "transparent"
+    }
+
+    FadingEdgeRectangleForOpaqueBackground {
+        anchors {
+            bottom: shaderEffectSource.bottom
+            right: shaderEffectSource.right
+
+            top: (root.orientation === Qt.Horizontal) ? shaderEffectSource.top : undefined
+            left: (root.orientation === Qt.Vertical) ? shaderEffectSource.left : undefined
+        }
+
+        enabled: root.enableEndFade
+        colorStop0: "transparent"
+        colorStop1: root.backgroundColor
+    }
+
+    // Fading edge effect provider when background is not opaque:
     ShaderEffectSource {
         id: shaderEffectSource
 
@@ -86,6 +173,7 @@ Item {
         smooth: false
 
         visible: effectCompatible &&
+                 (root.backgroundColor.a < 1.0) &&
                  ((root.enableBeginningFade || root.enableEndFade) ||
                  ((shaderEffect) && (shaderEffect.beginningFadeSize > 0 || shaderEffect.endFadeSize > 0)))
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8f5fc2c2f148bac08cb8fe488038323537e63680...b2ee499d910572d88d6bc101a90474e84cc9637e

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8f5fc2c2f148bac08cb8fe488038323537e63680...b2ee499d910572d88d6bc101a90474e84cc9637e
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list