Add FromDIP to wxDC and wxGraphicsContext
Using the same implementation as wxWindow has.
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
#endif
|
||||
|
||||
#include "wx/private/graphics.h"
|
||||
#include "wx/private/rescale.h"
|
||||
#include "wx/display.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -641,6 +642,18 @@ void wxGraphicsContext::GetDPI( wxDouble* dpiX, wxDouble* dpiY) const
|
||||
}
|
||||
}
|
||||
|
||||
wxSize wxGraphicsContext::FromDIP(const wxSize& sz) const
|
||||
{
|
||||
#ifdef wxHAS_DPI_INDEPENDENT_PIXELS
|
||||
return sz;
|
||||
#else
|
||||
wxRealPoint dpi;
|
||||
GetDPI(&dpi.x, &dpi.y);
|
||||
const wxSize baseline = wxDisplay::GetStdPPI();
|
||||
return wxRescaleCoord(sz).From(baseline).To(wxSize((int)dpi.x, (int)dpi.y));
|
||||
#endif // wxHAS_DPI_INDEPENDENT_PIXELS
|
||||
}
|
||||
|
||||
// sets the pen
|
||||
void wxGraphicsContext::SetPen( const wxGraphicsPen& pen )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user