Qt, OpenGL: Disable integer scaling for dimensions that don't fit
Vicki Pfau vi@endrift.com
Mon, 16 Sep 2019 22:04:40 -0700
5 files changed,
25 insertions(+),
8 deletions(-)
M
CHANGES
→
CHANGES
@@ -87,6 +87,7 @@ - Qt: Add option to pause on minimizing window (closes mgba.io/i/1379)
- Switch: Support file associations - Qt: Show error message if file failed to load - Qt: Scale pixel color values to full range (fixes mgba.io/i/1511) + - Qt, OpenGL: Disable integer scaling for dimensions that don't fit 0.7.2: (2019-05-25) Emulation fixes:
M
src/platform/opengl/gl.c
→
src/platform/opengl/gl.c
@@ -88,8 +88,12 @@ drawH = w * v->height / v->width;
} } if (v->lockIntegerScaling) { - drawW -= drawW % v->width; - drawH -= drawH % v->height; + if (drawW >= v->width) { + drawW -= drawW % v->width; + } + if (drawH >= v->height) { + drawH -= drawH % v->height; + } } glMatrixMode(GL_MODELVIEW); glLoadIdentity();
M
src/platform/opengl/gles2.c
→
src/platform/opengl/gles2.c
@@ -201,8 +201,12 @@ drawH = w * v->height / v->width;
} } if (v->lockIntegerScaling) { - drawW -= drawW % v->width; - drawH -= drawH % v->height; + if (drawW >= v->width) { + drawW -= drawW % v->width; + } + if (drawH >= v->height) { + drawH -= drawH % v->height; + } } glBindFramebuffer(GL_FRAMEBUFFER, 0); glViewport((w - drawW) / 2, (h - drawH) / 2, drawW, drawH);
M
src/platform/qt/DisplayQt.cpp
→
src/platform/qt/DisplayQt.cpp
@@ -106,8 +106,12 @@ ds.setHeight(s.width() * m_height / m_width);
} } if (isIntegerScalingLocked()) { - ds.setWidth(ds.width() - ds.width() % m_width); - ds.setHeight(ds.height() - ds.height() % m_height); + if (ds.width() >= m_width) { + ds.setWidth(ds.width() - ds.width() % m_width); + } + if (ds.height() >= m_height) { + ds.setHeight(ds.height() - ds.height() % m_height); + } } QPoint origin = QPoint((s.width() - ds.width()) / 2, (s.height() - ds.height()) / 2); QRect full(origin, ds);
M
src/platform/qt/Window.cpp
→
src/platform/qt/Window.cpp
@@ -1962,8 +1962,12 @@ ds.setHeight(ds.width() * m_aspectHeight / m_aspectWidth);
} } if (m_lockIntegerScaling) { - ds.setWidth(ds.width() - ds.width() % m_aspectWidth); - ds.setHeight(ds.height() - ds.height() % m_aspectHeight); + if (ds.width() >= m_aspectWidth) { + ds.setWidth(ds.width() - ds.width() % m_aspectWidth); + } + if (ds.height() >= m_aspectHeight) { + ds.setHeight(ds.height() - ds.height() % m_aspectHeight); + } } QPoint origin = QPoint((s.width() - ds.width()) / 2, (s.height() - ds.height()) / 2); QRect full(origin, ds);