vcl/win/window/salframe.cxx |   22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

New commits:
commit e835b00dc46e3c06dc833c5d4a98c3f40bc98864
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Tue Sep 6 09:50:02 2022 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Tue Sep 6 10:01:27 2022 +0200

    Deduplicate screen rect handling
    
    Change-Id: I5aacadff5ada74c6bc83ac698c87bca75e85ba0c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139468
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 0f2d18547bc4..a3941450f6aa 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -756,27 +756,21 @@ static void ImplSalCalcFullScreenSize( const WinSalFrame* 
pFrame,
 
     try
     {
+        tools::Rectangle aRect;
         sal_Int32 nMonitors = Application::GetScreenCount();
         if( (pFrame->mnDisplay >= 0) && (pFrame->mnDisplay < nMonitors) )
         {
-            tools::Rectangle aRect = Application::GetScreenPosSizePixel( 
pFrame->mnDisplay );
-            nScreenX = aRect.Left();
-            nScreenY = aRect.Top();
-            nScreenDX = aRect.GetWidth();
-            nScreenDY = aRect.GetHeight();
+            aRect = Application::GetScreenPosSizePixel(pFrame->mnDisplay);
         }
         else
         {
-            tools::Rectangle aCombined = Application::GetScreenPosSizePixel( 0 
);
-            for( sal_Int32 i = 1 ; i < nMonitors ; i++ )
-            {
-                aCombined.Union( Application::GetScreenPosSizePixel( i ) );
-            }
-            nScreenX  = aCombined.Left();
-            nScreenY  = aCombined.Top();
-            nScreenDX = aCombined.GetWidth();
-            nScreenDY = aCombined.GetHeight();
+            for (sal_Int32 i = 0; i < nMonitors; i++)
+                aRect.Union(Application::GetScreenPosSizePixel(i));
         }
+        nScreenX = aRect.Left();
+        nScreenY = aRect.Top();
+        nScreenDX = aRect.GetWidth();
+        nScreenDY = aRect.GetHeight();
     }
     catch( Exception& )
     {

Reply via email to