diff options
author | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-09-11 13:20:07 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-09-15 18:57:54 +0200 |
commit | 75ae4dacbc79fd70bf9f2fc7ed2b59ff2e00a0f6 (patch) | |
tree | c48baf68f0993aae1c575f7d9008e1d859c0fff1 /src/gui/kernel/qopenglwindow.cpp | |
parent | bde9387dba244a2bf5324fa22bc5f64f1f0714ea (diff) |
Fix high dpi support in QOpenGLWindow
Change-Id: I0be29fb25d854e09ae961cade0c8490586788394
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'src/gui/kernel/qopenglwindow.cpp')
-rw-r--r-- | src/gui/kernel/qopenglwindow.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gui/kernel/qopenglwindow.cpp b/src/gui/kernel/qopenglwindow.cpp index c09cd186a6..a0261c2f04 100644 --- a/src/gui/kernel/qopenglwindow.cpp +++ b/src/gui/kernel/qopenglwindow.cpp @@ -220,7 +220,7 @@ public: } if (updateBehavior > QOpenGLWindow::NoPartialUpdate) { - if (!fbo || fbo->size() != q->size()) { + if (!fbo || fbo->size() != q->size() * q->devicePixelRatio()) { QOpenGLFramebufferObjectFormat fboFormat; fboFormat.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil); if (q->requestedFormat().samples() > 0) { @@ -229,7 +229,7 @@ public: else qWarning("QOpenGLWindow: PartialUpdateBlend does not support multisampling"); } - fbo.reset(new QOpenGLFramebufferObject(q->size(), fboFormat)); + fbo.reset(new QOpenGLFramebufferObject(q->size() * q->devicePixelRatio(), fboFormat)); markWindowAsDirty(); } } else { @@ -239,6 +239,7 @@ public: const int deviceWidth = q->width() * q->devicePixelRatio(); const int deviceHeight = q->height() * q->devicePixelRatio(); paintDevice->setSize(QSize(deviceWidth, deviceHeight)); + paintDevice->setDevicePixelRatio(q->devicePixelRatio()); context->functions()->glViewport(0, 0, deviceWidth, deviceHeight); context->functions()->glBindFramebuffer(GL_FRAMEBUFFER, context->defaultFramebufferObject()); @@ -273,7 +274,7 @@ public: if (!blitter.isCreated()) blitter.create(); - QRect windowRect(QPoint(0, 0), q->size()); + QRect windowRect(QPoint(0, 0), fbo->size()); QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(windowRect, windowRect); blitter.bind(); blitter.blit(fbo->texture(), target, QOpenGLTextureBlitter::OriginBottomLeft); |