summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorAdrien Ollier <adr.ollier@hotmail.fr>2020-01-21 22:38:06 +0100
committerMike Kaganski <mike.kaganski@collabora.com>2020-01-22 08:12:52 +0100
commitf6c01b471a08ad1cb38377b8d82dba89206ea8cb (patch)
treefe9f9df696a1edb784293a9153b8bbc4f74ff609 /vcl
parentda70fd1edc211bf63f8388e11c1bd8dd398fdaf8 (diff)
rework of painting and removal of ImplAnimView using the STL
Change-Id: I9bcfd3e034097c0a3ba17a566201d708cec2b016 Signed-off-by: Adrien Ollier <adr.ollier@hotmail.fr> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87167 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/animate/Animation.cxx27
1 files changed, 11 insertions, 16 deletions
diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index 80115aa730ce..d9eaed56ce73 100644
--- a/vcl/source/animate/Animation.cxx
+++ b/vcl/source/animate/Animation.cxx
@@ -350,22 +350,17 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
}
}
- // Paint all views; after painting check, if view is
- // marked; in this case remove view, because area of output
- // lies out of display area of window; mark state is
- // set from view itself
- for (size_t i = 0; i < maViewList.size();)
- {
- ImplAnimView* pView = maViewList[i].get();
- pView->draw(mnPos);
-
- if (pView->isMarked())
- {
- maViewList.erase(maViewList.begin() + i);
- }
- else
- i++;
- }
+ // Paint all views.
+ std::for_each(maViewList.cbegin(), maViewList.cend(),
+ [this](const auto& pView) { pView->draw(mnPos); });
+ /*
+ * If a view is marked, remove the view, because
+ * area of output lies out of display area of window.
+ * Mark state is set from view itself.
+ */
+ auto removeStart = std::remove_if(maViewList.begin(), maViewList.end(),
+ [](const auto& pView) { return pView->isMarked(); });
+ maViewList.erase(removeStart, maViewList.cend());
// stop or restart timer
if (maViewList.empty())