[vlc-commits] [Git][videolan/vlc][master] 2 commits: qt: fix garbage data in extented frame with X11
Steve Lhomme (@robUx4)
gitlab at videolan.org
Mon Sep 30 09:58:08 UTC 2024
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
3ca7325b by Pierre Lamot at 2024-09-30T09:41:14+00:00
qt: fix garbage data in extented frame with X11
Qt renderer may mess with scissor/viewport
- - - - -
af27693d by Pierre Lamot at 2024-09-30T09:41:14+00:00
qt: fix video surface being displaced when extended margin changes
We need to track the position of the VideoSurface globally, if the position of
one of its parent change, the VideoSurface isn't notified, so we need to track
the position of all of its parent
- - - - -
3 changed files:
- modules/gui/qt/maininterface/compositor_x11_uisurface.cpp
- modules/gui/qt/maininterface/videosurface.cpp
- modules/gui/qt/maininterface/videosurface.hpp
Changes:
=====================================
modules/gui/qt/maininterface/compositor_x11_uisurface.cpp
=====================================
@@ -230,6 +230,9 @@ void CompositorX11UISurface::render()
m_context->functions()->glBindFramebuffer(GL_READ_FRAMEBUFFER, m_fboId);
m_context->functions()->glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_textureId, 0);
+ //qt may mess with scissor/viewport
+ m_context->functions()->glScissor(0,0, fboSize.width(), fboSize.height());
+ m_context->extraFunctions()->glViewport(0,0, fboSize.width(), fboSize.height());
m_context->extraFunctions()->glBlitFramebuffer(0, 0, fboSize.width(), fboSize.height(), 0, 0, fboSize.width(), fboSize.height(), GL_COLOR_BUFFER_BIT, GL_NEAREST);
m_context->swapBuffers(this);
}
=====================================
modules/gui/qt/maininterface/videosurface.cpp
=====================================
@@ -216,6 +216,8 @@ VideoSurface::VideoSurface(QQuickItem* parent)
connect(this, &QQuickItem::xChanged, this, &VideoSurface::updateSurfacePosition);
connect(this, &QQuickItem::yChanged, this, &VideoSurface::updateSurfacePosition);
+ connect(this, &QQuickItem::parentChanged, this, &VideoSurface::updateParentChanged);
+ updateParentChanged();
}
}
@@ -392,3 +394,27 @@ void VideoSurface::setVideoSurfaceProvider(VideoSurfaceProvider *newVideoSurface
emit videoSurfaceProviderChanged();
}
+
+void VideoSurface::updateParentChanged()
+{
+ //we need to track the global position of the VideoSurface within the scene
+ //it depends on the position of the VideoSurface itself and all its parents
+
+ for (const QPointer<QQuickItem>& p : m_parentList)
+ {
+ if (!p)
+ continue;
+ disconnect(p, &QQuickItem::xChanged, this, &VideoSurface::updateSurfacePosition);
+ disconnect(p, &QQuickItem::yChanged, this, &VideoSurface::updateSurfacePosition);
+ disconnect(p, &QQuickItem::parentChanged, this, &VideoSurface::updateParentChanged);
+ }
+ m_parentList.clear();
+
+ for (QQuickItem* p = parentItem(); p != nullptr; p = p->parentItem())
+ {
+ connect(p, &QQuickItem::xChanged, this, &VideoSurface::updateSurfacePosition);
+ connect(p, &QQuickItem::yChanged, this, &VideoSurface::updateSurfacePosition);
+ connect(p, &QQuickItem::parentChanged, this, &VideoSurface::updateParentChanged);
+ m_parentList.push_back(p);
+ }
+}
=====================================
modules/gui/qt/maininterface/videosurface.hpp
=====================================
@@ -143,11 +143,15 @@ protected slots:
void updateSurfaceSize();
void updateSurfacePositionAndSize();
+ void updateParentChanged();
+
private:
QPointF m_oldHoverPos;
QPointer<VideoSurfaceProvider> m_provider;
+ std::vector<QPointer<QQuickItem>> m_parentList;
+
bool m_sizeDirty = false;
bool m_positionDirty = false;
};
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e5fc9cc4be87e0f8c7e06e1cedd7e061a390c6ee...af27693dc2755064c55da76301412b47cccd6711
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e5fc9cc4be87e0f8c7e06e1cedd7e061a390c6ee...af27693dc2755064c55da76301412b47cccd6711
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