Qt, OpenGL: Disable integer scaling for dimensions that don't fit

This commit is contained in:
Vicki Pfau 2019-09-16 22:04:40 -07:00
parent 3920c6191f
commit 29fc787fc9
5 changed files with 25 additions and 8 deletions

View File

@ -87,6 +87,7 @@ Misc:
- 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:

View File

@ -88,8 +88,12 @@ static void mGLContextResized(struct VideoBackend* v, unsigned w, unsigned h) {
}
}
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();

View File

@ -201,8 +201,12 @@ static void mGLES2ContextResized(struct VideoBackend* v, unsigned w, unsigned h)
}
}
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);

View File

@ -106,8 +106,12 @@ void DisplayQt::paintEvent(QPaintEvent*) {
}
}
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);

View File

@ -1962,8 +1962,12 @@ void WindowBackground::paintEvent(QPaintEvent* event) {
}
}
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);