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:
@@ -2535,7 +2535,8 @@ void MyFrame::OnSave(wxCommandEvent& WXUNUSED(event))
|
||||
else
|
||||
#endif // wxUSE_POSTSCRIPT
|
||||
{
|
||||
wxBitmap bmp(width, height);
|
||||
wxBitmap bmp;
|
||||
bmp.CreateWithDIPSize(wxSize(width, height), GetDPIScaleFactor());
|
||||
wxMemoryDC mdc(bmp);
|
||||
mdc.SetBackground(*wxWHITE_BRUSH);
|
||||
mdc.Clear();
|
||||
|
||||
Reference in New Issue
Block a user