summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-03-18 15:44:21 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-20 11:50:39 +0100
commit61b2bfac4566061ee425fb5983b2b9504ccc7b80 (patch)
treed30546dbe2b315be101278a0c4622546f18cd7ef /src/core
parentca417f2aa2a8264f8818bf8dd2df98981b21867b (diff)
Fix the HighDPI rendering of QQuickWebEngineView
Use the ratio given with the compositor frame instead of taking it directly from the QWindow to make sure that we scale according to the rasterizing of the tiles. Set the scale directly on the DelegatedFrameNode by making it a QSGTransformNode to avoid creating an extra QSGNode. Change-Id: I95bd33c7c6d26e0d456d6df188779dc4e82f9d3b Reviewed-by: Arvid Nilsson <anilsson@blackberry.com> Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/delegated_frame_node.cpp9
-rw-r--r--src/core/delegated_frame_node.h4
-rw-r--r--src/core/render_widget_host_view_qt.cpp1
3 files changed, 12 insertions, 2 deletions
diff --git a/src/core/delegated_frame_node.cpp b/src/core/delegated_frame_node.cpp
index d704bf234..2cfcd4afe 100644
--- a/src/core/delegated_frame_node.cpp
+++ b/src/core/delegated_frame_node.cpp
@@ -332,6 +332,13 @@ void DelegatedFrameNode::commit(DelegatedFrameNodeData* data, cc::ReturnedResour
if (!frameData)
return;
+ // DelegatedFrameNode is a transform node only for the purpose of
+ // countering the scale of devicePixel-scaled tiles when rendering them
+ // to the final surface.
+ QMatrix4x4 matrix;
+ matrix.scale(1 / m_data->frameDevicePixelRatio, 1 / m_data->frameDevicePixelRatio);
+ setMatrix(matrix);
+
// Keep the old texture lists around to find the ones we can re-use.
QList<QSharedPointer<RenderPassTexture> > oldRenderPassTextures;
m_renderPassTextures.swap(oldRenderPassTextures);
@@ -368,7 +375,7 @@ void DelegatedFrameNode::commit(DelegatedFrameNodeData* data, cc::ReturnedResour
rpTexture = QSharedPointer<RenderPassTexture>(new RenderPassTexture(pass->id, sgrc));
}
m_renderPassTextures.append(rpTexture);
- rpTexture->setDevicePixelRatio(m_window->devicePixelRatio());
+ rpTexture->setDevicePixelRatio(m_data->frameDevicePixelRatio);
rpTexture->setRect(toQt(pass->output_rect));
rpTexture->setFormat(pass->has_transparent_background ? GL_RGBA : GL_RGB);
renderPassParent = rpTexture->rootNode();
diff --git a/src/core/delegated_frame_node.h b/src/core/delegated_frame_node.h
index 842f53011..71a3e1d25 100644
--- a/src/core/delegated_frame_node.h
+++ b/src/core/delegated_frame_node.h
@@ -65,11 +65,13 @@ class RenderPassTexture;
// and render pass information.
class DelegatedFrameNodeData : public QSharedData {
public:
+ DelegatedFrameNodeData() : frameDevicePixelRatio(1) { }
QHash<unsigned, QSharedPointer<MailboxTexture> > mailboxTextures;
scoped_ptr<cc::DelegatedFrameData> frameData;
+ qreal frameDevicePixelRatio;
};
-class DelegatedFrameNode : public QSGNode {
+class DelegatedFrameNode : public QSGTransformNode {
public:
DelegatedFrameNode(QQuickWindow *window);
~DelegatedFrameNode();
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp
index d9822769c..dc2e1c155 100644
--- a/src/core/render_widget_host_view_qt.cpp
+++ b/src/core/render_widget_host_view_qt.cpp
@@ -599,6 +599,7 @@ void RenderWidgetHostViewQt::OnSwapCompositorFrame(uint32 output_surface_id, sco
Q_ASSERT(frame->delegated_frame_data);
Q_ASSERT(!m_frameNodeData->frameData || m_frameNodeData->frameData->resource_list.empty());
m_frameNodeData->frameData = frame->delegated_frame_data.Pass();
+ m_frameNodeData->frameDevicePixelRatio = frame->metadata.device_scale_factor;
m_delegate->update();
}