vcl/source/animate/Animation.cxx |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

New commits:
commit bf248da3aad67abd2ccd154b747314217111719c
Author:     Christopher Sherlock <[email protected]>
AuthorDate: Sun Feb 23 14:14:32 2025 +1100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Thu Apr 17 14:18:01 2025 +0200

    vcl: use std::accumulate() for Animation::GetSizeBytes()
    
    Change-Id: Iaa27d472cc86dbc22b6fe06da0a1f0af1e8cf324
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182048
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index 772a7d70526b..c8a52fddf391 100644
--- a/vcl/source/animate/Animation.cxx
+++ b/vcl/source/animate/Animation.cxx
@@ -128,14 +128,10 @@ bool Animation::IsTransparent() const
 
 sal_uLong Animation::GetSizeBytes() const
 {
-    sal_uLong nSizeBytes = GetBitmapEx().GetSizeBytes();
-
-    for (auto const& pAnimationFrame : maFrames)
-    {
-        nSizeBytes += pAnimationFrame->maBitmapEx.GetSizeBytes();
-    }
-
-    return nSizeBytes;
+    return std::accumulate(maFrames.begin(), maFrames.end(), 
GetBitmapEx().GetSizeBytes(),
+                           [](sal_Int64 nSize, const 
std::unique_ptr<AnimationFrame>& pFrame) {
+                               return nSize + 
pFrame->maBitmapEx.GetSizeBytes();
+                           });
 }
 
 BitmapChecksum Animation::GetChecksum() const

Reply via email to