diff --git a/src/platform/qt/Display.cpp b/src/platform/qt/Display.cpp index 9e896fbb4..853d02d12 100644 --- a/src/platform/qt/Display.cpp +++ b/src/platform/qt/Display.cpp @@ -5,10 +5,13 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "Display.h" +#include "ConfigController.h" #include "DisplayGL.h" #include "DisplayQt.h" #include "LogController.h" +#include + using namespace QGBA; #if defined(BUILD_GL) || defined(BUILD_GLES2) || defined(USE_EPOXY) @@ -91,6 +94,24 @@ void Display::attach(std::shared_ptr controller) { connect(controller.get(), &CoreController::didReset, this, &Display::resizeContext); } +void Display::configure(ConfigController* config) { + const mCoreOptions* opts = config->options(); + lockAspectRatio(opts->lockAspectRatio); + lockIntegerScaling(opts->lockIntegerScaling); + interframeBlending(opts->interframeBlending); + filter(opts->resampleVideo); + config->updateOption("showOSD"); +#if defined(BUILD_GL) || defined(BUILD_GLES2) + if (opts->shader) { + struct VDir* shader = VDirOpen(opts->shader); + if (shader && supportsShaders()) { + setShaders(shader); + shader->close(shader); + } + } +#endif +} + void Display::resizeEvent(QResizeEvent*) { m_messagePainter.resize(size(), m_lockAspectRatio, devicePixelRatio()); } diff --git a/src/platform/qt/Display.h b/src/platform/qt/Display.h index 6561d5e34..9edbfa6b8 100644 --- a/src/platform/qt/Display.h +++ b/src/platform/qt/Display.h @@ -18,6 +18,7 @@ struct VideoShader; namespace QGBA { +class ConfigController; class CoreController; class VideoProxy; @@ -42,7 +43,8 @@ public: bool isFiltered() const { return m_filter; } bool isShowOSD() const { return m_showOSD; } - void attach(std::shared_ptr); + virtual void attach(std::shared_ptr); + virtual void configure(ConfigController*); virtual void startDrawing(std::shared_ptr) = 0; virtual bool isDrawing() const = 0; virtual bool supportsShaders() const = 0; diff --git a/src/platform/qt/Window.cpp b/src/platform/qt/Window.cpp index 00930deb3..76d308f19 100644 --- a/src/platform/qt/Window.cpp +++ b/src/platform/qt/Window.cpp @@ -961,20 +961,10 @@ void Window::reloadDisplayDriver() { m_screenWidget->unsetCursor(); }); - const mCoreOptions* opts = m_config->options(); - m_display->lockAspectRatio(opts->lockAspectRatio); - m_display->lockIntegerScaling(opts->lockIntegerScaling); - m_display->interframeBlending(opts->interframeBlending); - m_display->filter(opts->resampleVideo); - m_config->updateOption("showOSD"); + m_display->configure(m_config); #if defined(BUILD_GL) || defined(BUILD_GLES2) - if (opts->shader) { - struct VDir* shader = VDirOpen(opts->shader); - if (shader && m_display->supportsShaders()) { - m_display->setShaders(shader); - m_shaderView->refreshShaders(); - shader->close(shader); - } + if (m_shaderView) { + m_shaderView->refreshShaders(); } #endif