From 51e2a64ed9360c8e889726c3fbaf649a4d260e0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Tue, 16 Mar 2021 17:22:28 +0100 Subject: Parse QT_SCREEN_SCALE_FACTORS spec only once MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move parsing to initHighDpiScaling() and store the parsed factors in a vector. The factors are later applied in updateHighDpiScaling() where the factor list is compared to the screen list. Change-Id: I59fc67b84932dbe69868a3683686a91e51333104 Reviewed-by: Tor Arne Vestbø --- src/gui/kernel/qhighdpiscaling_p.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/gui/kernel/qhighdpiscaling_p.h') diff --git a/src/gui/kernel/qhighdpiscaling_p.h b/src/gui/kernel/qhighdpiscaling_p.h index 3e7ba2f5e1..8460b3ec2e 100644 --- a/src/gui/kernel/qhighdpiscaling_p.h +++ b/src/gui/kernel/qhighdpiscaling_p.h @@ -126,11 +126,19 @@ public: static QDpi logicalDpi(const QScreen *screen); private: + struct ScreenFactor { + ScreenFactor(QString name, qreal factor) + :name(name), factor(factor) { } + QString name; + qreal factor; + }; + static qreal rawScaleFactor(const QPlatformScreen *screen); static qreal roundScaleFactor(qreal rawFactor); static QDpi effectiveLogicalDpi(const QPlatformScreen *screen, qreal rawFactor, qreal roundedFactor); static qreal screenSubfactor(const QPlatformScreen *screen); static QScreen *screenForPosition(Point position, QScreen *guess); + static QVector parseScreenScaleFactorsSpec(const QStringView &screenScaleFactors); static qreal m_factor; static bool m_active; @@ -139,7 +147,7 @@ private: static bool m_globalScalingActive; static bool m_screenFactorSet; static bool m_usePhysicalDpi; - static QString m_screenFactorsSpec; + static QVector m_screenFactors; static DpiAdjustmentPolicy m_dpiAdjustmentPolicy; static QHash m_namedScreenScaleFactors; }; -- cgit v1.2.3