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 <allan.jensen@qt.io>
This commit is contained in:
Friedemann Kleint 2017-05-05 12:44:35 +02:00
parent 61ea8f243e
commit b04b4ae4f6

View File

@ -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.