[vlc-commits] [Git][videolan/vlc][master] 4 commits: qt: avoid `dynamic_cast` in `SGManipulator::updatePaintNode()`

François Cartegnie (@fcartegnie) gitlab at videolan.org
Fri Oct 9 08:39:58 UTC 2026



François Cartegnie pushed to branch master at VideoLAN / VLC


Commits:
29dd2a96 by Fatih Uzunoglu at 2026-10-09T10:11:43+02:00
qt: avoid `dynamic_cast` in `SGManipulator::updatePaintNode()`

Also removes unused variable `targetRenderNode`.

- - - - -
a19726b5 by Fatih Uzunoglu at 2026-10-09T10:11:43+02:00
qt: avoid `dynamic_cast` in `ViewBlockingRectangle::updatePaintNode()`

- - - - -
a380badc by Fatih Uzunoglu at 2026-10-09T10:11:43+02:00
qt: wayland: avoid `dynamic_cast` in `MainCtx::windowExtendedMarginChanged()` handler

- - - - -
e36aa898 by Fatih Uzunoglu at 2026-10-09T10:11:43+02:00
qt: avoid `dynamic_cast` in `InterfaceWindowHandler::setInterfaceHiden()`

- - - - -


4 changed files:

- modules/gui/qt/maininterface/compositor_wayland.cpp
- modules/gui/qt/maininterface/interface_window_handler.cpp
- modules/gui/qt/util/sgmanipulator.cpp
- modules/gui/qt/widgets/native/viewblockingrectangle.cpp


Changes:

=====================================
modules/gui/qt/maininterface/compositor_wayland.cpp
=====================================
@@ -119,7 +119,7 @@ bool CompositorWayland::makeMainInterface(MainCtx* mainCtx, std::function<void(Q
         connect(quickViewPtr, &QWindow::widthChanged, this, &CompositorWayland::adjustQuickWindowMask, Qt::UniqueConnection);
         connect(quickViewPtr, &QWindow::heightChanged, this, &CompositorWayland::adjustQuickWindowMask, Qt::UniqueConnection);
 
-        const auto waylandWindow = dynamic_cast<QNativeInterface::Private::QWaylandWindow *>(quickViewPtr->handle());
+        const auto waylandWindow = quickViewPtr->nativeInterface<QNativeInterface::Private::QWaylandWindow>();
         assert(waylandWindow);
         const QMargins margins(margin, margin, margin, margin);
         waylandWindow->setCustomMargins(margins);


=====================================
modules/gui/qt/maininterface/interface_window_handler.cpp
=====================================
@@ -452,7 +452,7 @@ void InterfaceWindowHandler::setInterfaceHiden()
         // type() == WaylandCompositor is not used because any video embedding methodology may
         // depend on window resources:
         const bool ret = qGuiApp->platformName().startsWith(QLatin1String("wayland")) &&
-                         dynamic_cast<vlc::CompositorVideo*>(intf->p_compositor.get());
+                         (intf->p_compositor && (intf->p_compositor->type() != vlc::Compositor::DummyCompositor));
         if (ret)
             msg_Warn(intf, "In this configuration, the interface window can not get hidden.");
         return ret;


=====================================
modules/gui/qt/util/sgmanipulator.cpp
=====================================
@@ -68,22 +68,31 @@ QSGNode *SGManipulator::updatePaintNode(QSGNode *, UpdatePaintNodeData *data)
 
     QSGNode *targetNode = nullptr;
     QSGGeometryNode *targetGeometryNode = nullptr;
-    QSGRenderNode *targetRenderNode = nullptr;
 
     QSGNode *i = transformNode;
     while (i)
     {
         // NOTE: The target node must not be a transform node.
         // NOTE: The transform nodes parent sibling item's rendering nodes.
-        if (dynamic_cast<QSGTransformNode*>(i))
+        const auto type = i->type();
+        if (type == QSGNode::TransformNodeType)
         {
             i = i->previousSibling();
             continue;
         }
 
         targetNode = i;
-        targetGeometryNode = dynamic_cast<QSGGeometryNode*>(i);
-        targetRenderNode = dynamic_cast<QSGRenderNode*>(i);
+
+        switch (type)
+        {
+        case QSGNode::GeometryNodeType:
+            assert(dynamic_cast<QSGGeometryNode*>(i));
+            targetGeometryNode = static_cast<QSGGeometryNode*>(i);
+            break;
+        default:
+            targetGeometryNode = nullptr;
+            break;
+        }
 
         break;
     }


=====================================
modules/gui/qt/widgets/native/viewblockingrectangle.cpp
=====================================
@@ -108,8 +108,25 @@ ViewBlockingRectangle::ViewBlockingRectangle(QQuickItem *parent)
 
 QSGNode *ViewBlockingRectangle::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
 {
-    auto rectangleNode = dynamic_cast<QSGRectangleNode*>(oldNode);
-    auto softwareRenderNode = dynamic_cast<SoftwareRenderNode*>(oldNode);
+    QSGRectangleNode *rectangleNode = nullptr;
+    SoftwareRenderNode *softwareRenderNode = nullptr;
+
+    if (oldNode)
+    {
+        switch (oldNode->type())
+        {
+        case QSGNode::GeometryNodeType:
+            assert(dynamic_cast<QSGRectangleNode*>(oldNode));
+            rectangleNode = static_cast<QSGRectangleNode*>(oldNode);
+            break;
+        case QSGNode::RenderNodeType:
+            // Can be `SoftwareRenderNode` or `MatrixChangeObserverNode`:
+            softwareRenderNode = dynamic_cast<SoftwareRenderNode*>(oldNode);
+            break;
+        default:
+            break;
+        }
+    }
 
     assert(window());
     const bool softwareMode = (window()->rendererInterface()->graphicsApi() == QSGRendererInterface::GraphicsApi::Software);



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/f77762543bdd0646fd88ed28cb27ccf24081cb84...e36aa8986916b5d85b43d27076abe7803f268897

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