summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMorten Sørvig <morten.sorvig@qt.io>2022-06-09 12:48:17 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-06-15 06:58:00 +0000
commitdf1beb422aa3b773a3b07c56bd9857474e1d2f28 (patch)
treef134c1d47e75f724547fce6aaed4933e5cb151b7 /tests
parentb623835dd98807bea056520e3d2eb3513e6f458a (diff)
Add support for painting at integer DPR with downscale
Enable by setting QT_WIDGETS_HIGHDPI_DOWNSCALE=1 and QT_WIDGETS_RHI=1. This will make the backing store and painter operate at the next highest integer DPR in cases where QWindow::devicePixelRatio() returns a fractional value. The backing store image will then be downscaled to the target DPR at flush time, using the RHI flush pipeline. [ChangeLog][QWidgets] Added experimental support for always painting at an integer device pixel ratio (rounding the DPR up if necessary), followed by a downscale to the target DPR.Enable by setting QT_WIDGETS_HIGHDPI_DOWNSCALE=1 and QT_WIDGETS_RHI=1. Task-number: QTBUG-86344 Change-Id: Id5b834a0e3499818b0b656161f5e0c38a6caa340 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit 79bead6c3b507331614dcc3c789e18438bc10395) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/manual/highdpi/dprgadget/main.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/manual/highdpi/dprgadget/main.cpp b/tests/manual/highdpi/dprgadget/main.cpp
index 78189e8a39..9da74b4893 100644
--- a/tests/manual/highdpi/dprgadget/main.cpp
+++ b/tests/manual/highdpi/dprgadget/main.cpp
@@ -22,6 +22,7 @@ bool g_qtScaleFactor = false;
bool g_qtUsePhysicalDpi = false;
bool g_qtFontDpi = false;
bool g_qtScaleFactorRoundingPolicy = false;
+bool g_qtHighDpiDownscale = false;
bool g_displayEvents = false;
@@ -136,7 +137,7 @@ public:
if (g_displayEvents)
layout->addWidget(eventsLabel);
- bool activeEnvironment = g_qtScaleFactor || g_qtUsePhysicalDpi || g_qtFontDpi || g_qtScaleFactorRoundingPolicy;
+ bool activeEnvironment = g_qtScaleFactor || g_qtUsePhysicalDpi || g_qtFontDpi || g_qtScaleFactorRoundingPolicy || g_qtHighDpiDownscale;
if (activeEnvironment) {
layout->addWidget(new QLabel("Active Environment:"));
if (g_qtScaleFactor) {
@@ -155,7 +156,10 @@ public:
QString text = QString("QT_SCALE_FACTOR_ROUNDING_POLICY=") + qgetenv("QT_SCALE_FACTOR_ROUNDING_POLICY");
layout->addWidget(new QLabel(text));
}
-
+ if (g_qtHighDpiDownscale) {
+ QString text = QString("QT_WIDGETS_HIGHDPI_DOWNSCALE=") + qgetenv("QT_WIDGETS_HIGHDPI_DOWNSCALE");
+ layout->addWidget(new QLabel(text));
+ }
}
auto updateValues = [=]() {
@@ -244,6 +248,7 @@ int main(int argc, char **argv) {
g_qtUsePhysicalDpi = qgetenv("QT_USE_PHYSICAL_DPI") == QByteArray("1");
g_qtFontDpi = qEnvironmentVariableIsSet("QT_FONT_DPI");
g_qtScaleFactorRoundingPolicy = qEnvironmentVariableIsSet("QT_SCALE_FACTOR_ROUNDING_POLICY");
+ g_qtHighDpiDownscale = qEnvironmentVariableIsSet("QT_WIDGETS_HIGHDPI_DOWNSCALE");
QApplication app(argc, argv);