[vlc-commits] [Git][videolan/vlc][master] Revert "qml: use QSGTextureView (TextureProviderItem) in PartialEffect instead of layering"
Steve Lhomme (@robUx4)
gitlab at videolan.org
Sun Mar 30 08:13:10 UTC 2025
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
9fe08fbf by Fatih Uzunoglu at 2025-03-30T07:56:55+00:00
Revert "qml: use QSGTextureView (TextureProviderItem) in PartialEffect instead of layering"
This reverts commit 60e95ad5c2ab53dec17112fc9caab6bf52a90db8.
Unfortunately there is not much to do here until `MultiEffect` starts supporting sub-
textures (textures that are independent/not in atlas, but report position different
than (0.0, 0.0) or size different than (1.0, 1.0)).
Although this is only relevant for `MultiEffect` (because other type of effects can
set `supportsAtlasTextures` or use `qt_SubRect_x`), I still reverted it to not impair
maintenance. I also do not want to bring back manually setting `supportsAtlasTextures`
to `true`.
We should still keep the texture view and provider, because they are useful when sub-
texturing is not used (such as player view), and when the consumer supports sub-textures.
- - - - -
3 changed files:
- modules/gui/qt/maininterface/qml/MainDisplay.qml
- modules/gui/qt/widgets/qml/FrostedGlassEffect.qml
- modules/gui/qt/widgets/qml/PartialEffect.qml
Changes:
=====================================
modules/gui/qt/maininterface/qml/MainDisplay.qml
=====================================
@@ -242,18 +242,16 @@ FocusScope {
width,
height - stackView.height)
- effect: frostedGlassEffect
-
- Widgets.FrostedGlassEffect {
- id: frostedGlassEffect
+ effectLayer.effect: Component {
+ Widgets.FrostedGlassEffect {
+ ColorContext {
+ id: frostedTheme
+ palette: VLCStyle.palette
+ colorSet: ColorContext.Window
+ }
- ColorContext {
- id: frostedTheme
- palette: VLCStyle.palette
- colorSet: ColorContext.Window
+ tint: frostedTheme.bg.secondary
}
-
- tint: frostedTheme.bg.secondary
}
}
=====================================
modules/gui/qt/widgets/qml/FrostedGlassEffect.qml
=====================================
@@ -41,15 +41,7 @@ Widgets.BlurEffect {
// Underlay for the blur effect:
parent: root.source?.sourceItem ?? root.source
-
- // Since we don't use layering for the effect area anymore,
- // we need to restrict the filter to correspond to the effect
- // area instead of the whole source:
- x: root.x
- y: root.y
- width: root.width
- height: root.height
-
+ anchors.fill: parent
z: 999
visible: root.tintStrength > 0.0
=====================================
modules/gui/qt/widgets/qml/PartialEffect.qml
=====================================
@@ -17,10 +17,6 @@
*****************************************************************************/
import QtQuick
-import QtQuick.Window
-
-import VLC.MainInterface
-import VLC.Widgets as Widgets
// This item can be used as a layer effect.
// The purpose of this item is to apply an effect to a partial
@@ -36,13 +32,14 @@ Item {
// a texture provider without creating an extra layer.
// Make sure that the sampler name is set to "source" (default) if
// this is used as a layer effect.
- property alias source: textureProviderItem.source
+ property Item source
- // Rectangular area where the effect should be applied:
- property alias effectRect: textureProviderItem.effectRect
+ // Default layer properties are used except that `enabled` is set by default.
+ // The geometry of the effect will be adjusted to `effectRect` automatically.
+ property alias effectLayer: effectProxy.layer
- property Item effect
- property string samplerName: "source"
+ // Rectangular area where the effect should be applied:
+ property alias effectRect: effectProxy.effectRect
// Enable blending if background of source is not opaque.
// This comes with a performance penalty.
@@ -61,10 +58,10 @@ Item {
readonly property rect discardRect: {
if (blending)
- return Qt.rect(textureProviderItem.x / root.width,
- textureProviderItem.y / root.height,
- (textureProviderItem.x + textureProviderItem.width) / root.width,
- (textureProviderItem.y + textureProviderItem.height) / root.height)
+ return Qt.rect(effectProxy.x / root.width,
+ effectProxy.y / root.height,
+ (effectProxy.x + effectProxy.width) / root.width,
+ (effectProxy.y + effectProxy.height) / root.height)
else // If blending is not enabled, no need to make the normalization calculations
return Qt.rect(0, 0, 0, 0)
}
@@ -79,77 +76,37 @@ Item {
fragmentShader: blending ? "qrc:///shaders/RectFilter.frag.qsb" : ""
}
- // We use texture provider that uses QSGTextureView.
- // QSGTextureView is able to denote a viewport that
- // covers a certain area in the source texture.
- // This way, we don't need to have another layer just
- // to clip the source texture.
- Widgets.TextureProviderItem {
- id: textureProviderItem
+ // This item represents the region where the effect is applied.
+ // `effectLayer` only has access to the area denoted with
+ // the property `effectRect`
+ ShaderEffect {
+ id: effectProxy
x: effectRect.x
y: effectRect.y
width: effectRect.width
height: effectRect.height
- readonly property Item sourceItem: source?.sourceItem ?? source
+ blending: root.blending
- property rect effectRect
-
- property real eDPR: MainCtx.effectiveDevicePixelRatio(Window.window)
-
- Binding on textureSubRect {
- delayed: true
- value: Qt.rect(effectRect.x * textureProviderItem.eDPR,
- effectRect.y * textureProviderItem.eDPR,
- effectRect.width * textureProviderItem.eDPR,
- effectRect.height * textureProviderItem.eDPR)
- }
+ // This item is used to show effect
+ // so it is pointless to show if
+ // there is no effect to show.
+ visible: layer.enabled
- onDprChanged: {
- eDPR = MainCtx.effectiveDevicePixelRatio(Window.window)
- }
+ // cullMode: ShaderEffect.BackFaceCulling
- onChildrenChanged: {
- // Do not add visual(QQuickItem) children to this item,
- // because Qt thinks that it needs to use implicit layering.
- // "If needed, MultiEffect will internally generate a
- // ShaderEffectSource as the texture source."
- // Adding children to a texture provider item is not going
- // make them rendered in the texture. Instead, simply add
- // to the source. If source is layered, the source would
- // be a `ShaderEffectSource`, in that case `sourceItem`
- // can be used to reach to the real source.
- console.assert(textureProviderItem.children.length === 0)
- }
+ property rect effectRect
- // Effect's source is sub-texture through the texture provider:
- Binding {
- target: root.effect
- property: root.samplerName
- value: textureProviderItem
- }
+ property alias source: root.source
- // Adjust the blending. Currently MultiEffect/FastBlur does not
- // support adjusting it:
- Binding {
- target: root.effect
- when: root.effect && (typeof root.effect.blending === "boolean")
- property: "blending"
- value: root.blending
- }
+ readonly property rect normalRect: Qt.rect(effectRect.x / root.width,
+ effectRect.y / root.height,
+ effectRect.width / root.width,
+ effectRect.height / root.height)
- // Positioning:
- Binding {
- target: root.effect
- property: "parent"
- value: root
- }
+ vertexShader: "qrc:///shaders/SubTexture.vert.qsb"
- Binding {
- target: root.effect
- property: "anchors.fill"
- value: textureProviderItem
- }
+ layer.enabled: layer.effect
}
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/9fe08fbfa3af0fea704cf04ad6e4feb404166a8d
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/9fe08fbfa3af0fea704cf04ad6e4feb404166a8d
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