diff options
author | Adrien Ollier <adr.ollier@hotmail.fr> | 2019-05-04 07:20:36 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-05-05 08:05:08 +0200 |
commit | d83b1383ffbe98502c196cccae4bcb2eb3978f6a (patch) | |
tree | e27147cfc9ed08d86d2fa4be231d9ec98e0121f6 /vcl | |
parent | 007d6b5b9e7c94ab93b2798f832467c26291cf31 (diff) |
using an algorithm of the STL
makes the function shorter
Change-Id: I22118d9b86e5497cb9b566efe9151f2da646cb16
Signed-off-by: Adrien Ollier <adr.ollier@hotmail.fr>
Reviewed-on: https://gerrit.libreoffice.org/71806
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/animate/Animation.cxx | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx index 1382178aa6a0..3aeeadc649a8 100644 --- a/vcl/source/animate/Animation.cxx +++ b/vcl/source/animate/Animation.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <algorithm> #include <sal/config.h> #include <tools/stream.hxx> @@ -107,28 +108,20 @@ void Animation::Clear() bool Animation::IsTransparent() const { - tools::Rectangle aRect(Point(), maGlobalSize); - bool bRet = false; + tools::Rectangle aRect{ Point(), maGlobalSize }; // If some small bitmap needs to be replaced by the background, // we need to be transparent, in order to be displayed correctly // as the application (?) does not invalidate on non-transparent // graphics due to performance reasons. - for (auto const& pAnimationBitmap : maList) - { - if (Disposal::Back == pAnimationBitmap->meDisposal - && tools::Rectangle(pAnimationBitmap->maPositionPixel, pAnimationBitmap->maSizePixel) - != aRect) - { - bRet = true; - break; - } - } - if (!bRet) - bRet = maBitmapEx.IsTransparent(); - - return bRet; + return std::any_of(maList.begin(), maList.end(), + [&aRect](const std::unique_ptr<AnimationBitmap>& pAnim) -> bool { + return pAnim->meDisposal == Disposal::Back + && tools::Rectangle{ pAnim->maPositionPixel, pAnim->maSizePixel } + != aRect; + }) + || maBitmapEx.IsTransparent(); } sal_uLong Animation::GetSizeBytes() const |