Windows: Store only full-size DC's obtained by BeginPaint.
Avoid painting bugs in case the DC covers only a part of the window and QBackingStore does a full flush. Task-number: QTBUG-26039 Change-Id: Ic918d9898ac824690273ac59bcb1e7e546cc698a Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
This commit is contained in:
parent
6b95e54f1f
commit
d728bfe793
@ -989,7 +989,7 @@ HDC QWindowsWindow::getDC()
|
|||||||
|
|
||||||
void QWindowsWindow::releaseDC()
|
void QWindowsWindow::releaseDC()
|
||||||
{
|
{
|
||||||
if (m_hdc && !testFlag(WithinWmPaint)) {
|
if (m_hdc && !testFlag(DCFromBeginPaint)) {
|
||||||
ReleaseDC(handle(), m_hdc);
|
ReleaseDC(handle(), m_hdc);
|
||||||
m_hdc = 0;
|
m_hdc = 0;
|
||||||
}
|
}
|
||||||
@ -1013,17 +1013,22 @@ bool QWindowsWindow::handleWmPaint(HWND hwnd, UINT message,
|
|||||||
QRegion(qrectFromRECT(ps.rcPaint)));
|
QRegion(qrectFromRECT(ps.rcPaint)));
|
||||||
EndPaint(hwnd, &ps);
|
EndPaint(hwnd, &ps);
|
||||||
} else {
|
} else {
|
||||||
releaseDC();
|
const HDC dc = BeginPaint(hwnd, &ps);
|
||||||
m_hdc = BeginPaint(hwnd, &ps);
|
|
||||||
setFlag(WithinWmPaint);
|
|
||||||
|
|
||||||
const QRect updateRect = qrectFromRECT(ps.rcPaint);
|
const QRect updateRect = qrectFromRECT(ps.rcPaint);
|
||||||
|
if (updateRect.size() == m_data.geometry.size()) {
|
||||||
|
// Store DC for access by the backing store if it has the full size.
|
||||||
|
releaseDC();
|
||||||
|
setFlag(DCFromBeginPaint);
|
||||||
|
m_hdc = dc;
|
||||||
|
}
|
||||||
if (QWindowsContext::verboseIntegration)
|
if (QWindowsContext::verboseIntegration)
|
||||||
qDebug() << __FUNCTION__ << this << window() << updateRect;
|
qDebug() << __FUNCTION__ << this << window() << updateRect;
|
||||||
|
|
||||||
QWindowSystemInterface::handleSynchronousExposeEvent(window(), QRegion(updateRect));
|
QWindowSystemInterface::handleSynchronousExposeEvent(window(), QRegion(updateRect));
|
||||||
clearFlag(WithinWmPaint);
|
if (testFlag(DCFromBeginPaint)) {
|
||||||
m_hdc = 0;
|
clearFlag(DCFromBeginPaint);
|
||||||
|
m_hdc = 0;
|
||||||
|
}
|
||||||
EndPaint(hwnd, &ps);
|
EndPaint(hwnd, &ps);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -116,7 +116,7 @@ public:
|
|||||||
|
|
||||||
enum Flags
|
enum Flags
|
||||||
{
|
{
|
||||||
WithinWmPaint = 0x1,
|
DCFromBeginPaint = 0x1,
|
||||||
WithinSetParent = 0x2,
|
WithinSetParent = 0x2,
|
||||||
FrameDirty = 0x4, //! Frame outdated by setStyle, recalculate in next query.
|
FrameDirty = 0x4, //! Frame outdated by setStyle, recalculate in next query.
|
||||||
OpenGLSurface = 0x10,
|
OpenGLSurface = 0x10,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user