diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2021-07-20 13:24:07 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-07-20 20:13:28 +0000 |
commit | 0d9b37493fd209a085dacbf8557cc348c4edee75 (patch) | |
tree | 55295f5c45b4f3aa42f2a21c01dccf28ae5976b4 /src | |
parent | 6774992368b83394bd8685dc4b243c106a2505a6 (diff) |
Scale image with MDI icons using the correction factor
The buffer might be large than needed and contain a lot of uninitialized
pixels. Scaling it down to the requested size is wrong, we need to scale
it by the correction factor.
Amends e56b8e1e59b6df7c7abd48b163abe6846849eb7a.
As a drive-by, make the correction factor helper function static.
Fixes: QTBUG-94733
Change-Id: Ia5be2a77459321e30485d330b49cf57fdbb664d2
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 5d7a58ea45ed834655220e05012ff17ac235131a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/styles/windowsvista/qwindowsxpstyle.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp index e9df7a1e8c..000c27e685 100644 --- a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp +++ b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp @@ -997,7 +997,7 @@ bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa #endif img = QImage(bufferPixels, bufferW, bufferH, format); if (hasCorrectionFactor) - img = img.scaled(w, h, Qt::KeepAspectRatio, Qt::SmoothTransformation); + img = img.scaled(img.size() * correctionFactor, Qt::KeepAspectRatio, Qt::SmoothTransformation); img.setDevicePixelRatio(additionalDevicePixelRatio); } @@ -2293,7 +2293,7 @@ static void populateMdiButtonTheme(const QStyle *proxy, const QWidget *widget, // Calculate an small (max 2), empirical correction factor for scaling up // WP_MDICLOSEBUTTON, WP_MDIRESTOREBUTTON, WP_MDIMINBUTTON, which are too // small on High DPI screens (QTBUG-75927). -qreal mdiButtonCorrectionFactor(XPThemeData &theme, const QPaintDevice *pd = nullptr) +static qreal mdiButtonCorrectionFactor(XPThemeData &theme, const QPaintDevice *pd = nullptr) { const auto dpr = pd ? pd->devicePixelRatio() : qApp->devicePixelRatio(); const QSizeF nativeSize = QSizeF(theme.size()) / dpr; |