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

New commits:
commit 6ef6e31e32f33d77fa23bd5e07300f15b5ceb6f4
Author:     Christopher Sherlock <chris.sherloc...@gmail.com>
AuthorDate: Sat Aug 16 01:57:46 2025 +1000
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Tue Sep 2 07:44:35 2025 +0200

    vcl: flatten OutputDevice::DrawGradient()
    
    Change-Id: I1042b3750025277b4c24d57fdd7751685e69dfce
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189703
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/vcl/source/outdev/gradient.cxx b/vcl/source/outdev/gradient.cxx
index 88dca21c4a03..1a0ad2d0d1b8 100644
--- a/vcl/source/outdev/gradient.cxx
+++ b/vcl/source/outdev/gradient.cxx
@@ -108,38 +108,38 @@ void OutputDevice::DrawGradient( const 
tools::PolyPolygon& rPolyPoly,
     if (!mbOutputClipped)
         bDrawn = mpGraphics->DrawGradient( aClixPolyPoly, aGradient, *this );
 
-    if (!bDrawn && !mbOutputClipped)
+    if (bDrawn || mbOutputClipped)
+        return;
+
+    // draw gradients without border
+    if( mbLineColor || mbInitLineColor )
     {
-        // draw gradients without border
-        if( mbLineColor || mbInitLineColor )
-        {
-            mpGraphics->SetLineColor();
-            mbInitLineColor = true;
-        }
+        mpGraphics->SetLineColor();
+        mbInitLineColor = true;
+    }
 
-        mbInitFillColor = true;
+    mbInitFillColor = true;
 
-        // calculate step count if necessary
-        if ( !aGradient.GetSteps() )
-            aGradient.SetSteps( GRADIENT_DEFAULT_STEPCOUNT );
+    // 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 );
+    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 );
 }
 
 void OutputDevice::ClipAndDrawGradientMetafile ( const Gradient &rGradient, 
const tools::PolyPolygon &rPolyPoly )

Reply via email to