all repos — mgba @ 1baa9287f34855f9eaceab89eb7703cb928f5599

mGBA Game Boy Advance Emulator

Qt: Reduce flickering by resizing less often
Vicki Pfau vi@endrift.com
Tue, 14 May 2019 18:04:51 -0700
commit

1baa9287f34855f9eaceab89eb7703cb928f5599

parent

24929909f28df24461e62f36e80f0a60675facd3

1 files changed, 8 insertions(+), 12 deletions(-)

jump to
M src/platform/qt/DisplayGL.cppsrc/platform/qt/DisplayGL.cpp

@@ -316,6 +316,12 @@ }

void PainterGL::resize(const QSize& size) { m_size = size; +#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) + float r = m_gl->devicePixelRatioF(); +#else + float r = m_gl->devicePixelRatio(); +#endif + m_backend->resized(m_backend, m_size.width() * r, m_size.height() * r); if (m_started && !m_active) { forceDraw(); }

@@ -323,16 +329,12 @@ }

void PainterGL::lockAspectRatio(bool lock) { m_backend->lockAspectRatio = lock; - if (m_started && !m_active) { - forceDraw(); - } + resize(m_size); } void PainterGL::lockIntegerScaling(bool lock) { m_backend->lockIntegerScaling = lock; - if (m_started && !m_active) { - forceDraw(); - } + resize(m_size); } void PainterGL::filter(bool filter) {

@@ -416,12 +418,6 @@ }

void PainterGL::performDraw() { m_painter.beginNativePainting(); -#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) - float r = m_gl->devicePixelRatioF(); -#else - float r = m_gl->devicePixelRatio(); -#endif - m_backend->resized(m_backend, m_size.width() * r, m_size.height() * r); m_backend->drawFrame(m_backend); m_painter.endNativePainting(); if (m_messagePainter) {