Qt: Fix camera image being upside-down sometimes (fixes #829 again)
Vicki Pfau vi@endrift.com
Thu, 10 Sep 2020 23:17:47 -0700
2 files changed,
6 insertions(+),
6 deletions(-)
M
CHANGES
→
CHANGES
@@ -65,6 +65,7 @@ - Qt: Fix static compilation in MinGW (fixes mgba.io/i/1769)
- Qt: Fix a race condition in the frame inspector - Qt: Add dummy English translation file (fixes mgba.io/i/1469) - Qt: Fix Battle Chip view not displaying chips on some DPI settings + - Qt: Fix camera image being upside-down sometimes (fixes mgba.io/i/829 again) - mGUI: Fix closing down a game if an exit is signalled - mVL: Fix injecting accidentally draining non-injection buffer - SM83: Simplify register pair access on big endian
M
src/platform/qt/VideoDumper.cpp
→
src/platform/qt/VideoDumper.cpp
@@ -6,6 +6,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "VideoDumper.h" #include <QImage> +#include <QVideoSurfaceFormat> using namespace QGBA;@@ -40,13 +41,11 @@ uchar* bits = mappedFrame.bits();
QImage image(bits, mappedFrame.width(), mappedFrame.height(), mappedFrame.bytesPerLine(), format); if (swap) { image = image.rgbSwapped(); - } else { -#ifdef Q_OS_WIN - // Qt's DirectShow plug-in is pretty dang buggy - image = image.mirrored(); -#else + } else if (surfaceFormat().scanLineDirection() != QVideoSurfaceFormat::BottomToTop) { image = image.copy(); // Create a deep copy of the bits -#endif + } + if (surfaceFormat().scanLineDirection() == QVideoSurfaceFormat::BottomToTop) { + image = image.mirrored(); } mappedFrame.unmap(); emit imageAvailable(image);