Fix flickering when resizing emulator window
Jeffrey Pfau jeffrey@endrift.com
Wed, 15 Oct 2014 02:28:32 -0700
2 files changed,
7 insertions(+),
2 deletions(-)
M
src/platform/qt/Display.cpp
→
src/platform/qt/Display.cpp
@@ -64,7 +64,7 @@ }
void Display::resizeEvent(QResizeEvent* event) { if (m_painter) { - m_painter->resize(event->size()); + QMetaObject::invokeMethod(m_painter, "resize", Qt::BlockingQueuedConnection, Q_ARG(QSize, event->size())); } }@@ -86,6 +86,11 @@ }
void Painter::resize(const QSize& size) { m_size = size; + m_gl->makeCurrent(); + glViewport(0, 0, m_size.width() * m_gl->devicePixelRatio(), m_size.height() * m_gl->devicePixelRatio()); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + m_gl->swapBuffers(); + m_gl->doneCurrent(); } void Painter::start() {
M
src/platform/qt/Display.h
→
src/platform/qt/Display.h
@@ -39,12 +39,12 @@
void setContext(GBAThread*); void setBacking(const uint32_t*); void setGLContext(QGLWidget*); - void resize(const QSize& size); public slots: void draw(); void start(); void stop(); + void resize(const QSize& size); private: QTimer* m_drawTimer;