Windows QPA: Call InvalidateRect() for GL windows when Aero is off

Some AMD cards have been reported to not update otherwise.

Task-number: QTBUG-60527
Change-Id: I84d57a57eb2b76fb31255ae42b79b96ab7b257c9
Reviewed-by: Kimmo Leppälä <kimmo.leppala@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
Friedemann Kleint 2017-05-02 13:54:43 +02:00
parent b7da94ce52
commit b97a703613

View File

@ -1616,6 +1616,16 @@ static inline bool dwmIsCompositionEnabled()
return SUCCEEDED(DwmIsCompositionEnabled(&dWmCompositionEnabled)) && dWmCompositionEnabled == TRUE;
}
static inline bool isSoftwareGl()
{
#if QT_CONFIG(dynamicgl)
return QOpenGLStaticContext::opengl32.moduleIsNotOpengl32()
&& QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL;
#else
return false;
#endif // dynamicgl
}
bool QWindowsWindow::handleWmPaint(HWND hwnd, UINT message,
WPARAM, LPARAM)
{
@ -1627,15 +1637,10 @@ bool QWindowsWindow::handleWmPaint(HWND hwnd, UINT message,
return false;
PAINTSTRUCT ps;
#if QT_CONFIG(dynamicgl)
// QTBUG-58178: GL software rendering needs InvalidateRect() to suppress
// artifacts while resizing.
if (testFlag(OpenGLSurface)
&& QOpenGLStaticContext::opengl32.moduleIsNotOpengl32()
&& QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) {
// GL software rendering (QTBUG-58178) and Windows 7/Aero off with some AMD cards
// (QTBUG-60527) need InvalidateRect() to suppress artifacts while resizing.
if (testFlag(OpenGLSurface) && (isSoftwareGl() || !dwmIsCompositionEnabled()))
InvalidateRect(hwnd, 0, false);
}
#endif // dynamicgl
BeginPaint(hwnd, &ps);