[vlc-commits] [Git][videolan/vlc][master] 3 commits: qml: round the size of `PIPPlayer`
Steve Lhomme (@robUx4)
gitlab at videolan.org
Sat Feb 8 16:02:40 UTC 2025
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
dd31fc7e by Fatih Uzunoglu at 2025-02-08T15:47:57+00:00
qml: round the size of `PIPPlayer`
- - - - -
bb14ebdf by Fatih Uzunoglu at 2025-02-08T15:47:57+00:00
qt: use `std::ceil()` for video surface size when reporting window size
Quick items have floating point size. Video window size should be ceil
rounded, otherwise bare window may be exposed through slightly larger
`VideoSurface` leading to pixel row/column glitch.
- - - - -
8da8fb82 by Fatih Uzunoglu at 2025-02-08T15:47:57+00:00
qt: truncate instead of rounding to the nearest in `onSurfacePositionChanged()`
This is to ensure that video window covers the area where video surface begins.
- - - - -
6 changed files:
- modules/gui/qt/maininterface/compositor_platform.cpp
- modules/gui/qt/maininterface/compositor_wayland.cpp
- modules/gui/qt/maininterface/compositor_win7.cpp
- modules/gui/qt/maininterface/compositor_x11.cpp
- modules/gui/qt/maininterface/videosurface.cpp
- modules/gui/qt/player/qml/PIPPlayer.qml
Changes:
=====================================
modules/gui/qt/maininterface/compositor_platform.cpp
=====================================
@@ -194,10 +194,12 @@ void CompositorPlatform::windowDisable()
void CompositorPlatform::onSurfacePositionChanged(const QPointF &position)
{
- m_videoWindow->setPosition((position / m_videoWindow->devicePixelRatio()).toPoint());
+ const QPointF point = position / m_videoWindow->devicePixelRatio();
+ m_videoWindow->setPosition({static_cast<int>(point.x()), static_cast<int>(point.y())});
}
void CompositorPlatform::onSurfaceSizeChanged(const QSizeF &size)
{
- m_videoWindow->resize((size / m_videoWindow->devicePixelRatio()).toSize());
+ const QSizeF area = (size / m_videoWindow->devicePixelRatio());
+ m_videoWindow->resize({static_cast<int>(std::ceil(area.width())), static_cast<int>(std::ceil(area.height()))});
}
=====================================
modules/gui/qt/maininterface/compositor_wayland.cpp
=====================================
@@ -230,8 +230,8 @@ void CompositorWayland::onSurfaceSizeChanged(const QSizeF& size)
qreal nativeDpr = dprForWindow(m_qmlView.get());
m_waylandImpl->resize(m_waylandImpl,
- size.width() / nativeDpr,
- size.height() / nativeDpr);
+ std::ceil(size.width() / nativeDpr),
+ std::ceil(size.height() / nativeDpr));
}
void CompositorWayland::onSurfaceScaleChanged(qreal dpr)
=====================================
modules/gui/qt/maininterface/compositor_win7.cpp
=====================================
@@ -225,12 +225,14 @@ void CompositorWin7::resetVideoZOrder()
void CompositorWin7::onSurfacePositionChanged(const QPointF& position)
{
- m_stable->move((position / m_stable->window()->devicePixelRatioF()).toPoint());
+ const QPointF point = position / m_stable->window()->devicePixelRatioF();
+ m_stable->move({static_cast<int>(point.x()), static_cast<int>(point.y())});
}
void CompositorWin7::onSurfaceSizeChanged(const QSizeF& size)
{
- m_stable->resize((size / m_stable->window()->devicePixelRatioF()).toSize());
+ const QSizeF area = (size / m_stable->window()->devicePixelRatioF());
+ m_stable->resize({static_cast<int>(std::ceil(area.width())), static_cast<int>(std::ceil(area.height()))});
}
=====================================
modules/gui/qt/maininterface/compositor_x11.cpp
=====================================
@@ -240,12 +240,13 @@ void CompositorX11::unloadGUI()
void CompositorX11::onSurfacePositionChanged(const QPointF& position)
{
- m_renderWindow->setVideoPosition(position.toPoint());
+ m_renderWindow->setVideoPosition({static_cast<int>(position.x()), static_cast<int>(position.y())});
}
void CompositorX11::onSurfaceSizeChanged(const QSizeF& size)
{
- m_renderWindow->setVideoSize((size / m_videoWidget->window()->devicePixelRatioF()).toSize());
+ const QSizeF area = (size / m_videoWidget->window()->devicePixelRatioF());
+ m_renderWindow->setVideoSize({static_cast<int>(std::ceil(area.width())), static_cast<int>(std::ceil(area.height()))});
}
bool CompositorX11::setupVoutWindow(vlc_window_t* p_wnd, VoutDestroyCb destroyCb)
=====================================
modules/gui/qt/maininterface/videosurface.cpp
=====================================
@@ -195,9 +195,9 @@ void VideoSurfaceProvider::onSurfaceSizeChanged(QSizeF size)
emit surfaceSizeChanged(size);
QMutexLocker lock(&m_voutlock);
if (m_resizer)
- m_resizer->reportSize(size.width(), size.height());
+ m_resizer->reportSize(std::ceil(size.width()), std::ceil(size.height()));
else if (m_voutWindow)
- vlc_window_ReportSize(m_voutWindow, size.width(), size.height());
+ vlc_window_ReportSize(m_voutWindow, std::ceil(size.width()), std::ceil(size.height()));
}
=====================================
modules/gui/qt/player/qml/PIPPlayer.qml
=====================================
@@ -27,8 +27,8 @@ import VLC.Util
T.Control {
id: root
- width: VLCStyle.dp(320, VLCStyle.scale)
- height: VLCStyle.dp(180, VLCStyle.scale)
+ width: Math.round(VLCStyle.dp(320, VLCStyle.scale))
+ height: Math.round(VLCStyle.dp(180, VLCStyle.scale))
//VideoSurface x,y won't update
onXChanged: videoSurface.updateSurfacePosition()
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/a0d5d9cec6b4025021d7250e7c842584c771861f...8da8fb82c6f6439bce7973ed2a499eb29ca7b04d
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/a0d5d9cec6b4025021d7250e7c842584c771861f...8da8fb82c6f6439bce7973ed2a499eb29ca7b04d
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