From b04b4ae4f618257a01132699df9858cd903f8c87 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 5 May 2017 12:44:35 +0200 Subject: [PATCH] QWindowsXPStyle: Do not draw some opaque theme parts directly Drawing directly using GDI32 can produce colors that are invalid in the premultiplied alpha format which is used for the backing store. Exclude part ids which are known to be opaque. Task-number: QTBUG-60571 Change-Id: I0863d030acf79f317f5e82a5ee954c9cb507c449 Reviewed-by: Allan Sandfeld Jensen --- src/plugins/styles/windowsvista/qwindowsxpstyle.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp index 3f59886f1d..beb8c60e3a 100644 --- a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp +++ b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp @@ -665,6 +665,13 @@ static inline TransformType transformType(const QTransform &transform, qreal dev ? HighDpiScalingTransform : ComplexTransform; } +// QTBUG-60571: Exclude known fully opaque theme parts which produce values +// invalid in ARGB32_Premultiplied (for example, 0x00ffffff). +static inline bool isFullyOpaque(const XPThemeData &themeData) +{ + return themeData.theme == QWindowsXPStylePrivate::TaskDialogTheme && themeData.partId == TDLG_PRIMARYPANEL; +} + /*! \internal Main theme drawing function. Determines the correct lowlevel drawing method depending on several @@ -703,6 +710,7 @@ bool QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData) bool canDrawDirectly = false; if (themeData.widget && painter->opacity() == 1.0 && !themeData.rotate + && !isFullyOpaque(themeData) && tt != ComplexTransform && !themeData.mirrorVertically && !translucentToplevel) { // Draw on backing store DC only for real widgets or backing store images.