Qt: Fix HiDPI scaling on non-software renderers

This commit is contained in:
Cacodemon345
2025-03-30 21:03:46 +06:00
parent 512154e4a8
commit 8f94ccec80
6 changed files with 35 additions and 27 deletions

View File

@@ -37,7 +37,7 @@ void
HardwareRenderer::resizeGL(int w, int h)
{
m_context->makeCurrent(this);
glViewport(0, 0, qRound(w * devicePixelRatio()), qRound(h * devicePixelRatio()));
glViewport(0, 0, qRound(w * devicePixelRatioF()), qRound(h * devicePixelRatioF()));
}
#define PROGRAM_VERTEX_ATTRIBUTE 0
@@ -220,14 +220,17 @@ HardwareRenderer::onBlit(int buf_idx, int x, int y, int w, int h)
#endif
buf_usage[buf_idx].clear();
source.setRect(x, y, w, h);
if (origSource != source)
if (origSource != source) {
this->pixelRatio = devicePixelRatioF();
onResize(this->width(), this->height());
}
update();
}
void
HardwareRenderer::resizeEvent(QResizeEvent *event)
{
this->pixelRatio = devicePixelRatioF();
onResize(width(), height());
QOpenGLWindow::resizeEvent(event);