Fix flickering when resizing emulator window

This commit is contained in:
Jeffrey Pfau 2014-10-15 02:28:32 -07:00
parent 113d7da345
commit 1ef3f4256f
2 changed files with 7 additions and 2 deletions

View File

@ -64,7 +64,7 @@ void Display::initializeGL() {
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::setGLContext(QGLWidget* context) {
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() {

View File

@ -39,12 +39,12 @@ public:
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;