diff options
author | Adrien Ollier <adr.ollier@hotmail.fr> | 2019-05-01 23:11:12 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2019-05-03 20:38:49 +0200 |
commit | 27434647540b2bd3f30139983a3d5f7da9b77a44 (patch) | |
tree | 3db94856582ce764608cc0bd45792939f0ca712b /vcl | |
parent | 69bf59d63d4d2708a7840ff1ffad821a032c90fc (diff) |
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@hotmail.fr>
Reviewed-on: https://gerrit.libreoffice.org/71652
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/animate/Animation.cxx | 9 |
1 files changed, 7 insertions, 2 deletions
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; } } |