vcl/source/outdev/bitmap.cxx |   44 ++++++++++++++++++-------------------------
 1 file changed, 19 insertions(+), 25 deletions(-)

New commits:
commit 7b93ad1ff2621c294786be4801d1eb1f168b1033
Author:     Christopher Sherlock <chris.sherloc...@gmail.com>
AuthorDate: Sat Aug 9 19:04:14 2025 +1000
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Mon Aug 11 09:36:51 2025 +0200

    vcl: flatten OutputDevice::DrawBitmap()
    
    Change-Id: I3f646c9fe89b7d3f4527c0c5f857764586db6e6a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189250
    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 d22d42f7b1db..eba9850cd498 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -73,35 +73,29 @@ void OutputDevice::DrawBitmap( const Point& rDestPt, const 
Size& rDestSize,
         return;
     }
 
-    Bitmap aBmp( rBitmap );
-
-    if ( mnDrawMode & ( DrawModeFlags::BlackBitmap | 
DrawModeFlags::WhiteBitmap |
-                             DrawModeFlags::GrayBitmap ) )
+    if (mnDrawMode & (DrawModeFlags::BlackBitmap | DrawModeFlags::WhiteBitmap))
     {
-        if ( mnDrawMode & ( DrawModeFlags::BlackBitmap | 
DrawModeFlags::WhiteBitmap ) )
-        {
-            sal_uInt8 cCmpVal;
+        sal_uInt8 cCmpVal;
 
-            if ( mnDrawMode & DrawModeFlags::BlackBitmap )
-                cCmpVal = 0;
-            else
-                cCmpVal = 255;
-
-            Color aCol( cCmpVal, cCmpVal, cCmpVal );
-            Push( vcl::PushFlags::LINECOLOR | vcl::PushFlags::FILLCOLOR );
-            SetLineColor( aCol );
-            SetFillColor( aCol );
-            DrawRect( tools::Rectangle( rDestPt, rDestSize ) );
-            Pop();
-            return;
-        }
-        else if( !aBmp.IsEmpty() )
-        {
-            if ( mnDrawMode & DrawModeFlags::GrayBitmap )
-                aBmp.Convert( BmpConversion::N8BitGreys );
-        }
+        if (mnDrawMode & DrawModeFlags::BlackBitmap)
+            cCmpVal = 0;
+        else
+            cCmpVal = 255;
+
+        Color aCol(cCmpVal, cCmpVal, cCmpVal);
+        Push(vcl::PushFlags::LINECOLOR | vcl::PushFlags::FILLCOLOR);
+        SetLineColor(aCol);
+        SetFillColor(aCol);
+        DrawRect(tools::Rectangle(rDestPt, rDestSize));
+        Pop();
+        return;
     }
 
+    Bitmap aBmp(rBitmap);
+
+    if (mnDrawMode & DrawModeFlags::GrayBitmap && !aBmp.IsEmpty())
+        aBmp.Convert(BmpConversion::N8BitGreys);
+
     if ( mpMetaFile )
     {
         switch( nAction )

Reply via email to