33 const wxPoint& pos,
const wxSize& size,
long style,
34 const wxString&
name,
const wxPalette& palette ) :
35 wxGLCanvas( parent, id, attribList, pos, size, style,
name, palette ),
36 m_scale_factor(
DPI_SCALING::GetDefaultScaleFactor() )
43 wxSize size = wxGLCanvas::GetClientSize();
46 size.x *= scaleFactor;
47 size.y *= scaleFactor;
55 wxPoint nativePoint = aPoint;
58 nativePoint.x *= scaleFactor;
59 nativePoint.y *= scaleFactor;
Class to handle configuration and automatic determination of the DPI scale to use for canvases.
void SetScaleFactor(double aFactor)
Set the canvas scale factor, probably for a hi-DPI display.
virtual wxSize GetNativePixelSize() const
wxPoint GetNativePosition(const wxPoint &aPoint) const
Convert the given point from client coordinates to native pixel coordinates.
double m_scale_factor
The current scale factor (e.g.
double GetScaleFactor() const
Get the current scale factor.
HIDPI_GL_CANVAS(wxWindow *parent, wxWindowID id=wxID_ANY, const int *attribList=nullptr, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxGLCanvasName, const wxPalette &palette=wxNullPalette)