macOS Implementation for wxDisplay::GetScaleFactor
This commit is contained in:
committed by
Vadim Zeitlin
parent
f572797965
commit
16ff1f8f7c
@@ -104,6 +104,7 @@ public:
|
||||
virtual wxRect GetClientArea() const wxOVERRIDE;
|
||||
virtual int GetDepth() const wxOVERRIDE;
|
||||
virtual wxSize GetSizeMM() const wxOVERRIDE;
|
||||
virtual double GetScaleFactor() const wxOVERRIDE;
|
||||
|
||||
virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const wxOVERRIDE;
|
||||
virtual wxVideoMode GetCurrentMode() const wxOVERRIDE;
|
||||
@@ -270,6 +271,14 @@ wxSize wxDisplayImplMacOSX::GetSizeMM() const
|
||||
return wxGetDisplaySizeMM(m_id);
|
||||
}
|
||||
|
||||
double wxDisplayImplMacOSX::GetScaleFactor() const
|
||||
{
|
||||
wxCFRef<CGDisplayModeRef> mode = CGDisplayCopyDisplayMode(m_id);
|
||||
size_t width = CGDisplayModeGetWidth(mode);
|
||||
size_t pixelsw = CGDisplayModeGetPixelWidth(mode);
|
||||
return (double)pixelsw / width;
|
||||
}
|
||||
|
||||
static int wxOSXCGDisplayModeGetBitsPerPixel( CGDisplayModeRef theValue )
|
||||
{
|
||||
wxCFRef<CFStringRef> pixelEncoding( CGDisplayModeCopyPixelEncoding(theValue) );
|
||||
|
Reference in New Issue
Block a user