[vlc-commits] [Git][videolan/vlc][master] 4 commits: qml: do not use layering for source in PlayerBlurredBackground

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sat Dec 21 18:30:27 UTC 2024



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
73c803dc by Fatih Uzunoglu at 2024-12-21T18:04:21+00:00
qml: do not use layering for source in PlayerBlurredBackground

Since Image is a texture provider, blur effect can
take an Image as source directly, without relying on
layering.

In this particular case though, the reason for layering
was to decrease the coverage for the blur effect. The
source texture can be as big as screen size / 2.7182,
and blurring is not particularly cheap. With layering,
the texture is scaled down to (512, 512) before fed
into the blur effect.

However, we should probably not do that, because the
quality also decreases which is noticeable when the
interface is full screen and screen is high resolution.
At the same time, if we don't scale the texture, we
can use the source directly. In average case, going
this way would increase quality; in the worst case,
it would have the same quality as with scaled version
because scaled version takes the same input texture.
In that case, the main difference is instead of
ShaderEffectSource doing linear filtering, blur effect
would do that which yields practically the same result.

Currently, even if we are not blurring the source
texture directly (before scaling down), we still need
to render the source texture into offscreen surface
in order to scale it down. This is not free, and also
requires allocating resources for offscreen rendering.

- - - - -
490c53f4 by Fatih Uzunoglu at 2024-12-21T18:04:21+00:00
qml: set radius 64 instead of 50 in PlayerBlurredBackground

- - - - -
3e241025 by Fatih Uzunoglu at 2024-12-21T18:04:21+00:00
qml: do not use explicit ShaderEffectSource in PlayerBlurredBackground

ShaderEffectSource provides possibility for mapping but it is not used
here, so we can simply use `layer.enabled` instead of explicit
ShaderEffectSource which makes the file simpler.

- - - - -
7c029135 by Fatih Uzunoglu at 2024-12-21T18:04:21+00:00
qml: get rid of `PlayerBlurredBackground.qml`

This file is meant to be re-used only in `Player.qml`. Since it is
quite small now, we can include its content directly where its used.

- - - - -


4 changed files:

- modules/gui/qt/Makefile.am
- modules/gui/qt/meson.build
- modules/gui/qt/player/qml/Player.qml
- − modules/gui/qt/player/qml/PlayerBlurredBackground.qml


Changes:

=====================================
modules/gui/qt/Makefile.am
=====================================
@@ -1087,7 +1087,6 @@ libqml_module_player_a_QML = \
 	player/qml/MiniPlayer.qml \
 	player/qml/PIPPlayer.qml \
 	player/qml/Player.qml \
-	player/qml/PlayerBlurredBackground.qml \
 	player/qml/PlayerControlLayout.qml \
 	player/qml/PlayerPlaylistVisibilityFSM.qml \
 	player/qml/PlayerToolbarVisibilityFSM.qml \


=====================================
modules/gui/qt/meson.build
=====================================
@@ -681,7 +681,6 @@ qml_modules += {
        'player/qml/MiniPlayer.qml',
        'player/qml/PIPPlayer.qml',
        'player/qml/Player.qml',
-       'player/qml/PlayerBlurredBackground.qml',
        'player/qml/PlayerControlLayout.qml',
        'player/qml/PlayerPlaylistVisibilityFSM.qml',
        'player/qml/PlayerToolbarVisibilityFSM.qml',


=====================================
modules/gui/qt/player/qml/Player.qml
=====================================
@@ -276,8 +276,10 @@ FocusScope {
                         colorSet: ColorContext.View
                     }
 
-                    PlayerBlurredBackground {
-                        id: backgroundImage
+                    Widgets.BlurEffect {
+                        id: blurredBackground
+
+                        radius: 64
 
                         //destination aspect ratio
                         readonly property real dar: parent.width / parent.height
@@ -288,8 +290,17 @@ FocusScope {
 
                         source: cover
 
-                        screenColor: bgtheme.bg.primary.alpha(.55)
-                        overlayColor: Qt.tint(bgtheme.fg.primary, bgtheme.bg.primary).alpha(0.4)
+                        layer.enabled: true
+                        layer.samplerName: "backgroundSource"
+                        layer.effect: ShaderEffect {
+                            readonly property color screenColor: bgtheme.bg.primary.alpha(.55)
+                            readonly property color overlayColor: Qt.tint(bgtheme.fg.primary, bgtheme.bg.primary).alpha(0.4)
+
+                            blending: false
+                            cullMode: ShaderEffect.BackFaceCulling
+
+                            fragmentShader: "qrc:///shaders/PlayerBlurredBackground.frag.qsb"
+                        }
                     }
                 }
 
@@ -370,11 +381,6 @@ FocusScope {
 
                                 Accessible.role: Accessible.Graphic
                                 Accessible.name: qsTr("Cover")
-
-                                onStatusChanged: {
-                                    if (status === Image.Ready)
-                                        backgroundImage.scheduleUpdate()
-                                }
                             }
                         }
 


=====================================
modules/gui/qt/player/qml/PlayerBlurredBackground.qml deleted
=====================================
@@ -1,89 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2022 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * ( at your option ) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-
-import QtQuick
-
-import VLC.Util
-import VLC.Widgets as Widgets
-
-Item {
-    id: rootItem
-
-    property alias source: blurSource.sourceItem
-    property alias screenColor: shaderItem.screenColor
-    property alias overlayColor: shaderItem.overlayColor
-
-    function scheduleUpdate() {
-        blurSource.scheduleUpdate()
-    }
-
-    onSourceChanged: blurSource.scheduleUpdate()
-
-    ShaderEffectSource {
-        id: blurSource
-
-        width: 512
-        height: 512
-        textureSize: Qt.size(512,512)
-
-        visible: false
-
-        live: false
-        hideSource: false
-        smooth: false
-        mipmap: false
-    }
-
-    Widgets.BlurEffect {
-        id: blur
-
-        source: blurSource
-
-        width: 512
-        height: 512
-
-        radius: 50
-        visible: false
-    }
-
-    ShaderEffectSource {
-        id: proxySource
-        live: true
-        hideSource: false
-        sourceItem: blur
-        smooth: false
-        visible: false
-        mipmap: false
-    }
-
-    ShaderEffect {
-        id: shaderItem
-
-        property var backgroundSource: proxySource
-        property color screenColor
-        property color overlayColor
-
-        anchors.fill: parent
-        visible: true
-        blending: false
-        cullMode: ShaderEffect.BackFaceCulling
-
-        fragmentShader: "qrc:///shaders/PlayerBlurredBackground.frag.qsb"
-    }
-}



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b0ef42fa2f7b35486376ad3098cb7f6d82d7cd79...7c029135017a6456dedec05530af2f005a09b469

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