Fix Cairo DPI when no wxWindow is associated

Always multiply with the content scale factor, also on macOS.
This commit is contained in:
Maarten Bent
2022-04-23 16:21:56 +02:00
parent deaa43e32d
commit bf4e45fc67

View File

@@ -2764,27 +2764,13 @@ void wxCairoContext::Flush()
void wxCairoContext::GetDPI(wxDouble* dpiX, wxDouble* dpiY) const
{
if ( GetWindow() )
{
const wxSize dpi = GetWindow()->GetDPI();
const wxSize dpi = GetWindow() ? GetWindow()->GetDPI() :
(wxDisplay::GetStdPPI() * GetContentScaleFactor());
if ( dpiX )
*dpiX = dpi.x;
if ( dpiY )
*dpiY = dpi.y;
}
else
{
double dpi = (double)wxDisplay::GetStdPPIValue();
#ifndef __WXMAC__
dpi *= GetContentScaleFactor();
#endif
if ( dpiX )
*dpiX = dpi;
if ( dpiY )
*dpiY = dpi;
}
if (dpiX )
*dpiX = dpi.x;
if ( dpiY )
*dpiY = dpi.y;
}
void wxCairoContext::DrawBitmap( const wxBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h )