1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
11 #include <vcl/BitmapFilter.hxx>
12 #include <vcl/animate/Animation.hxx>
14 #include <sal/log.hxx>
16 BitmapFilter::BitmapFilter() {}
18 BitmapFilter::~BitmapFilter() {}
20 bool BitmapFilter::Filter(BitmapEx
& rBmpEx
, BitmapFilter
const& rFilter
)
27 BitmapEx
aTmpBmpEx(rFilter
.execute(rBmpEx
));
29 if (aTmpBmpEx
.IsEmpty())
31 SAL_WARN("vcl.gdi", "Bitmap filter failed");
39 bool BitmapFilter::Filter(Animation
& rAnimation
, BitmapFilter
const& rFilter
)
41 SAL_WARN_IF(rAnimation
.IsInAnimation(), "vcl", "Animation modified while it is animated");
45 if (!rAnimation
.IsInAnimation() && !rAnimation
.Count())
49 std::vector
<std::unique_ptr
<AnimationBitmap
>>& aList
= rAnimation
.GetAnimationFrames();
50 for (size_t i
= 0, n
= aList
.size(); (i
< n
) && bRet
; ++i
)
52 bRet
= BitmapFilter::Filter(aList
[i
]->maBitmapEx
, rFilter
);
55 BitmapEx
aBmpEx(rAnimation
.GetBitmapEx());
56 BitmapFilter::Filter(aBmpEx
, rFilter
);
57 rAnimation
.SetBitmapEx(aBmpEx
);
63 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */