Improve wxD2DContext::GetDPI and wxGDIPlusContext::GetDPI
If there is a valid wxWindow, use its DPI. Otherwise use a dedicated function of the context to get the DPI. Don't use the common wxGraphicsContext::GetDPI because this will return hard-coded 72 when there is no valid wxWindow.
This commit is contained in:
@@ -4576,10 +4576,25 @@ void wxD2DContext::Flush()
|
||||
|
||||
void wxD2DContext::GetDPI(wxDouble* dpiX, wxDouble* dpiY) const
|
||||
{
|
||||
FLOAT x, y;
|
||||
GetRenderTarget()->GetDpi(&x, &y);
|
||||
if (dpiX != NULL) *dpiX = x;
|
||||
if (dpiY != NULL) *dpiY = y;
|
||||
if ( GetWindow() )
|
||||
{
|
||||
const wxSize dpi = GetWindow()->GetDPI();
|
||||
|
||||
if ( dpiX )
|
||||
*dpiX = dpi.x;
|
||||
if ( dpiY )
|
||||
*dpiY = dpi.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
FLOAT x, y;
|
||||
GetRenderTarget()->GetDpi(&x, &y);
|
||||
|
||||
if ( dpiX )
|
||||
*dpiX = x;
|
||||
if ( dpiY )
|
||||
*dpiY = y;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user