vcl/source/outdev/bitmap.cxx |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit c9321bab19cc7c23f8143f05936871be635f4823
Author:     Christopher Sherlock <chris.sherloc...@gmail.com>
AuthorDate: Thu Aug 14 22:01:11 2025 +1000
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Tue Sep 16 08:59:16 2025 +0200

    vcl: streamline assignment of bClipped
    
    This clarifies the variable. The variable is reused, but the first use
    is to detect whether the area *should* be clipped. The second use of the
    variable determines if the area *has been* clipped. Obviously, it makes
    no sense to say that the area has been clipped (true) before we actually
    do the clipping, so we should be setting it to false at the start of the
    if statement. Then when the clipping succeeds then we can say that it
    was successful.
    
    This also removes the need to set the variable in several else
    statements and we only have to set the variable to true once the
    clipping succeeds.
    
    In the next patch, I will also remove the need for the second
    modification of the bClipped variable as we can just return the bitmap -
    but it is far more clear what I'm doing with this patch.
    
    Change-Id: If8e217975a7a1fa7efff8fb3607040e3269495e5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189600
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index c1b14a876552..c91908cf2548 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -206,8 +206,10 @@ Bitmap OutputDevice::GetBitmap( const Point& rSrcPt, const 
Size& rSize ) const
         bClipped = true;
     }
 
-    if ( bClipped )
+    if (bClipped)
     {
+        bClipped = false;
+
         // If the visible part has been clipped, we have to create a
         // Bitmap with the correct size in which we copy the clipped
         // Bitmap to the correct position.
@@ -231,12 +233,10 @@ Bitmap OutputDevice::GetBitmap( const Point& rSrcPt, 
const Size& rSize ) const
                 }
 
                 aBmp = aVDev->GetBitmap( Point(), aVDev->GetOutputSizePixel() 
);
+
+                bClipped = true;
             }
-            else
-                bClipped = false;
         }
-        else
-            bClipped = false;
     }
 
     if ( !bClipped )

Reply via email to