Qt: Fix camera image being upside-down sometimes (fixes #829 again)

This commit is contained in:
Vicki Pfau 2020-09-10 23:17:47 -07:00
parent 0058ddd975
commit bfb6973849
2 changed files with 6 additions and 6 deletions

View File

@ -20,6 +20,7 @@ Other fixes:
- GBA Core: Fix memory leak when loading symbols - GBA Core: Fix memory leak when loading symbols
- Qt: Add dummy English translation file (fixes mgba.io/i/1469) - 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 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 - mGUI: Fix closing down a game if an exit is signalled
- mVL: Fix injecting accidentally draining non-injection buffer - mVL: Fix injecting accidentally draining non-injection buffer
- VFS: Fix directory node listing on some filesystems - VFS: Fix directory node listing on some filesystems

View File

@ -6,6 +6,7 @@
#include "VideoDumper.h" #include "VideoDumper.h"
#include <QImage> #include <QImage>
#include <QVideoSurfaceFormat>
using namespace QGBA; using namespace QGBA;
@ -40,13 +41,11 @@ bool VideoDumper::present(const QVideoFrame& frame) {
QImage image(bits, mappedFrame.width(), mappedFrame.height(), mappedFrame.bytesPerLine(), format); QImage image(bits, mappedFrame.width(), mappedFrame.height(), mappedFrame.bytesPerLine(), format);
if (swap) { if (swap) {
image = image.rgbSwapped(); image = image.rgbSwapped();
} else { } else if (surfaceFormat().scanLineDirection() != QVideoSurfaceFormat::BottomToTop) {
#ifdef Q_OS_WIN
// Qt's DirectShow plug-in is pretty dang buggy
image = image.mirrored();
#else
image = image.copy(); // Create a deep copy of the bits image = image.copy(); // Create a deep copy of the bits
#endif }
if (surfaceFormat().scanLineDirection() == QVideoSurfaceFormat::BottomToTop) {
image = image.mirrored();
} }
mappedFrame.unmap(); mappedFrame.unmap();
emit imageAvailable(image); emit imageAvailable(image);