Use the actual brush for clearing wxDC in wxMSW

Instead of creating a temporary brush with the same colour as the
background brush, just use the background brush itself directly.

This allows clearing the window with non-solid brushes too, including
transparent ones -- even though the latter doesn't make much sense (as
it simply does nothing), it should still behave in the same way under
MSW as under the other platforms, while previously it cleared the window
using the solid black brush instead.

Closes #10273.
This commit is contained in:
Vadim Zeitlin
2019-08-05 02:39:46 +02:00
parent eca1e857fe
commit 848f5e78a6

View File

@@ -729,16 +729,16 @@ void wxMSWDCImpl::Clear()
return;
}
DWORD colour = ::GetBkColor(GetHdc());
HBRUSH brush = ::CreateSolidBrush(colour);
if ( !m_backgroundBrush.IsOk() )
return;
RECT rect;
::GetClipBox(GetHdc(), &rect);
// Inflate the box by 1 unit in each direction
// to compensate rounding errors if DC is the subject
// of complex transformation (is e.g. rotated).
::InflateRect(&rect, 1, 1);
::FillRect(GetHdc(), &rect, brush);
::DeleteObject(brush);
::FillRect(GetHdc(), &rect, GetHbrushOf(m_backgroundBrush));
RealizeScaleAndOrigin();
}