Really implement wxGraphicsContext::GetDPI()
Return the DPI of the associated window, if any, instead of always returning hard-coded 72*72.
This commit is contained in:
@@ -31,6 +31,8 @@
|
||||
#include "wx/log.h"
|
||||
#endif
|
||||
|
||||
#include "wx/display.h"
|
||||
|
||||
#ifdef __WXMSW__
|
||||
#include "wx/msw/enhmeta.h"
|
||||
#endif
|
||||
@@ -620,8 +622,19 @@ wxDouble wxGraphicsContext::GetAlpha() const
|
||||
|
||||
void wxGraphicsContext::GetDPI( wxDouble* dpiX, wxDouble* dpiY)
|
||||
{
|
||||
*dpiX = 72.0;
|
||||
*dpiY = 72.0;
|
||||
if ( m_window )
|
||||
{
|
||||
const wxSize ppi = wxDisplay(m_window).GetPPI();
|
||||
*dpiX = ppi.x;
|
||||
*dpiY = ppi.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use some standard DPI value, it doesn't make much sense for the
|
||||
// contexts not using any pixels anyhow.
|
||||
*dpiX = 72.0;
|
||||
*dpiY = 72.0;
|
||||
}
|
||||
}
|
||||
|
||||
// sets the pen
|
||||
|
||||
Reference in New Issue
Block a user