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

Adrien Ollier (via logerrit) logerrit at kemper.freedesktop.org
Wed Jan 22 07:13:27 UTC 2020


 vcl/source/animate/Animation.cxx |   27 +++++++++++----------------
 1 file changed, 11 insertions(+), 16 deletions(-)

New commits:
commit f6c01b471a08ad1cb38377b8d82dba89206ea8cb
Author:     Adrien Ollier <adr.ollier at hotmail.fr>
AuthorDate: Tue Jan 21 22:38:06 2020 +0100
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Wed Jan 22 08:12:52 2020 +0100

    rework of painting and removal of ImplAnimView using the STL
    
    Change-Id: I9bcfd3e034097c0a3ba17a566201d708cec2b016
    Signed-off-by: Adrien Ollier <adr.ollier at hotmail.fr>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87167
    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 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())


More information about the Libreoffice-commits mailing list