vcl/source/outdev/gradient.cxx |   88 ++++++++++++++++++++---------------------
 1 file changed, 44 insertions(+), 44 deletions(-)

New commits:
commit 78c26e59e397f7be10a19a4e3272032c1950b008
Author:     Christopher Sherlock <[email protected]>
AuthorDate: Thu Aug 14 23:46:06 2025 +1000
Commit:     Michael Weghorn <[email protected]>
CommitDate: Thu Aug 28 14:01:50 2025 +0200

    vcl: flatten OutputDevice::DrawGradient()
    
    Change-Id: Ic622cf6a87ed253266e2edd1ea5c6363b9f480d2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189701
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/vcl/source/outdev/gradient.cxx b/vcl/source/outdev/gradient.cxx
index 063da7bbb2c6..88dca21c4a03 100644
--- a/vcl/source/outdev/gradient.cxx
+++ b/vcl/source/outdev/gradient.cxx
@@ -88,57 +88,57 @@ void OutputDevice::DrawGradient( const tools::PolyPolygon& 
rPolyPoly,
     aRect.Normalize();
 
     // do nothing if the rectangle is empty
-    if ( !aRect.IsEmpty() )
-    {
-        tools::PolyPolygon aClixPolyPoly( ImplLogicToDevicePixel( rPolyPoly ) 
);
-        bool bDrawn = false;
+    if (aRect.IsEmpty())
+        return;
+
+    tools::PolyPolygon aClixPolyPoly( ImplLogicToDevicePixel( rPolyPoly ) );
+    bool bDrawn = false;
+
+    if( !mpGraphics && !AcquireGraphics() )
+        return;
+
+    // secure clip region
+    auto popIt = ScopedPush(vcl::PushFlags::CLIPREGION);
+    IntersectClipRegion( aBoundRect );
+
+    if (mbInitClipRegion)
+        InitClipRegion();
 
-        if( !mpGraphics && !AcquireGraphics() )
-            return;
+    // try to draw gradient natively
+    if (!mbOutputClipped)
+        bDrawn = mpGraphics->DrawGradient( aClixPolyPoly, aGradient, *this );
 
-        // secure clip region
-        auto popIt = ScopedPush(vcl::PushFlags::CLIPREGION);
-        IntersectClipRegion( aBoundRect );
+    if (!bDrawn && !mbOutputClipped)
+    {
+        // draw gradients without border
+        if( mbLineColor || mbInitLineColor )
+        {
+            mpGraphics->SetLineColor();
+            mbInitLineColor = true;
+        }
 
-        if (mbInitClipRegion)
-            InitClipRegion();
+        mbInitFillColor = true;
 
-        // try to draw gradient natively
-        if (!mbOutputClipped)
-            bDrawn = mpGraphics->DrawGradient( aClixPolyPoly, aGradient, *this 
);
+        // calculate step count if necessary
+        if ( !aGradient.GetSteps() )
+            aGradient.SetSteps( GRADIENT_DEFAULT_STEPCOUNT );
 
-        if (!bDrawn && !mbOutputClipped)
+        if ( rPolyPoly.IsRect() )
         {
-            // draw gradients without border
-            if( mbLineColor || mbInitLineColor )
-            {
-                mpGraphics->SetLineColor();
-                mbInitLineColor = true;
-            }
-
-            mbInitFillColor = true;
-
-            // calculate step count if necessary
-            if ( !aGradient.GetSteps() )
-                aGradient.SetSteps( GRADIENT_DEFAULT_STEPCOUNT );
-
-            if ( rPolyPoly.IsRect() )
-            {
-                // because we draw with no border line, we have to expand 
gradient
-                // rect to avoid missing lines on the right and bottom edge
-                aRect.AdjustLeft( -1 );
-                aRect.AdjustTop( -1 );
-                aRect.AdjustRight( 1 );
-                aRect.AdjustBottom( 1 );
-            }
-
-            // if the clipping polypolygon is a rectangle, then it's the same 
size as the bounding of the
-            // polypolygon, so pass in a NULL for the clipping parameter
-            if( aGradient.GetStyle() == css::awt::GradientStyle_LINEAR || 
rGradient.GetStyle() == css::awt::GradientStyle_AXIAL )
-                DrawLinearGradient( aRect, aGradient, aClixPolyPoly.IsRect() ? 
nullptr : &aClixPolyPoly );
-            else
-                DrawComplexGradient( aRect, aGradient, aClixPolyPoly.IsRect() 
? nullptr : &aClixPolyPoly );
+            // because we draw with no border line, we have to expand gradient
+            // rect to avoid missing lines on the right and bottom edge
+            aRect.AdjustLeft( -1 );
+            aRect.AdjustTop( -1 );
+            aRect.AdjustRight( 1 );
+            aRect.AdjustBottom( 1 );
         }
+
+        // if the clipping polypolygon is a rectangle, then it's the same size 
as the bounding of the
+        // polypolygon, so pass in a NULL for the clipping parameter
+        if( aGradient.GetStyle() == css::awt::GradientStyle_LINEAR || 
rGradient.GetStyle() == css::awt::GradientStyle_AXIAL )
+            DrawLinearGradient( aRect, aGradient, aClixPolyPoly.IsRect() ? 
nullptr : &aClixPolyPoly );
+        else
+            DrawComplexGradient( aRect, aGradient, aClixPolyPoly.IsRect() ? 
nullptr : &aClixPolyPoly );
     }
 }
 

Reply via email to