diff options
author | Doris Verria <doris.verria@qt.io> | 2022-10-20 17:07:05 +0200 |
---|---|---|
committer | Doris Verria <doris.verria@qt.io> | 2022-10-21 08:12:41 +0000 |
commit | 0f3c93716e246dd98d320a4e37ac08b7e152bb09 (patch) | |
tree | f2f781e1b6264da24f83513f8c612c5ec4882221 | |
parent | 1d57fe25c039f76088df5c63d4198da5d61af5ca (diff) |
VideoOutput: Always update geometry when video surface format changes
When the video surface format changes, the video output's
_q_updateNativeSize() slot is called as a response. Inside this slot,
we mark the geometry as dirty (needing update) only if the native
size was changed.
However, this is not the only case that would require a geometry
update. In the case where the video surface format's scanline direction
changes, and this can happen when the pixel format changes (eg: for
uncompressed RGB formats the scanline direction depends on the sign of
the bitmap height, for YUV is always TopToBottom, etc.), the geometry
needs to update too, otherwise the video may appear vertically flipped.
To fix, always mark the geometry as dirty when inside the
_q_updateNativeSize() slot. As this is called only whenever the video
source format changes or the dimensions of the video output change,
it won't lead to many unnecessary calls to update the geometry.
Fixes: QTBUG-96746
Change-Id: I7d1d3a0b8e7b7122b7e64dfdd7c1de4098d7daf8
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
-rw-r--r-- | src/qtmultimediaquicktools/qdeclarativevideooutput.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/qtmultimediaquicktools/qdeclarativevideooutput.cpp b/src/qtmultimediaquicktools/qdeclarativevideooutput.cpp index 1f7f9c9ab..1bda0f84f 100644 --- a/src/qtmultimediaquicktools/qdeclarativevideooutput.cpp +++ b/src/qtmultimediaquicktools/qdeclarativevideooutput.cpp @@ -374,6 +374,8 @@ void QDeclarativeVideoOutput::_q_updateNativeSize() if (!m_backend) return; + m_geometryDirty = true; + QSize size = m_backend->nativeSize(); if (!qIsDefaultAspect(m_orientation)) { size.transpose(); @@ -382,8 +384,6 @@ void QDeclarativeVideoOutput::_q_updateNativeSize() if (m_nativeSize != size) { m_nativeSize = size; - m_geometryDirty = true; - setImplicitWidth(size.width()); setImplicitHeight(size.height()); |