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:
@@ -128,7 +128,7 @@ All (GUI):
|
|||||||
- Add wxGrid::SetCornerLabelValue() (Pavel Kalugin).
|
- Add wxGrid::SetCornerLabelValue() (Pavel Kalugin).
|
||||||
- Add strikethrough support for fonts defined in XRC.
|
- Add strikethrough support for fonts defined in XRC.
|
||||||
- Add wxDisplay::GetPPI().
|
- Add wxDisplay::GetPPI().
|
||||||
- Add wxGraphicsContext::GetWindow().
|
- Add wxGraphicsContext::GetWindow() and implement wxGraphicsContext::GetDPI().
|
||||||
|
|
||||||
wxGTK:
|
wxGTK:
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,8 @@
|
|||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "wx/display.h"
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
#include "wx/msw/enhmeta.h"
|
#include "wx/msw/enhmeta.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -620,9 +622,20 @@ wxDouble wxGraphicsContext::GetAlpha() const
|
|||||||
|
|
||||||
void wxGraphicsContext::GetDPI( wxDouble* dpiX, wxDouble* dpiY)
|
void wxGraphicsContext::GetDPI( wxDouble* dpiX, wxDouble* dpiY)
|
||||||
{
|
{
|
||||||
|
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;
|
*dpiX = 72.0;
|
||||||
*dpiY = 72.0;
|
*dpiY = 72.0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// sets the pen
|
// sets the pen
|
||||||
void wxGraphicsContext::SetPen( const wxGraphicsPen& pen )
|
void wxGraphicsContext::SetPen( const wxGraphicsPen& pen )
|
||||||
|
|||||||
Reference in New Issue
Block a user