From af30f6492bedb0d24a2d5b518e4e01f000852520 Mon Sep 17 00:00:00 2001 From: Andy Nichols Date: Tue, 6 Jan 2015 16:49:34 +0100 Subject: Account for Device Pixel Ratio when rendering QSGLayer Change-Id: I3570a6ee87786f1459a922bd43f38d1bbbe2c640 Reviewed-by: Simon Hausmann Reviewed-by: Paul Tvete --- src/plugins/scenegraph/softwarecontext/context.cpp | 1 - src/plugins/scenegraph/softwarecontext/softwarelayer.cpp | 9 +++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/scenegraph/softwarecontext/context.cpp b/src/plugins/scenegraph/softwarecontext/context.cpp index dafbfdaae9..f107290f62 100644 --- a/src/plugins/scenegraph/softwarecontext/context.cpp +++ b/src/plugins/scenegraph/softwarecontext/context.cpp @@ -143,7 +143,6 @@ void PixmapRenderer::render() void PixmapRenderer::render(QPixmap *target) { - const QRect rect(0, 0, target->width(), target->height()); target->fill(clearColor()); QPainter painter(target); painter.setRenderHint(QPainter::Antialiasing); diff --git a/src/plugins/scenegraph/softwarecontext/softwarelayer.cpp b/src/plugins/scenegraph/softwarecontext/softwarelayer.cpp index 61f5aa031f..059278c547 100644 --- a/src/plugins/scenegraph/softwarecontext/softwarelayer.cpp +++ b/src/plugins/scenegraph/softwarecontext/softwarelayer.cpp @@ -185,8 +185,10 @@ void SoftwareLayer::grab() m_renderer->setDevicePixelRatio(m_device_pixel_ratio); m_renderer->setRootNode(static_cast(root)); - if (m_pixmap.size() != m_size) + if (m_pixmap.size() != m_size) { m_pixmap = QPixmap(m_size); + m_pixmap.setDevicePixelRatio(m_device_pixel_ratio); + } // Render texture. root->markDirty(QSGNode::DirtyForceUpdate); // Force matrix, clip and opacity update. @@ -196,7 +198,10 @@ void SoftwareLayer::grab() m_renderer->setDeviceRect(m_size); m_renderer->setViewportRect(m_size); - m_renderer->m_projectionRect = m_rect.toRect(); + m_renderer->m_projectionRect = QRect(m_rect.x() * m_device_pixel_ratio, + m_rect.y() * m_device_pixel_ratio, + m_rect.width() * m_device_pixel_ratio, + m_rect.height() * m_device_pixel_ratio); m_renderer->setClearColor(Qt::transparent); m_renderer->renderScene(); -- cgit v1.2.3