summaryrefslogtreecommitdiffstats
path: root/src/plugins/styles
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2021-07-20 13:24:07 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2021-07-20 19:34:33 +0200
commit5d7a58ea45ed834655220e05012ff17ac235131a (patch)
treeb4fb880ff7373952607a5373e9719ef17e773752 /src/plugins/styles
parentd9f80502f6450f0bc8e6d7ca13e1c912ad485599 (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 Pick-to: 6.2 6.1 5.15 Change-Id: Ia5be2a77459321e30485d330b49cf57fdbb664d2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/plugins/styles')
-rw-r--r--src/plugins/styles/windowsvista/qwindowsxpstyle.cpp4
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;