From d3330dd40f2904f06dce4b3a40924803e03646e1 Mon Sep 17 00:00:00 2001 From: Andras Becsi <andras.becsi@digia.com> Date: Tue, 23 Sep 2014 17:59:50 +0200 Subject: [PATCH] Fix issues on HiDPI displays This patch fixes widgets rendering on HiDPI displays and notifies about the a potential device pixel ratio change when the window is moved. This addresses the blurriness when a web view is moved between an attached LoDPI screen and HiDPI screen resulting from the device pixel ratio not being updated. Change-Id: I97af0199c07deac8bbe4688c665aaa6df1608ae9 Reviewed-by: Michael Bruning <michael.bruning@digia.com> --- src/core/render_widget_host_view_qt.cpp | 2 ++ .../render_widget_host_view_qt_delegate_widget.cpp | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index 31eb0a9d8..2cc5510ae 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -676,6 +676,8 @@ void RenderWidgetHostViewQt::notifyResize() void RenderWidgetHostViewQt::windowBoundsChanged() { m_host->SendScreenRects(); + if (m_delegate->window()) + m_host->NotifyScreenInfoChanged(); } void RenderWidgetHostViewQt::windowChanged() diff --git a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp index d31af2506..dd14d751e 100644 --- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp +++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp @@ -254,8 +254,9 @@ void RenderWidgetHostViewQtDelegateWidget::paintGL() m_rootNode->appendChildNode(paintNode); } - m_sgRenderer->setDeviceRect(size()); - m_sgRenderer->setViewportRect(size()); + QSize deviceSize = size() * devicePixelRatio(); + m_sgRenderer->setDeviceRect(deviceSize); + m_sgRenderer->setViewportRect(deviceSize); m_sgRenderer->setProjectionMatrixToRect(QRectF(QPointF(), size())); m_sgRenderer->renderScene(defaultFramebufferObject()); -- GitLab