From: Stefan Csomor Date: Wed, 19 Jun 2013 20:29:56 +0000 (+0000) Subject: using common GetContentScaleFactor throughout part 2/2 X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/1829d71c4063cf7549292bf56038a3c6a9d9f777 using common GetContentScaleFactor throughout part 2/2 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74256 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/osx/cocoa/nonownedwnd.mm b/src/osx/cocoa/nonownedwnd.mm index 3901a71c69..030b1e6a23 100644 --- a/src/osx/cocoa/nonownedwnd.mm +++ b/src/osx/cocoa/nonownedwnd.mm @@ -1035,16 +1035,6 @@ void wxNonOwnedWindowCocoaImpl::WindowToScreen( int *x, int *y ) *y = p.y; } -double wxNonOwnedWindowCocoaImpl::GetMagnificationFactor() const -{ -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 - if ( [ m_macWindow respondsToSelector:@selector(backingScaleFactor) ] ) - return [m_macWindow backingScaleFactor]; - else -#endif - return 1.0; -} - bool wxNonOwnedWindowCocoaImpl::IsActive() { return [m_macWindow isKeyWindow]; diff --git a/src/osx/cocoa/window.mm b/src/osx/cocoa/window.mm index c76c1a8580..3465cdbc40 100644 --- a/src/osx/cocoa/window.mm +++ b/src/osx/cocoa/window.mm @@ -1703,6 +1703,17 @@ void wxWidgetCocoaImpl::SetVisibility( bool visible ) [m_osxView setHidden:(visible ? NO:YES)]; } +double wxWidgetCocoaImpl::GetContentScaleFactor() const +{ +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 + NSWindow* tlw = [m_osxView window]; + if ( [ tlw respondsToSelector:@selector(backingScaleFactor) ] ) + return [tlw backingScaleFactor]; + else +#endif + return 1.0; +} + // ---------------------------------------------------------------------------- // window animation stuff // ---------------------------------------------------------------------------- diff --git a/src/osx/iphone/window.mm b/src/osx/iphone/window.mm index 79abdfa1b0..c9ac123d25 100644 --- a/src/osx/iphone/window.mm +++ b/src/osx/iphone/window.mm @@ -609,7 +609,7 @@ void wxWidgetIPhoneImpl::SetControlSize( wxWindowVariant variant ) { } -float wxWidgetIPhoneImpl::GetContentScaleFactor() const +double wxWidgetIPhoneImpl::GetContentScaleFactor() const { if ( [m_osxView respondsToSelector:@selector(contentScaleFactor) ]) return [m_osxView contentScaleFactor]; diff --git a/src/osx/nonownedwnd_osx.cpp b/src/osx/nonownedwnd_osx.cpp index 183fe42d7f..edcba5d9ce 100644 --- a/src/osx/nonownedwnd_osx.cpp +++ b/src/osx/nonownedwnd_osx.cpp @@ -478,11 +478,6 @@ void wxNonOwnedWindow::DoGetClientSize( int *width, int *height ) const *height = h ; } -double wxNonOwnedWindow::GetMagnificationFactor() const -{ - return m_nowpeer->GetMagnificationFactor(); -} - void wxNonOwnedWindow::WindowWasPainted() { s_lastFlush = clock(); diff --git a/src/osx/window_osx.cpp b/src/osx/window_osx.cpp index 1a44f25e42..e8ce2cfc67 100644 --- a/src/osx/window_osx.cpp +++ b/src/osx/window_osx.cpp @@ -877,13 +877,6 @@ void wxWindowMac::DoGetClientSize( int *x, int *y ) const *y = hh; } -double wxWindowMac::GetMagnificationFactor() const -{ - wxNonOwnedWindow* tlw = MacGetTopLevelWindow() ; - wxCHECK_MSG( tlw , 1.0, wxT("TopLevel Window missing") ) ; - return tlw->GetMagnificationFactor(); -} - bool wxWindowMac::SetCursor(const wxCursor& cursor) { if (m_cursor.IsSameAs(cursor)) @@ -1226,7 +1219,7 @@ void wxWindowMac::DoSetClientSize(int clientwidth, int clientheight) } } -float wxWindowMac::GetContentScaleFactor() const +double wxWindowMac::GetContentScaleFactor() const { return GetPeer()->GetContentScaleFactor(); }