Increase usable scrolling range in wxMSW by a factor of 10,000

Using GDI functions for the device origin translation limits the
scrolling range to 2^27 size of the device space in the controls using
PrepareDC(), as it works by adjusting the device origin, and this may be
too small when having many (millions) of rows, which is perfectly
possible with wxDataViewCtrl or wxGrid, for example.

So handle DC device origin translations ourselves in wxMSW, i.e. offset
the coordinates by device origin before passing them to the native
functions as this allows to use the full 32-bit range.

Closes #17550.
This commit is contained in:
Vadim Zeitlin
2022-05-02 02:51:42 +01:00
parent c6e45280d7
commit 4f9186f1a1
2 changed files with 97 additions and 38 deletions
+88 -37
View File
File diff suppressed because it is too large Load Diff
+9 -1
View File
@@ -103,8 +103,16 @@ protected:
// adjusted for the given wxDC.
static RECT ConvertToRECT(wxDC& dc, const wxRect& rect)
{
// Theme API doesn't know anything about GDI+ transforms, so apply them
// manually.
wxRect rectDevice = dc.GetImpl()->MSWApplyGDIPlusTransform(rect);
// We also need to handle the origin offset manually as we don't use
// Windows support for this, see wxDC code.
rectDevice.Offset(dc.GetDeviceOrigin());
RECT rc;
wxCopyRectToRECT(dc.GetImpl()->MSWApplyGDIPlusTransform(rect), rc);
wxCopyRectToRECT(rectDevice, rc);
return rc;
}
};