Respect bitmap content scale factor in wxMSW wxMemoryDC

Apply it manually because MSW doesn't do it automatically for us and
also adjust the font size in wxMemoryDC as the base class version only
does it for the device contexts associated with a window, but we also
need to do it when using a wxMemoryDC for a bitmap using scale factor
different from that of the main display.

As the result of these changes, contents drawn on wxMemoryDC, both
directly via its own methods, or via wxGraphicsContext (using either
GDI+ or Direct2D) created from it, it appears the same as in wxWindowDC
(e.g. wxPaintDC) created for a window using the same scale.

Closes #22130.

Closes #22234.
This commit is contained in:
Vadim Zeitlin
2022-03-26 01:38:59 +01:00
parent 74fa410b81
commit 9e5c8a8027
6 changed files with 39 additions and 7 deletions

View File

@@ -22,6 +22,8 @@ public:
wxMemoryDCImpl( wxMemoryDC *owner, wxDC *dc ); // Create compatible DC
// override some base class virtuals
virtual void SetFont(const wxFont& font) wxOVERRIDE;
virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) wxOVERRIDE;
virtual void DoGetSize(int* width, int* height) const wxOVERRIDE;
virtual void DoSelect(const wxBitmap& bitmap) wxOVERRIDE;