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 e56b8e1e59
.
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>
This commit is contained in:
parent
d9f80502f6
commit
5d7a58ea45
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user