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
)
22 BitmapEx
aTmpBmpEx(rFilter
.execute(rBmpEx
));
24 if (aTmpBmpEx
.IsEmpty())
26 SAL_WARN("vcl.gdi", "Bitmap filter failed");
34 bool BitmapFilter::Filter(Animation
& rAnimation
, BitmapFilter
const & rFilter
)
36 SAL_WARN_IF(rAnimation
.IsInAnimation(), "vcl", "Animation modified while it is animated");
40 if (!rAnimation
.IsInAnimation() && !rAnimation
.Count())
44 std::vector
<std::unique_ptr
<AnimationBitmap
>>& aList
= rAnimation
.GetAnimationFrames();
45 for (size_t i
= 0, n
= aList
.size(); (i
< n
) && bRet
; ++i
)
47 bRet
= BitmapFilter::Filter(aList
[i
]->maBitmapEx
, rFilter
);
50 BitmapEx
aBmpEx(rAnimation
.GetBitmapEx());
51 BitmapFilter::Filter(aBmpEx
, rFilter
);
52 rAnimation
.SetBitmapEx(aBmpEx
);
58 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */