[vlc-commits] [Git][videolan/vlc][master] qml: ensure an opaque base for the frosted glass effect in MusicArtistsAlbums

Steve Lhomme (@robUx4) gitlab at videolan.org
Mon Jan 13 06:07:53 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
e768ca3f by Fatih Uzunoglu at 2025-01-13T05:53:21+00:00
qml: ensure an opaque base for the frosted glass effect in MusicArtistsAlbums

Part of the `AcrylicBackground` (the very end) goes under the mini player
which uses `FrostedGlassEffect`. However, for that effect to work properly,
the source item needs to be opaque.

This is already satisfied in normal cases as there is an opaque rectangle
deep down in the scene graph (`stackViewParent`). However, when there is
inter-window backdrop blur, the list view in `MusicArtistsAlbums` uses
a pass through filter (`ViewBlockingRectangle`, where `AcrylicBackground`
derives from) so that nothing from the scene graph is rendered beneath it.

This works fine because the PIP player should be able to pass through the
video visual/window. And the areas where there should be inter-window
backdrop blur effect should either have nothing beneath, or use the PIP
player approach to pass through the bare window (where the system
compositor provides the blur backdrop effect) or simulated acrylic visual
which is also not part of the Qt scene graph.

This becomes a problem when such areas are desired to be blurred intra-window
with the `FrostedGlassEffect`. For the scene graph the source is translucent,
as obviously it can not really capture what passes through so it can not apply
blur.

- - - - -


1 changed file:

- modules/gui/qt/medialibrary/qml/MusicArtistsAlbums.qml


Changes:

=====================================
modules/gui/qt/medialibrary/qml/MusicArtistsAlbums.qml
=====================================
@@ -154,9 +154,57 @@ FocusScope {
                 z: -1
 
                 anchors.fill: parent
-                anchors.bottomMargin: -artistList.displayMarginEnd
+
+                anchors.bottomMargin: usingAcrylic ? 0 : -artistList.displayMarginEnd
 
                 tintColor: artistList.colorContext.bg.secondary
+
+                Rectangle {
+                    // For the frosted glass effect to work properly, the content
+                    // (source) should be opaque. If there is inter-window backdrop
+                    // blur, this is not the case.
+
+                    // Note that beneath there is already (`stackViewParent`) a
+                    // background rectangle, but since `ViewBlockingRectangle` does
+                    // not use blending to block anything beneath in the scene graph
+                    // being rendered, the layered source essentially has transparent
+                    // area. Qt 5 (barely) allowed having layered items to have RGB
+                    // texture, but Qt 6 RHI mandates RGBA format
+                    // (`ShaderEffectSource.RGBA`).
+
+                    // For that reason, we need to restrict the extents of inter-window
+                    // backdrop blur (`AcrylicBackground`) to the beginning boundaries
+                    // of the area that is going to be blurred by `FrostedGlassEffect`.
+
+                    // This rectangle would not be necessary if there was a guarantee
+                    // that `stackViewParent`'s color is the same as
+                    // `artistListBackground.alternativeColor` as the `AcrylicBackground`
+                    // area is restricted, but since there is no such mandate this
+                    // rectangle can act as the opaque background provider with the
+                    // desired color.
+
+                    // Ideally the `FrostedGlassEffect` itself should have a base
+                    // rectangle that it places beneath the source, similar to
+                    // how it has a `filter` that it places on top of the source,
+                    // but this is not possible because `AcrylicBackground`/
+                    // `ViewBlockingRectangle` prevents anything beneath in the
+                    // scene graph to be rendered as it acts as a "pass through"
+                    // (for video visual PIP player case, or the window itself
+                    // for the inter-window backdrop blur case).
+
+                    // Background should be opaque, though here if it is translucent,
+                    // there is also another background provider `stackViewParent`
+                    // but its color may be different:
+                    color: Qt.alpha(artistListBackground.alternativeColor, 1.0)
+
+                    anchors.left: parent.left
+                    anchors.right: parent.right
+                    anchors.top: parent.bottom
+
+                    height: artistList.displayMarginEnd
+
+                    visible: (height > 0.0) && artistListBackground.usingAcrylic
+                }
             }
 
             // To get blur effect while scrolling in mainview



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/e768ca3fa665f5585ad3b2465cab3391424c7d4b

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/e768ca3fa665f5585ad3b2465cab3391424c7d4b
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