[Libreoffice-commits] core.git: vcl/source

Adrien Ollier (via logerrit) logerrit at kemper.freedesktop.org
Fri May 3 18:39:59 UTC 2019


 vcl/source/animate/Animation.cxx |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 27434647540b2bd3f30139983a3d5f7da9b77a44
Author:     Adrien Ollier <adr.ollier at hotmail.fr>
AuthorDate: Wed May 1 23:11:12 2019 +0200
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Fri May 3 20:38:49 2019 +0200

    rewritting in a more conventional way
    
    - mnPos is modified only if mbLoopTerminated is true
    - using new and delete operators is less efficient than building
    an object on the stack
    - skipping a line makes instructions clearer
    
    Change-Id: I9bec0cf02a581c1e0033880fcad83f17e83ea3f2
    Signed-off-by: Adrien Ollier <adr.ollier at hotmail.fr>
    Reviewed-on: https://gerrit.libreoffice.org/71652
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index bb3935a41c78..9462d0e75a74 100644
--- a/vcl/source/animate/Animation.cxx
+++ b/vcl/source/animate/Animation.cxx
@@ -267,8 +267,13 @@ void Animation::Draw(OutputDevice* pOut, const Point& rDestPt, const Size& rDest
         else
         {
             const size_t nOldPos = mnPos;
-            const_cast<Animation*>(this)->mnPos = mbLoopTerminated ? (nCount - 1) : mnPos;
-            delete new ImplAnimView(const_cast<Animation*>(this), pOut, rDestPt, rDestSz, 0);
+            if (mbLoopTerminated)
+                const_cast<Animation*>(this)->mnPos = nCount - 1;
+
+            {
+                ImplAnimView{ const_cast<Animation*>(this), pOut, rDestPt, rDestSz, 0 };
+            }
+
             const_cast<Animation*>(this)->mnPos = nOldPos;
         }
     }


More information about the Libreoffice-commits mailing list