From 814be50321fe5117376bf9d459fd008bb24352c9 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Fri, 20 Dec 2019 21:11:29 -0800 Subject: [PATCH] Qt: Fix undesired screen filtering when paused (fixes #1602) --- CHANGES | 1 + src/platform/qt/Window.cpp | 9 ++++++++- src/platform/qt/Window.h | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index bd270fdb2..8eeeb43c1 100644 --- a/CHANGES +++ b/CHANGES @@ -103,6 +103,7 @@ Other fixes: - Qt: Fix several cases where shader selections don't get saved - Qt: Fix division by zero error in invalid TilePainter state - Qt: Fix "restart needed" dialog after first config (fixes mgba.io/i/1601) + - Qt: Fix undesired screen filtering when paused (fixes mgba.io/i/1602) Misc: - GB Memory: Support manual SRAM editing (fixes mgba.io/i/1580) - SDL: Use controller GUID instead of name diff --git a/src/platform/qt/Window.cpp b/src/platform/qt/Window.cpp index c60514940..0a97e1f32 100644 --- a/src/platform/qt/Window.cpp +++ b/src/platform/qt/Window.cpp @@ -259,6 +259,7 @@ void Window::reloadConfig() { m_display->lockAspectRatio(opts->lockAspectRatio); m_display->filter(opts->resampleVideo); } + m_screenWidget->filter(opts->resampleVideo); m_inputController.setScreensaverSuspendable(opts->suspendScreensaver); } @@ -909,6 +910,7 @@ void Window::reloadDisplayDriver() { m_display->lockIntegerScaling(opts->lockIntegerScaling); m_display->interframeBlending(opts->interframeBlending); m_display->filter(opts->resampleVideo); + m_screenWidget->filter(opts->resampleVideo); m_config->updateOption("showOSD"); #if defined(BUILD_GL) || defined(BUILD_GLES2) if (opts->shader) { @@ -1387,6 +1389,7 @@ void Window::setupMenu(QMenuBar* menubar) { if (m_display) { m_display->filter(value.toBool()); } + m_screenWidget->filter(value.toBool()); }, this); m_config->updateOption("resampleVideo"); @@ -1948,11 +1951,15 @@ void WindowBackground::setLockAspectRatio(bool lock) { m_lockAspectRatio = lock; } +void WindowBackground::filter(bool filter) { + m_filter = filter; +} + void WindowBackground::paintEvent(QPaintEvent* event) { QWidget::paintEvent(event); const QPixmap& logo = pixmap(); QPainter painter(this); - painter.setRenderHint(QPainter::SmoothPixmapTransform); + painter.setRenderHint(QPainter::SmoothPixmapTransform, m_filter); painter.fillRect(QRect(QPoint(), size()), Qt::black); QSize s = size(); QSize ds = s; diff --git a/src/platform/qt/Window.h b/src/platform/qt/Window.h index a7a70f48f..b38873c9e 100644 --- a/src/platform/qt/Window.h +++ b/src/platform/qt/Window.h @@ -245,6 +245,7 @@ public: void setDimensions(int width, int height); void setLockIntegerScaling(bool lock); void setLockAspectRatio(bool lock); + void filter(bool filter); const QPixmap& pixmap() const { return m_pixmap; } @@ -258,6 +259,7 @@ private: int m_aspectHeight; bool m_lockAspectRatio; bool m_lockIntegerScaling; + bool m_filter; }; }