[vlc-commits] [Git][videolan/vlc][master] 8 commits: Revert "qml: no need to provide implicit size in `EnhancedImageExt` anymore"
Steve Lhomme (@robUx4)
gitlab at videolan.org
Thu Sep 17 15:43:06 UTC 2026
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
3dbb744d by Fatih Uzunoglu at 2026-09-17T15:06:40+00:00
Revert "qml: no need to provide implicit size in `EnhancedImageExt` anymore"
This is so that we can get rid of the observer in `ImageExt`,
since its main use case of probing texture size is no longer
needed thanks to 5d318868.
This reverts commit c27b2b2e6ce0cc5edb9fbb3fd4628200808d9e01.
- - - - -
24a36d28 by Fatih Uzunoglu at 2026-09-17T15:06:40+00:00
Revert "qml: no need to require source texture provider to provide implicit size in `ImageExt`"
This is so that we can get rid of the observer in `ImageExt`,
since its main use case of probing texture size is no longer
needed thanks to 5d318868.
This reverts commit ded6dd36893800d63205575fd5d4f902e5ca2f91.
- - - - -
00b19949 by Fatih Uzunoglu at 2026-09-17T15:06:40+00:00
Revert "qml: no need to provide `status` in `EnhancedImageExt` anymore"
This is so that we can get rid of the observer in `ImageExt`,
since its main use case of probing texture size is no longer
needed thanks to 5d318868.
This reverts commit c58d3c6ba42c5f985c0a07844f65775758fd0339.
- - - - -
3461881d by Fatih Uzunoglu at 2026-09-17T15:06:40+00:00
Revert "qml: no need to require source texture provider to provide `status` in `ImageExt`"
This is so that we can get rid of the observer in `ImageExt`,
since its main use case of probing texture size is no longer
needed thanks to 5d318868.
This reverts commit a3e2ee919a082e035284cad811ca8dc8272746c6.
- - - - -
db9e4da3 by Fatih Uzunoglu at 2026-09-17T15:06:40+00:00
Revert "qml: no need to adjust `blending` in `EnhancedImageExt` anymore"
This is so that we can get rid of the observer in `ImageExt`,
since its main use case of probing texture size is no longer
needed thanks to 5d318868.
This reverts commit 620594d8cc2abc6f99ff5937d6d05f3b8e317056.
- - - - -
99b1e9d7 by Fatih Uzunoglu at 2026-09-17T15:06:40+00:00
Revert "qml: make use of the texture provider observer when adjusting blending in `ImageExt`"
This is so that we can get rid of the observer in `ImageExt`,
since its main use case of probing texture size is no longer
needed thanks to 5d318868.
This reverts commit d872e23a85a12a42ec099053470500c5da3754a2.
- - - - -
844dfbb6 by Fatih Uzunoglu at 2026-09-17T15:06:40+00:00
qml: do not use `TextureProviderObserver` in `ImageExt`
Since we target minimum GLSL 1.30 and ESSL 3.00 now,
we are using `textureSize()` in our shaders, hence
we don't need to have texture provider observer here
anymore.
Having an observer provided additional benefits, such
as better determination for blending, and not needing
to provide texture size if the source texture (provider)
is an external one (when the internal `Image` is not
used), but these are not a justification themselves
enough to depend on `VLC.Util` and use an observer here.
With blending determination, it is only applicable if
there is no rounding done, but `ImageExt` is usually
used when there is rounding. Even when rounding is
not used, we often provide an opaque background
color.
For the external source texture provider case, where
the source texture provider is not `Image`, we already
provide `EnhancedImageExt` that supplies the required
information automatically. It is recommended to use
`EnhancedImageExt` in such cases to not reimplement
texture size probing logic in multiple places.
Amends a63640ec.
- - - - -
ba9f168c by Fatih Uzunoglu at 2026-09-17T15:06:40+00:00
qml: use opaque background color by default if radius is 0.0 in `ImageExt`
This is so that `blending` is turned off by default if there is no
rounding.
- - - - -
2 changed files:
- modules/gui/qt/widgets/qml/EnhancedImageExt.qml
- modules/gui/qt/widgets/qml/ImageExt.qml
Changes:
=====================================
modules/gui/qt/widgets/qml/EnhancedImageExt.qml
=====================================
@@ -45,6 +45,22 @@ ImageExt {
// No need to load images in this case:
loadImages: (targetTextureProvider === root.sourceTextureProviderItem)
+ blending: {
+ if (effectiveRadius > 0.0)
+ return true // Outside the radius is always transparent, need blending
+
+ if (effectiveBackgroundColor.a > (1.0 - Number.EPSILON))
+ return false // If background color is opaque, no need for blending
+
+ if (textureProviderItem === textureProviderIndirection) {
+ console.assert(observer.source === textureProviderIndirection)
+ if (!observer.hasAlphaChannel)
+ return false // If the texture is opaque, no need for blending
+ }
+
+ return true
+ }
+
/// <debug>
readonly property QtObject _sourceWindow: (targetTextureProvider?.Window.window ?? null)
function _onWindowChanged() {
@@ -61,6 +77,13 @@ ImageExt {
TextureProviderIndirection {
id: textureProviderIndirection
+ // `Image` interface, as `ImageExt` needs it:
+ readonly property int status: (source instanceof Image ? ((source.status === Image.Ready && observer.isValid) ? Image.Ready : Image.Loading)
+ : (observer.isValid ? Image.Ready : Image.Null))
+
+ implicitWidth: (source instanceof Image) ? source.implicitWidth : textureSize.width
+ implicitHeight: (source instanceof Image) ? source.implicitHeight : textureSize.height
+
readonly property bool sourceNeedsTiling: (root.fillMode === Image.Tile ||
root.fillMode === Image.TileVertically ||
root.fillMode === Image.TileHorizontally)
@@ -71,5 +94,13 @@ ImageExt {
verticalWrapMode: sourceNeedsTiling ? TextureProviderIndirection.Repeat : TextureProviderIndirection.ClampToEdge
textureSubRect: sourceNeedsTiling ? Qt.rect(0, 0, root.paintedWidth, root.paintedHeight) : undefined
+
+ readonly property size textureSize: observer.textureSize
+
+ TextureProviderObserver {
+ id: observer
+ source: textureProviderIndirection
+ notifyAllChanges: (root.visible && textureProviderIndirection.source)
+ }
}
}
=====================================
modules/gui/qt/widgets/qml/ImageExt.qml
=====================================
@@ -17,8 +17,6 @@
*****************************************************************************/
import QtQuick
-import VLC.Util
-
// NOTE: ImageExt behaves exactly like Image, except when at least one of these features are used:
// - `PreserveAspectCrop` fill mode without requiring a clip node.
// - Rounded rectangular shaping.
@@ -49,17 +47,7 @@ Item {
property url source
property alias sourceSize: image.sourceSize
property alias sourceClipRect: image.sourceClipRect
- readonly property int status: {
- if (effectiveTextureProviderItem instanceof Image) {
- return effectiveTextureProviderItem.status
- } else {
- if (tpObserver.isValid)
- return Image.Ready
- else
- return Image.Null
- }
- }
-
+ readonly property int status: shaderEffect.source.status
property alias shaderStatus: shaderEffect.status
property alias cache: image.cache
@@ -75,7 +63,10 @@ Item {
// WARNING: Consumers who downcast this item to `Image` are doing this on their own
// discretion. It is discouraged, but not forbidden (or evil).
readonly property Item sourceTextureProviderItem: image
- // NOTE: It is allowed to adjust this property to use an external texture provider.
+ // NOTE: It is allowed to adjust this property to use an external texture provider, where
+ // in that case the texture provider item should provide a subset of `Image`'s
+ // interface, that is, provide `status` and `implicitWidth`/`implicitHeight` that
+ // reflect the texture size.
// NOTE: If `textureProviderItem` is set to `null`, the default `Image` is going to be
// used as fallback. For that reason, it is recommended to keep providing the
// `source` url if there is a possibility of `textureProviderItem` being `null`
@@ -133,22 +124,13 @@ Item {
property real radiusBottomLeft: radius
readonly property real effectiveRadius: shaderEffect.visible ? Math.max(radiusTopRight, radiusTopLeft, radiusBottomRight, radiusBottomLeft) : 0.0
- property color backgroundColor: "transparent"
+ // If effective radius is 0.0 (no rounding), use "black" as the default background
+ // color so that blending is not used:
+ property color backgroundColor: (effectiveRadius > 0.0 ? "transparent" : "black")
readonly property color effectiveBackgroundColor: shaderEffect.visible ? backgroundColor : "transparent"
property alias blending: shaderEffect.blending
- blending: {
- if (effectiveRadius > 0.0)
- return true // Outside the radius is always transparent, need blending
-
- if (effectiveBackgroundColor.a > (1.0 - Number.EPSILON))
- return false // If background color is opaque, no need for blending
-
- if (!tpObserver.hasAlphaChannel)
- return false // If the texture is opaque, no need for blending
-
- return true
- }
+ blending: (effectiveRadius > 0.0) || (effectiveBackgroundColor.a < 1.0)
// Border:
// NOTE: The border is an overlay for the texture (the
@@ -173,18 +155,13 @@ Item {
anchors.alignWhenCentered: true
anchors.centerIn: parent
- implicitWidth: (source instanceof Image) ? source.implicitWidth : textureSize.width
- implicitHeight: (source instanceof Image) ? source.implicitHeight : textureSize.height
-
- // WARNING: Do not put this into the uniform block of the shader,
- // since it would break batch rendering as it reflects
- // the sub-texture size.
- readonly property size textureSize: tpObserver.textureSize
+ implicitWidth: (source.status === Image.Ready) ? source.implicitWidth : 64
+ implicitHeight: (source.status === Image.Ready) ? source.implicitHeight : 64
width: paintedSize.width
height: paintedSize.height
- visible: (root.status === Image.Ready) &&
+ visible: (source.status === Image.Ready) &&
(GraphicsInfo.shaderType === GraphicsInfo.RhiShader) &&
(root.radius > 0.0 ||
root.borderWidth > 0 ||
@@ -230,7 +207,7 @@ Item {
let ret = Qt.size(0.0, 0.0)
// No need to calculate if the texture is not ready:
- if (root.status !== Image.Ready)
+ if (source.status !== Image.Ready)
return ret
// NOTE: Calculations are based on `QQuickImage`,
@@ -263,7 +240,7 @@ Item {
}
// (2 / width) seems to be a good coefficient to make it similar to `Rectangle.border`:
- readonly property double borderRange: (root.status === Image.Ready) ? (root.borderWidth / width * 2.) : 0.0 // no need for outlining if there is no image (nothing to outline)
+ readonly property double borderRange: (source.status === Image.Ready) ? (root.borderWidth / width * 2.) : 0.0 // no need for outlining if there is no image (nothing to outline)
readonly property color borderColor: root.borderColor
// QQuickImage as texture provider, no need for ShaderEffectSource.
@@ -273,13 +250,6 @@ Item {
fragmentShader: (shouldCrop || (borderRange > 0)) ? "qrc:///shaders/SDFAARoundedTexture_cropsupport_bordersupport.frag.qsb"
: "qrc:///shaders/SDFAARoundedTexture.frag.qsb"
-
- TextureProviderObserver {
- id: tpObserver
-
- source: shaderEffect.source
- notifyAllChanges: shaderEffect.visible
- }
}
Image {
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/6f12cdc155d436e1896555c15d47c19a48711216...ba9f168c4859728895c0328fe4e1b3f52df8aae6
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/6f12cdc155d436e1896555c15d47c19a48711216...ba9f168c4859728895c0328fe4e1b3f52df8aae6
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help
More information about the vlc-commits
mailing list