mirror of https://github.com/mgba-emu/mgba.git
Qt: Move display configuration
This commit is contained in:
parent
a36e4157c0
commit
d1d9e796af
|
@ -5,10 +5,13 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
#include "Display.h"
|
#include "Display.h"
|
||||||
|
|
||||||
|
#include "ConfigController.h"
|
||||||
#include "DisplayGL.h"
|
#include "DisplayGL.h"
|
||||||
#include "DisplayQt.h"
|
#include "DisplayQt.h"
|
||||||
#include "LogController.h"
|
#include "LogController.h"
|
||||||
|
|
||||||
|
#include <mgba-util/vfs.h>
|
||||||
|
|
||||||
using namespace QGBA;
|
using namespace QGBA;
|
||||||
|
|
||||||
#if defined(BUILD_GL) || defined(BUILD_GLES2) || defined(USE_EPOXY)
|
#if defined(BUILD_GL) || defined(BUILD_GLES2) || defined(USE_EPOXY)
|
||||||
|
@ -91,6 +94,24 @@ void Display::attach(std::shared_ptr<CoreController> controller) {
|
||||||
connect(controller.get(), &CoreController::didReset, this, &Display::resizeContext);
|
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*) {
|
void Display::resizeEvent(QResizeEvent*) {
|
||||||
m_messagePainter.resize(size(), m_lockAspectRatio, devicePixelRatio());
|
m_messagePainter.resize(size(), m_lockAspectRatio, devicePixelRatio());
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ struct VideoShader;
|
||||||
|
|
||||||
namespace QGBA {
|
namespace QGBA {
|
||||||
|
|
||||||
|
class ConfigController;
|
||||||
class CoreController;
|
class CoreController;
|
||||||
class VideoProxy;
|
class VideoProxy;
|
||||||
|
|
||||||
|
@ -42,7 +43,8 @@ public:
|
||||||
bool isFiltered() const { return m_filter; }
|
bool isFiltered() const { return m_filter; }
|
||||||
bool isShowOSD() const { return m_showOSD; }
|
bool isShowOSD() const { return m_showOSD; }
|
||||||
|
|
||||||
void attach(std::shared_ptr<CoreController>);
|
virtual void attach(std::shared_ptr<CoreController>);
|
||||||
|
virtual void configure(ConfigController*);
|
||||||
virtual void startDrawing(std::shared_ptr<CoreController>) = 0;
|
virtual void startDrawing(std::shared_ptr<CoreController>) = 0;
|
||||||
virtual bool isDrawing() const = 0;
|
virtual bool isDrawing() const = 0;
|
||||||
virtual bool supportsShaders() const = 0;
|
virtual bool supportsShaders() const = 0;
|
||||||
|
|
|
@ -961,20 +961,10 @@ void Window::reloadDisplayDriver() {
|
||||||
m_screenWidget->unsetCursor();
|
m_screenWidget->unsetCursor();
|
||||||
});
|
});
|
||||||
|
|
||||||
const mCoreOptions* opts = m_config->options();
|
m_display->configure(m_config);
|
||||||
m_display->lockAspectRatio(opts->lockAspectRatio);
|
|
||||||
m_display->lockIntegerScaling(opts->lockIntegerScaling);
|
|
||||||
m_display->interframeBlending(opts->interframeBlending);
|
|
||||||
m_display->filter(opts->resampleVideo);
|
|
||||||
m_config->updateOption("showOSD");
|
|
||||||
#if defined(BUILD_GL) || defined(BUILD_GLES2)
|
#if defined(BUILD_GL) || defined(BUILD_GLES2)
|
||||||
if (opts->shader) {
|
if (m_shaderView) {
|
||||||
struct VDir* shader = VDirOpen(opts->shader);
|
m_shaderView->refreshShaders();
|
||||||
if (shader && m_display->supportsShaders()) {
|
|
||||||
m_display->setShaders(shader);
|
|
||||||
m_shaderView->refreshShaders();
|
|
||||||
shader->close(shader);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue