[vlc-commits] [Git][videolan/vlc][master] 3 commits: qt: rename `TextureProviderItem` to `TextureProviderIndirection` and move to util
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Tue Mar 24 17:37:51 UTC 2026
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
4dcc0d71 by Fatih Uzunoglu at 2026-03-24T18:14:16+01:00
qt: rename `TextureProviderItem` to `TextureProviderIndirection` and move to util
"TextureProviderItem" is a too generic name for a very specific purpose it does,
which is only to act as indirection for an actual texture provider or another
texture provider indirection. We are not naming it `TextureProviderIndirectionItem`
because that would be too long.
It is also moved to util, because this class is not really a "widget". It does
not paint anything. It was initially placed in the widgets directory because
usually `QQuickItem` derivatives are placed there, but this class is more of
a utility so making it available under the utility directory makes more sense.
- - - - -
66265194 by Fatih Uzunoglu at 2026-03-24T18:14:16+01:00
qt: do not mark the destructor virtual in `TextureProviderIndirection`
According to C++ Core Guidelines, it is not recommended.
- - - - -
3a6ad382 by Fatih Uzunoglu at 2026-03-24T18:14:16+01:00
qt: make the constructor accept parent item in `TextureProviderIndirection`
- - - - -
9 changed files:
- modules/gui/qt/Makefile.am
- modules/gui/qt/maininterface/mainui.cpp
- modules/gui/qt/medialibrary/qml/ArtistTopBanner.qml
- modules/gui/qt/meson.build
- modules/gui/qt/player/qml/Player.qml
- modules/gui/qt/widgets/native/textureprovideritem.cpp → modules/gui/qt/util/textureproviderindirection.cpp
- modules/gui/qt/widgets/native/textureprovideritem.hpp → modules/gui/qt/util/textureproviderindirection.hpp
- modules/gui/qt/widgets/qml/EnhancedImageExt.qml
- modules/gui/qt/widgets/qml/PartialEffect.qml
Changes:
=====================================
modules/gui/qt/Makefile.am
=====================================
@@ -347,6 +347,8 @@ libqt_plugin_la_SOURCES = \
util/textureproviderobserver.hpp \
util/kirigamiwheelhandler.cpp \
util/kirigamiwheelhandler.hpp \
+ util/textureproviderindirection.cpp \
+ util/textureproviderindirection.hpp \
widgets/native/animators.cpp \
widgets/native/animators.hpp \
widgets/native/customwidgets.cpp widgets/native/customwidgets.hpp \
@@ -362,8 +364,7 @@ libqt_plugin_la_SOURCES = \
widgets/native/qvlcframe.hpp \
widgets/native/searchlineedit.cpp widgets/native/searchlineedit.hpp \
widgets/native/viewblockingrectangle.cpp widgets/native/viewblockingrectangle.hpp \
- widgets/native/doubleclickignoringitem.hpp \
- widgets/native/textureprovideritem.cpp widgets/native/textureprovideritem.hpp
+ widgets/native/doubleclickignoringitem.hpp
# Meta-object compilation
@@ -506,6 +507,7 @@ nodist_libqt_plugin_la_SOURCES = \
util/qsgtextureview.moc.cpp \
util/textureproviderobserver.moc.cpp \
util/kirigamiwheelhandler.moc.cpp \
+ util/textureproviderindirection.moc.cpp \
widgets/native/animators.moc.cpp \
widgets/native/csdthemeimage.moc.cpp \
widgets/native/customwidgets.moc.cpp \
@@ -513,8 +515,7 @@ nodist_libqt_plugin_la_SOURCES = \
widgets/native/navigation_attached.moc.cpp \
widgets/native/mlfolderseditor.moc.cpp \
widgets/native/searchlineedit.moc.cpp \
- widgets/native/viewblockingrectangle.moc.cpp \
- widgets/native/textureprovideritem.moc.cpp
+ widgets/native/viewblockingrectangle.moc.cpp
nodist_libqt_plugin_la_SOURCES += \
dialogs/extended/ui_equalizer.h \
=====================================
modules/gui/qt/maininterface/mainui.cpp
=====================================
@@ -50,6 +50,7 @@
#include "util/list_selection_model.hpp"
#include "util/ui_notifier.hpp"
#include "util/textureproviderobserver.hpp"
+#include "util/textureproviderindirection.hpp"
#include "dialogs/help/aboutmodel.hpp"
#include "dialogs/dialogs_provider.hpp"
@@ -64,7 +65,6 @@
#include "menus/qml_menu_wrapper.hpp"
-#include "widgets/native/textureprovideritem.hpp"
#include "widgets/native/csdthemeimage.hpp"
#include "widgets/native/navigation_attached.hpp"
#include "widgets/native/viewblockingrectangle.hpp"
@@ -396,6 +396,7 @@ void MainUI::registerQMLTypes()
qmlRegisterType<ListSelectionModel>( uri, versionMajor, versionMinor, "ListSelectionModel" );
qmlRegisterType<DoubleClickIgnoringItem>( uri, versionMajor, versionMinor, "DoubleClickIgnoringItem" );
qmlRegisterType<TextureProviderObserver>( uri, versionMajor, versionMinor, "TextureProviderObserver" );
+ qmlRegisterType<TextureProviderIndirection>( uri, versionMajor, versionMinor, "TextureProviderIndirection" );
qmlRegisterModule(uri, versionMajor, versionMinor);
qmlProtectModule(uri, versionMajor);
@@ -409,7 +410,6 @@ void MainUI::registerQMLTypes()
// @uri VLC.Widgets
qmlRegisterType<CSDThemeImage>(uri, versionMajor, versionMinor, "CSDThemeImage");
qmlRegisterType<ViewBlockingRectangle>( uri, versionMajor, versionMinor, "ViewBlockingRectangle" );
- qmlRegisterType<TextureProviderItem>( uri, versionMajor, versionMinor, "TextureProviderItem" );
qmlRegisterModule(uri, versionMajor, versionMinor);
qmlProtectModule(uri, versionMajor);
=====================================
modules/gui/qt/medialibrary/qml/ArtistTopBanner.qml
=====================================
@@ -111,7 +111,7 @@ FocusScope {
height: sourceNeedsTiling ? background.height : (aspectRatio * width)
- source: textureProviderItem
+ source: textureProviderIndirection
// Instead of clipping in the parent, denote the viewport here so we both
// do not need to clip the excess, and also save significant video memory:
@@ -124,21 +124,21 @@ FocusScope {
backgroundColor: theme.bg.primary
postprocess: sourceTextureProviderObserver.hasAlphaChannel
- Widgets.TextureProviderItem {
- id: textureProviderItem
+ TextureProviderIndirection {
+ id: textureProviderIndirection
// Like in `Player.qml`, this is used because when the source is
// mipmapped, sometimes it can not be sampled. This is considered
// a Qt bug, but `QSGTextureView` has a workaround for that. So,
- // we can have an indirection here through `TextureProviderItem`.
+ // we can have an indirection here through `TextureProviderIndirection`.
// This is totally acceptable as there is virtually no overhead.
source: background
detachAtlasTextures: blurEffect.sourceNeedsTiling
- horizontalWrapMode: blurEffect.sourceNeedsTiling ? Widgets.TextureProviderItem.Repeat : Widgets.TextureProviderItem.ClampToEdge
- verticalWrapMode: blurEffect.sourceNeedsTiling ? Widgets.TextureProviderItem.Repeat : Widgets.TextureProviderItem.ClampToEdge
+ horizontalWrapMode: blurEffect.sourceNeedsTiling ? TextureProviderIndirection.Repeat : TextureProviderIndirection.ClampToEdge
+ verticalWrapMode: blurEffect.sourceNeedsTiling ? TextureProviderIndirection.Repeat : TextureProviderIndirection.ClampToEdge
textureSubRect: blurEffect.sourceNeedsTiling ? Qt.rect(blurEffect.width / 8,
blurEffect.height / 8,
=====================================
modules/gui/qt/meson.build
=====================================
@@ -154,6 +154,7 @@ moc_headers = files(
'util/qsgtextureview.hpp',
'util/textureproviderobserver.hpp',
'util/kirigamiwheelhandler.hpp',
+ 'util/textureproviderindirection.hpp',
'widgets/native/animators.hpp',
'widgets/native/csdthemeimage.hpp',
'widgets/native/customwidgets.hpp',
@@ -162,7 +163,6 @@ moc_headers = files(
'widgets/native/mlfolderseditor.hpp',
'widgets/native/searchlineedit.hpp',
'widgets/native/viewblockingrectangle.hpp',
- 'widgets/native/textureprovideritem.hpp',
)
if host_system == 'windows'
@@ -498,6 +498,8 @@ qt_plugin_sources = files(
'util/colorizedsvgicon.hpp',
'util/kirigamiwheelhandler.cpp',
'util/kirigamiwheelhandler.hpp',
+ 'util/textureproviderindirection.cpp',
+ 'util/textureproviderindirection.hpp',
'widgets/native/animators.cpp',
'widgets/native/animators.hpp',
'widgets/native/customwidgets.cpp',
@@ -517,8 +519,6 @@ qt_plugin_sources = files(
'widgets/native/viewblockingrectangle.cpp',
'widgets/native/viewblockingrectangle.hpp',
'widgets/native/doubleclickignoringitem.hpp',
- 'widgets/native/textureprovideritem.cpp',
- 'widgets/native/textureprovideritem.hpp',
)
if host_system == 'windows'
=====================================
modules/gui/qt/player/qml/Player.qml
=====================================
@@ -295,7 +295,7 @@ FocusScope {
width: (cover.sar < dar) ? parent.width : parent.height * cover.sar
height: (cover.sar < dar) ? parent.width / cover.sar : parent.height
- source: textureProviderItem
+ source: textureProviderIndirection
postprocess: true
tint: bgtheme.palette.isDark ? "black" : "white"
@@ -311,8 +311,8 @@ FocusScope {
// video memory, depending on the excess content in the last layer:
viewportRect: Qt.rect((width - parent.width) / 2, (height - parent.height) / 2, parent.width, parent.height)
- Widgets.TextureProviderItem {
- id: textureProviderItem
+ TextureProviderIndirection {
+ id: textureProviderIndirection
// This should not be necessary anymore since `DualKawaseBlur`
// does not create layer for the source implicitly as `MultiEffect`
=====================================
modules/gui/qt/widgets/native/textureprovideritem.cpp → modules/gui/qt/util/textureproviderindirection.cpp
=====================================
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
-#include "textureprovideritem.hpp"
+#include "textureproviderindirection.hpp"
#include <QSGTextureProvider>
#include <QRunnable>
@@ -36,7 +36,13 @@ private:
const QPointer<QSGTextureProvider> m_textureProvider;
};
-TextureProviderItem::~TextureProviderItem()
+TextureProviderIndirection::TextureProviderIndirection(QQuickItem *parent)
+ : QQuickItem(parent)
+{
+
+}
+
+TextureProviderIndirection::~TextureProviderIndirection()
{
{
if (m_textureProvider)
@@ -53,12 +59,12 @@ TextureProviderItem::~TextureProviderItem()
}
}
-bool TextureProviderItem::isTextureProvider() const
+bool TextureProviderIndirection::isTextureProvider() const
{
return true;
}
-QSGTextureProvider *TextureProviderItem::textureProvider() const
+QSGTextureProvider *TextureProviderIndirection::textureProvider() const
{
// This method is called from the rendering thread.
@@ -70,8 +76,8 @@ QSGTextureProvider *TextureProviderItem::textureProvider() const
if (source)
{
assert(source->isTextureProvider() &&
- "TextureProviderItem: " \
- "TextureProviderItem's source item is not a texture provider. " \
+ "TextureProviderIndirection: " \
+ "TextureProviderIndirection's source item is not a texture provider. " \
"Layering can be enabled for the source item in order to make " \
"it a texture provider.");
@@ -98,16 +104,16 @@ QSGTextureProvider *TextureProviderItem::textureProvider() const
};
// These are going to be queued when necessary:
- connect(this, &TextureProviderItem::sourceChanged, m_textureProvider, adjustSource);
- connect(this, &TextureProviderItem::rectChanged, m_textureProvider, &QSGTextureViewProvider::setRect, Qt::DirectConnection);
+ connect(this, &TextureProviderIndirection::sourceChanged, m_textureProvider, adjustSource);
+ connect(this, &TextureProviderIndirection::rectChanged, m_textureProvider, &QSGTextureViewProvider::setRect, Qt::DirectConnection);
- connect(this, &TextureProviderItem::filteringChanged, m_textureProvider, &QSGTextureViewProvider::setFiltering);
- connect(this, &TextureProviderItem::mipmapFilteringChanged, m_textureProvider, &QSGTextureViewProvider::setMipmapFiltering);
- connect(this, &TextureProviderItem::anisotropyLevelChanged, m_textureProvider, &QSGTextureViewProvider::setAnisotropyLevel);
- connect(this, &TextureProviderItem::horizontalWrapModeChanged, m_textureProvider, &QSGTextureViewProvider::setHorizontalWrapMode);
- connect(this, &TextureProviderItem::verticalWrapModeChanged, m_textureProvider, &QSGTextureViewProvider::setVerticalWrapMode);
+ connect(this, &TextureProviderIndirection::filteringChanged, m_textureProvider, &QSGTextureViewProvider::setFiltering);
+ connect(this, &TextureProviderIndirection::mipmapFilteringChanged, m_textureProvider, &QSGTextureViewProvider::setMipmapFiltering);
+ connect(this, &TextureProviderIndirection::anisotropyLevelChanged, m_textureProvider, &QSGTextureViewProvider::setAnisotropyLevel);
+ connect(this, &TextureProviderIndirection::horizontalWrapModeChanged, m_textureProvider, &QSGTextureViewProvider::setHorizontalWrapMode);
+ connect(this, &TextureProviderIndirection::verticalWrapModeChanged, m_textureProvider, &QSGTextureViewProvider::setVerticalWrapMode);
- connect(this, &TextureProviderItem::detachAtlasTexturesChanged, m_textureProvider, [provider = m_textureProvider](bool detach) {
+ connect(this, &TextureProviderIndirection::detachAtlasTexturesChanged, m_textureProvider, [provider = m_textureProvider](bool detach) {
if (detach)
provider->requestDetachFromAtlas();
});
@@ -124,13 +130,13 @@ QSGTextureProvider *TextureProviderItem::textureProvider() const
return m_textureProvider;
}
-void TextureProviderItem::resetTextureSubRect()
+void TextureProviderIndirection::resetTextureSubRect()
{
m_rect = {};
emit rectChanged({});
}
-void TextureProviderItem::invalidateSceneGraph()
+void TextureProviderIndirection::invalidateSceneGraph()
{
// https://doc.qt.io/qt-6/qquickitem.html#graphics-resource-handling
@@ -143,7 +149,7 @@ void TextureProviderItem::invalidateSceneGraph()
}
}
-void TextureProviderItem::releaseResources()
+void TextureProviderIndirection::releaseResources()
{
// https://doc.qt.io/qt-6/qquickitem.html#graphics-resource-handling
=====================================
modules/gui/qt/widgets/native/textureprovideritem.hpp → modules/gui/qt/util/textureproviderindirection.hpp
=====================================
@@ -15,8 +15,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
-#ifndef TEXTUREPROVIDERITEM_HPP
-#define TEXTUREPROVIDERITEM_HPP
+#ifndef TEXTUREPROVIDERINDIRECTION_HPP
+#define TEXTUREPROVIDERINDIRECTION_HPP
#include <QQuickItem>
#include <QSGTextureProvider>
@@ -53,7 +53,7 @@ public:
void requestDetachFromAtlas();
};
-class TextureProviderItem : public QQuickItem
+class TextureProviderIndirection : public QQuickItem
{
Q_OBJECT
@@ -78,8 +78,8 @@ class TextureProviderItem : public QQuickItem
QML_ELEMENT
public:
- TextureProviderItem() = default;
- virtual ~TextureProviderItem();
+ explicit TextureProviderIndirection(QQuickItem *parent = nullptr);
+ ~TextureProviderIndirection();
// These enumerations must be in sync with `QSGTexture`:
// It appears that MOC is not clever enough to consider foreign enumerations with `Q_ENUM` (I tried)...
@@ -146,4 +146,4 @@ private:
std::atomic<bool> m_detachAtlasTextures = false;
};
-#endif // TEXTUREPROVIDERITEM_HPP
+#endif // TEXTUREPROVIDERINDIRECTION_HPP
=====================================
modules/gui/qt/widgets/qml/EnhancedImageExt.qml
=====================================
@@ -34,12 +34,12 @@ ImageExt {
// WARNING: Using this property may be incompatible with certain filling modes.
property alias textureSubRect: textureProvider.textureSubRect
- property alias textureProvider: textureProvider
+ property alias textureProvider: textureProviderIndirection
// NOTE: Target is by default the texture provider `ImageExt` provides, but it can be
// set to any texture provider. For example, `ShaderEffectSource` can be displayed
// rounded this way.
- property alias targetTextureProvider: textureProvider.source
+ property alias targetTextureProvider: textureProviderIndirection.source
targetTextureProvider: sourceTextureProviderItem
// No need to load images in this case:
@@ -52,8 +52,8 @@ ImageExt {
if (effectiveBackgroundColor.a > (1.0 - Number.EPSILON))
return false // If background color is opaque, no need for blending
- if (textureProviderItem === textureProvider) {
- console.assert(observer.source === textureProvider)
+ if (textureProviderItem === textureProviderIndirection) {
+ console.assert(observer.source === textureProviderIndirection)
if (!observer.hasAlphaChannel)
return false // If the texture is opaque, no need for blending
}
@@ -61,8 +61,8 @@ ImageExt {
return true
}
- TextureProviderItem {
- id: textureProvider
+ 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)
@@ -86,16 +86,16 @@ ImageExt {
Connections {
target: root.Window.window
- enabled: root.visible && textureProvider.source && !(textureProvider.source instanceof Image)
+ enabled: root.visible && textureProviderIndirection.source && !(textureProviderIndirection.source instanceof Image)
function onAfterAnimating() {
- textureProvider.textureSize = observer.textureSize
+ textureProviderIndirection.textureSize = observer.textureSize
}
}
TextureProviderObserver {
id: observer
- source: textureProvider
+ source: textureProviderIndirection
}
}
}
=====================================
modules/gui/qt/widgets/qml/PartialEffect.qml
=====================================
@@ -20,7 +20,7 @@ import QtQuick
import QtQuick.Window
import VLC.MainInterface
-import VLC.Widgets as Widgets
+import VLC.Util
// This item can be used as a layer effect.
// The purpose of this item is to apply an effect to a partial
@@ -36,10 +36,10 @@ 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 alias source: textureProviderIndirection.source
// Rectangular area where the effect should be applied:
- property alias effectRect: textureProviderItem.effectRect
+ property alias effectRect: textureProviderIndirection.effectRect
// Not mandatory to provide, but when feasible (such as, effect is not
// an isolated inner area), provide it for optimization. When not provided,
@@ -71,14 +71,14 @@ Item {
blending: false
- readonly property Item source: useSubTexture ? sourceVisualTextureProviderItem : root.source
+ readonly property Item source: useSubTexture ? sourceVisualTextureProviderIndirection : root.source
readonly property rect discardRect: {
if (blending && !useSubTexture)
- 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(textureProviderIndirection.x / root.width,
+ textureProviderIndirection.y / root.height,
+ (textureProviderIndirection.x + textureProviderIndirection.width) / root.width,
+ (textureProviderIndirection.y + textureProviderIndirection.height) / root.height)
else // If blending is not enabled, no need to make the normalization calculations
return Qt.rect(0, 0, 0, 0)
}
@@ -91,16 +91,16 @@ Item {
fragmentShader: (discardRect.width > 0.0 && discardRect.height > 0.0) ? "qrc:///shaders/RectFilter.frag.qsb" : ""
- Widgets.TextureProviderItem {
- id: sourceVisualTextureProviderItem
+ TextureProviderIndirection {
+ id: sourceVisualTextureProviderIndirection
source: root.source
// If the effect is in a isolated inner area, filtering is necessary. Otherwise, we can simply
// use sub-texturing for the source itself as well (we already use sub-texture for the effect area).
- textureSubRect: (sourceProxy.useSubTexture) ? Qt.rect(root.sourceVisualRect.x * textureProviderItem.eDPR,
- root.sourceVisualRect.y * textureProviderItem.eDPR,
- root.sourceVisualRect.width * textureProviderItem.eDPR,
- root.sourceVisualRect.height * textureProviderItem.eDPR) : undefined
+ textureSubRect: (sourceProxy.useSubTexture) ? Qt.rect(root.sourceVisualRect.x * textureProviderIndirection.eDPR,
+ root.sourceVisualRect.y * textureProviderIndirection.eDPR,
+ root.sourceVisualRect.width * textureProviderIndirection.eDPR,
+ root.sourceVisualRect.height * textureProviderIndirection.eDPR) : undefined
}
}
@@ -109,8 +109,8 @@ Item {
// 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
+ TextureProviderIndirection {
+ id: textureProviderIndirection
x: effectRect.x
y: effectRect.y
@@ -123,16 +123,16 @@ Item {
property real eDPR: MainCtx.effectiveDevicePixelRatio(Window.window)
- textureSubRect: Qt.rect(effectRect.x * textureProviderItem.eDPR,
- effectRect.y * textureProviderItem.eDPR,
- effectRect.width * textureProviderItem.eDPR,
- effectRect.height * textureProviderItem.eDPR)
+ textureSubRect: Qt.rect(effectRect.x * textureProviderIndirection.eDPR,
+ effectRect.y * textureProviderIndirection.eDPR,
+ effectRect.width * textureProviderIndirection.eDPR,
+ effectRect.height * textureProviderIndirection.eDPR)
Connections {
target: MainCtx
function onIntfDevicePixelRatioChanged() {
- textureProviderItem.eDPR = MainCtx.effectiveDevicePixelRatio(textureProviderItem.Window.window)
+ textureProviderIndirection.eDPR = MainCtx.effectiveDevicePixelRatio(textureProviderIndirection.Window.window)
}
}
@@ -140,7 +140,7 @@ Item {
Binding {
target: root.effect
property: root.samplerName
- value: textureProviderItem
+ value: textureProviderIndirection
}
// Adjust the blending. Currently MultiEffect/FastBlur does not
@@ -162,7 +162,7 @@ Item {
Binding {
target: root.effect
property: "anchors.fill"
- value: textureProviderItem
+ value: textureProviderIndirection
}
}
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3e2a1c6e0896344526f0df5cc2895c414660cefd...3a6ad382228fcfa0b079b2c328608d36df34f178
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3e2a1c6e0896344526f0df5cc2895c414660cefd...3a6ad382228fcfa0b079b2c328608d36df34f178
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list