lottie: support matte+masking combination

introduced an intermediate scene for embracing
the matte and maskings
This commit is contained in:
Hermet Park 2024-08-08 11:48:09 +09:00 committed by Hermet Park
parent 69dccc326a
commit 3e78a95b57

View file

@ -1195,6 +1195,13 @@ static void _updateMaskings(LottieLayer* layer, float frameNo, LottieExpressions
{
if (layer->masks.count == 0) return;
//Introduce an intermediate scene for embracing the matte + masking
if (layer->matteTarget) {
auto scene = Scene::gen().release();
scene->push(cast(layer->scene));
layer->scene = scene;
}
//Apply the base mask
auto pMask = static_cast<LottieMask*>(layer->masks[0]);
auto pMethod = pMask->method;
@ -1277,12 +1284,8 @@ static void _updateLayer(LottieComposition* comp, Scene* scene, LottieLayer* lay
layer->scene->transform(layer->cache.matrix);
if (layer->matteTarget && layer->masks.count > 0) TVGERR("LOTTIE", "FIXME: Matte + Masking??");
if (!_updateMatte(comp, frameNo, scene, layer, exps)) return;
_updateMaskings(layer, frameNo, exps);
switch (layer->type) {
case LottieLayer::Precomp: {
_updatePrecomp(comp, layer, frameNo, exps);
@ -1311,6 +1314,8 @@ static void _updateLayer(LottieComposition* comp, Scene* scene, LottieLayer* lay
}
}
_updateMaskings(layer, frameNo, exps);
layer->scene->blend(layer->blendMethod);
//the given matte source was composited by the target earlier.