mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
lottie: support matte+masking combination
introduced an intermediate scene for embracing the matte and maskings
This commit is contained in:
parent
69dccc326a
commit
3e78a95b57
1 changed files with 9 additions and 4 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Reference in a new issue