Fix wrongly restoring clipping region in wxDCClipper

The change of 2a8c290e0d was wrong as it
unconditionally restored m_oldClipRect in dtor, even when it was empty,
indicating that no clipping had been in effect when wxDCClipper was
constructed. This totally broke all the code using wxDCClipper, notably
generic wxListCtrl which wasn't repainted correctly at all.

Fix this by checking if the clipping rectangle is not empty before
restoring it, this should work as well as we can make it without having
GetClippingRegion() that could return an invalid region if no clipping
is in effect.

See #13834.

Closes #18066.
This commit is contained in:
Vadim Zeitlin 2018-01-29 15:36:21 +01:00
parent 84c3bc123e
commit 72790218cb

View File

@ -1454,7 +1454,8 @@ public:
~wxDCClipper()
{
m_dc.DestroyClippingRegion();
m_dc.SetClippingRegion(m_oldClipRect);
if ( !m_oldClipRect.IsEmpty() )
m_dc.SetClippingRegion(m_oldClipRect);
}
private: