diff --git a/src/platform/qt/Display.h b/src/platform/qt/Display.h index 85e799c9e..d5f3e1943 100644 --- a/src/platform/qt/Display.h +++ b/src/platform/qt/Display.h @@ -26,6 +26,7 @@ public slots: virtual void forceDraw() = 0; virtual void lockAspectRatio(bool lock) = 0; virtual void filter(bool filter) = 0; + virtual void framePosted(const uint32_t*) = 0; }; } diff --git a/src/platform/qt/DisplayGL.h b/src/platform/qt/DisplayGL.h index d247c8de0..5e2643695 100644 --- a/src/platform/qt/DisplayGL.h +++ b/src/platform/qt/DisplayGL.h @@ -24,13 +24,14 @@ public: DisplayGL(const QGLFormat& format, QWidget* parent = nullptr); public slots: - void startDrawing(const uint32_t* buffer, GBAThread* context); - void stopDrawing(); - void pauseDrawing(); - void unpauseDrawing(); - void forceDraw(); - void lockAspectRatio(bool lock); - void filter(bool filter); + void startDrawing(const uint32_t* buffer, GBAThread* context) override; + void stopDrawing() override; + void pauseDrawing() override; + void unpauseDrawing() override; + void forceDraw() override; + void lockAspectRatio(bool lock) override; + void filter(bool filter) override; + void framePosted(const uint32_t*) override {} protected: virtual void paintEvent(QPaintEvent*) override {}; diff --git a/src/platform/qt/DisplayQt.cpp b/src/platform/qt/DisplayQt.cpp index 34c43bda6..738632e9a 100644 --- a/src/platform/qt/DisplayQt.cpp +++ b/src/platform/qt/DisplayQt.cpp @@ -14,8 +14,6 @@ DisplayQt::DisplayQt(QWidget* parent) , m_lockAspectRatio(false) , m_filter(false) { - connect(&m_drawTimer, SIGNAL(timeout()), this, SLOT(update())); - m_drawTimer.setInterval(12); // Give update time roughly 4.6ms of clearance } void DisplayQt::startDrawing(const uint32_t* buffer, GBAThread* context) { @@ -29,23 +27,6 @@ void DisplayQt::startDrawing(const uint32_t* buffer, GBAThread* context) { #else m_backing = QImage(reinterpret_cast(buffer), 256, 256, QImage::Format_RGB32); #endif - m_drawTimer.start(); -} - -void DisplayQt::stopDrawing() { - m_drawTimer.stop(); -} - -void DisplayQt::pauseDrawing() { - m_drawTimer.stop(); -} - -void DisplayQt::unpauseDrawing() { - m_drawTimer.start(); -} - -void DisplayQt::forceDraw() { - update(); } void DisplayQt::lockAspectRatio(bool lock) { diff --git a/src/platform/qt/DisplayQt.h b/src/platform/qt/DisplayQt.h index 8476861f1..bb9ba4759 100644 --- a/src/platform/qt/DisplayQt.h +++ b/src/platform/qt/DisplayQt.h @@ -22,19 +22,19 @@ public: DisplayQt(QWidget* parent = nullptr); public slots: - void startDrawing(const uint32_t* buffer, GBAThread* context); - void stopDrawing(); - void pauseDrawing(); - void unpauseDrawing(); - void forceDraw(); - void lockAspectRatio(bool lock); - void filter(bool filter); + void startDrawing(const uint32_t* buffer, GBAThread* context) override; + void stopDrawing() override {} + void pauseDrawing() override {} + void unpauseDrawing() override {} + void forceDraw() override { update(); } + void lockAspectRatio(bool lock) override; + void filter(bool filter) override; + void framePosted(const uint32_t*) override { update(); } protected: virtual void paintEvent(QPaintEvent*) override; private: - QTimer m_drawTimer; GBAThread* m_context; QImage m_backing; bool m_lockAspectRatio; diff --git a/src/platform/qt/Window.cpp b/src/platform/qt/Window.cpp index 1f8b6c17f..aae79c3de 100644 --- a/src/platform/qt/Window.cpp +++ b/src/platform/qt/Window.cpp @@ -102,6 +102,7 @@ Window::Window(ConfigController* config, int playerId, QWidget* parent) connect(m_controller, SIGNAL(gameUnpaused(GBAThread*)), m_display, SLOT(unpauseDrawing())); connect(m_controller, SIGNAL(postLog(int, const QString&)), m_logView, SLOT(postLog(int, const QString&))); connect(m_controller, SIGNAL(frameAvailable(const uint32_t*)), this, SLOT(recordFrame())); + connect(m_controller, SIGNAL(frameAvailable(const uint32_t*)), m_display, SLOT(framePosted(const uint32_t*))); connect(m_controller, SIGNAL(gameCrashed(const QString&)), this, SLOT(gameCrashed(const QString&))); connect(m_controller, SIGNAL(gameFailed()), this, SLOT(gameFailed())); connect(m_controller, SIGNAL(unimplementedBiosCall(int)), this, SLOT(unimplementedBiosCall(int)));