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:
@@ -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:
|
||||
|
||||
|
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user