Fix wxDC::Clear

When complex transformation (including e.g. rotation) is applied to DC then coordinates of the clip box return by GetClipBox() API can be inaccurate due to the rounding errors.
To compensate these errors we need to fill rectangle which is slightly larger then just retrieved clip box.

Closes #17636.
This commit is contained in:
Artur Wieczorek
2016-08-21 21:22:05 +02:00
parent 12eaa61930
commit acc57fccc7
2 changed files with 5 additions and 0 deletions

View File

@@ -122,6 +122,7 @@ wxMSW:
- Revert to using equally-sized buttons in wxToolBar by default.
- Restore dispatching wxThreadEvent while resizing the window broken in 3.1.0.
- Fix wxGraphicsMatrix::TransformDistance for Direct2D renderer.
- Fix wxDC::Clear() for rotated DC.
wxOSX:

View File

@@ -722,6 +722,10 @@ void wxMSWDCImpl::Clear()
HBRUSH brush = ::CreateSolidBrush(colour);
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);