vcl/source/animate/AnimationRenderer.cxx |  180 +++++++++++++++----------------
 1 file changed, 91 insertions(+), 89 deletions(-)

New commits:
commit 33f050624eb5c8e1c5e37aca61bc93da695b2726
Author:     Christopher Sherlock <[email protected]>
AuthorDate: Sun Feb 23 18:47:00 2025 +1100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Tue Sep 2 07:47:14 2025 +0200

    vcl: flatten AnimationRenderer::draw()
    
    Change-Id: Ie5b3c969e6fa13eda526ee3123f7160e844711c2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182059
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/vcl/source/animate/AnimationRenderer.cxx 
b/vcl/source/animate/AnimationRenderer.cxx
index cc30c9eef69b..757566688a3a 100644
--- a/vcl/source/animate/AnimationRenderer.cxx
+++ b/vcl/source/animate/AnimationRenderer.cxx
@@ -191,110 +191,112 @@ void AnimationRenderer::draw( sal_uLong nIndex, 
VirtualDevice* pVDev )
     if( aOutRect.Intersection( tools::Rectangle( maDispPt, maDispSz ) 
).IsEmpty() )
     {
         setMarked( true );
+        return;
     }
-    else if( !mbIsPaused )
-    {
-        VclPtr<VirtualDevice>   pDev;
-        Point                   aPosPix;
-        Point                   aBmpPosPix;
-        Size                    aSizePix;
-        Size                    aBmpSizePix;
-        const sal_uLong             nLastPos = mpParent->Count() - 1;
-        mnActIndex = std::min( nIndex, nLastPos );
-        const AnimationFrame&  rAnimationFrame = mpParent->Get( 
static_cast<sal_uInt16>( mnActIndex ) );
-
-        getPosSize( rAnimationFrame, aPosPix, aSizePix );
-
-        // Mirrored horizontally?
-        if( mbIsMirroredHorizontally )
-        {
-            aBmpPosPix.setX( aPosPix.X() + aSizePix.Width() - 1 );
-            aBmpSizePix.setWidth( -aSizePix.Width() );
-        }
-        else
-        {
-            aBmpPosPix.setX( aPosPix.X() );
-            aBmpSizePix.setWidth( aSizePix.Width() );
-        }
 
-        // Mirrored vertically?
-        if( mbIsMirroredVertically )
-        {
-            aBmpPosPix.setY( aPosPix.Y() + aSizePix.Height() - 1 );
-            aBmpSizePix.setHeight( -aSizePix.Height() );
-        }
-        else
-        {
-            aBmpPosPix.setY( aPosPix.Y() );
-            aBmpSizePix.setHeight( aSizePix.Height() );
-        }
+    if(mbIsPaused)
+        return;
 
-        // get output device
-        if( !pVDev )
-        {
-            pDev = VclPtr<VirtualDevice>::Create();
-            pDev->SetOutputSizePixel( maSizePx, false );
-            pDev->DrawOutDev( Point(), maSizePx, maDispPt, maDispSz, 
*pRenderContext );
-        }
-        else
-            pDev = pVDev;
+    VclPtr<VirtualDevice>   pDev;
+    Point                   aPosPix;
+    Point                   aBmpPosPix;
+    Size                    aSizePix;
+    Size                    aBmpSizePix;
+    const sal_uLong             nLastPos = mpParent->Count() - 1;
+    mnActIndex = std::min( nIndex, nLastPos );
+    const AnimationFrame&  rAnimationFrame = mpParent->Get( 
static_cast<sal_uInt16>( mnActIndex ) );
 
-        // restore background after each run
-        if( !nIndex )
-        {
-            meLastDisposal = Disposal::Back;
-            maRestPt = Point();
-            maRestSz = maSizePx;
-        }
+    getPosSize( rAnimationFrame, aPosPix, aSizePix );
 
-        // restore
-        if( ( Disposal::Not != meLastDisposal ) && maRestSz.Width() && 
maRestSz.Height() )
-        {
-            if( Disposal::Back == meLastDisposal )
-                pDev->DrawOutDev( maRestPt, maRestSz, maRestPt, maRestSz, 
*mpBackground );
-            else
-                pDev->DrawOutDev( maRestPt, maRestSz, Point(), maRestSz, 
*mpRestore );
-        }
+    // Mirrored horizontally?
+    if( mbIsMirroredHorizontally )
+    {
+        aBmpPosPix.setX( aPosPix.X() + aSizePix.Width() - 1 );
+        aBmpSizePix.setWidth( -aSizePix.Width() );
+    }
+    else
+    {
+        aBmpPosPix.setX( aPosPix.X() );
+        aBmpSizePix.setWidth( aSizePix.Width() );
+    }
 
-        meLastDisposal = rAnimationFrame.meDisposal;
-        maRestPt = aPosPix;
-        maRestSz = aSizePix;
+    // Mirrored vertically?
+    if( mbIsMirroredVertically )
+    {
+        aBmpPosPix.setY( aPosPix.Y() + aSizePix.Height() - 1 );
+        aBmpSizePix.setHeight( -aSizePix.Height() );
+    }
+    else
+    {
+        aBmpPosPix.setY( aPosPix.Y() );
+        aBmpSizePix.setHeight( aSizePix.Height() );
+    }
+
+    // get output device
+    if( !pVDev )
+    {
+        pDev = VclPtr<VirtualDevice>::Create();
+        pDev->SetOutputSizePixel( maSizePx, false );
+        pDev->DrawOutDev( Point(), maSizePx, maDispPt, maDispSz, 
*pRenderContext );
+    }
+    else
+        pDev = pVDev;
+
+    // restore background after each run
+    if( !nIndex )
+    {
+        meLastDisposal = Disposal::Back;
+        maRestPt = Point();
+        maRestSz = maSizePx;
+    }
 
-        // What do we need to restore the next time?
-        // Put it into a bitmap if needed, else delete
-        // SaveBitmap to conserve memory
-        if( ( meLastDisposal == Disposal::Back ) || ( meLastDisposal == 
Disposal::Not ) )
-            mpRestore->SetOutputSizePixel( Size( 1, 1 ), false );
+    // restore
+    if( ( Disposal::Not != meLastDisposal ) && maRestSz.Width() && 
maRestSz.Height() )
+    {
+        if( Disposal::Back == meLastDisposal )
+            pDev->DrawOutDev( maRestPt, maRestSz, maRestPt, maRestSz, 
*mpBackground );
         else
-        {
-            mpRestore->SetOutputSizePixel( maRestSz, false );
-            mpRestore->DrawOutDev( Point(), maRestSz, aPosPix, aSizePix, *pDev 
);
-        }
+            pDev->DrawOutDev( maRestPt, maRestSz, Point(), maRestSz, 
*mpRestore );
+    }
 
-        pDev->DrawBitmapEx( aBmpPosPix, aBmpSizePix, rAnimationFrame.maBitmap 
);
+    meLastDisposal = rAnimationFrame.meDisposal;
+    maRestPt = aPosPix;
+    maRestSz = aSizePix;
 
-        if( !pVDev )
-        {
-            std::optional<vcl::Region> xOldClip;
-            if (!maClip.IsNull())
-                xOldClip = pRenderContext->GetClipRegion();
+    // What do we need to restore the next time?
+    // Put it into a bitmap if needed, else delete
+    // SaveBitmap to conserve memory
+    if( ( meLastDisposal == Disposal::Back ) || ( meLastDisposal == 
Disposal::Not ) )
+        mpRestore->SetOutputSizePixel( Size( 1, 1 ), false );
+    else
+    {
+        mpRestore->SetOutputSizePixel( maRestSz, false );
+        mpRestore->DrawOutDev( Point(), maRestSz, aPosPix, aSizePix, *pDev );
+    }
+
+    pDev->DrawBitmapEx( aBmpPosPix, aBmpSizePix, rAnimationFrame.maBitmap );
 
-            if (xOldClip)
-                pRenderContext->SetClipRegion( maClip );
+    if( !pVDev )
+    {
+        std::optional<vcl::Region> xOldClip;
+        if (!maClip.IsNull())
+            xOldClip = pRenderContext->GetClipRegion();
 
-            pRenderContext->DrawOutDev( maDispPt, maDispSz, Point(), maSizePx, 
*pDev );
-            if (pGuard)
-                pGuard->SetPaintRect(tools::Rectangle(maDispPt, maDispSz));
+        if (xOldClip)
+            pRenderContext->SetClipRegion( maClip );
 
-            if( xOldClip)
-            {
-                pRenderContext->SetClipRegion(*xOldClip);
-                xOldClip.reset();
-            }
+        pRenderContext->DrawOutDev( maDispPt, maDispSz, Point(), maSizePx, 
*pDev );
+        if (pGuard)
+            pGuard->SetPaintRect(tools::Rectangle(maDispPt, maDispSz));
 
-            pDev.disposeAndClear();
-            pRenderContext->Flush();
+        if( xOldClip)
+        {
+            pRenderContext->SetClipRegion(*xOldClip);
+            xOldClip.reset();
         }
+
+        pDev.disposeAndClear();
+        pRenderContext->Flush();
     }
 }
 

Reply via email to