diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-07-20 08:19:52 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-08-02 08:13:15 +0200 |
commit | b6b26421a1029b18b48b69dbdac4bb70fb622604 (patch) | |
tree | 97b9ab25fef28063a3de4e3a67544d2ea13a70e0 /vcl/win/app | |
parent | d66ffef8558785f19908c8e526211b8225fa9125 (diff) |
split Point/Size/Rectangle into AbsoluteScreenPixel* types
to attempt to make it obvious in code what kind of coordinate
system we are dealing with.
The idea is that by doing this, the compile-time type checking
will flush out inconsistencies between different code.
I started with vcl::Window::OutputToAbsoluteScreenPixel
and worked outwards from there.
Change-Id: Ia967d7a0bb38886695f3a761b85c8b9340ddb1c0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154676
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/win/app')
-rw-r--r-- | vcl/win/app/salinfo.cxx | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/vcl/win/app/salinfo.cxx b/vcl/win/app/salinfo.cxx index c028939fd65a..23d542d23b84 100644 --- a/vcl/win/app/salinfo.cxx +++ b/vcl/win/app/salinfo.cxx @@ -65,9 +65,9 @@ bool WinSalSystem::handleMonitorCallback( sal_IntPtr hMonitor, sal_IntPtr, sal_I if( it != m_aDeviceNameToMonitor.end() ) { DisplayMonitor& rMon( m_aMonitors[ it->second ] ); - rMon.m_aArea = tools::Rectangle( Point( aInfo.rcMonitor.left, + rMon.m_aArea = AbsoluteScreenPixelRectangle( AbsoluteScreenPixelPoint( aInfo.rcMonitor.left, aInfo.rcMonitor.top ), - Size( aInfo.rcMonitor.right - aInfo.rcMonitor.left, + AbsoluteScreenPixelSize( aInfo.rcMonitor.right - aInfo.rcMonitor.left, aInfo.rcMonitor.bottom - aInfo.rcMonitor.top ) ); if( (aInfo.dwFlags & MONITORINFOF_PRIMARY) != 0 ) m_nPrimary = it->second; @@ -92,8 +92,8 @@ bool WinSalSystem::initMonitors() { int w = GetSystemMetrics( SM_CXSCREEN ); int h = GetSystemMetrics( SM_CYSCREEN ); - m_aMonitors.push_back( DisplayMonitor( OUString(), - tools::Rectangle( Point(), Size( w, h ) ) ) ); + AbsoluteScreenPixelRectangle aRect(AbsoluteScreenPixelPoint(), AbsoluteScreenPixelSize( w, h )); + m_aMonitors.push_back( DisplayMonitor( OUString(), aRect ) ); m_aDeviceNameToMonitor[ OUString() ] = 0; m_nPrimary = 0; } @@ -115,7 +115,7 @@ bool WinSalSystem::initMonitors() aDeviceStringCount[ aDeviceString ]++; m_aDeviceNameToMonitor[ aDeviceName ] = m_aMonitors.size(); m_aMonitors.push_back( DisplayMonitor( aDeviceString, - tools::Rectangle() ) ); + AbsoluteScreenPixelRectangle() ) ); } } HDC aDesktopRC = GetDC( nullptr ); @@ -151,7 +151,7 @@ unsigned int WinSalSystem::GetDisplayBuiltInScreen() return m_nPrimary; } -tools::Rectangle WinSalSystem::GetDisplayScreenPosSizePixel( unsigned int nScreen ) +AbsoluteScreenPixelRectangle WinSalSystem::GetDisplayScreenPosSizePixel( unsigned int nScreen ) { initMonitors(); if (nScreen >= m_aMonitors.size()) @@ -159,7 +159,7 @@ tools::Rectangle WinSalSystem::GetDisplayScreenPosSizePixel( unsigned int nScree SAL_WARN("vcl", "Requested screen size/pos for screen #" << nScreen << ", but only " << m_aMonitors.size() << " screens found."); assert(false); - return tools::Rectangle(); + return AbsoluteScreenPixelRectangle(); } return m_aMonitors[nScreen].m_aArea; } |