diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/delegated_frame_node.cpp | 9 | ||||
-rw-r--r-- | src/core/delegated_frame_node.h | 4 | ||||
-rw-r--r-- | src/core/render_widget_host_view_qt.cpp | 1 |
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(); } |