mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-14 12:04:29 +00:00
lottie/builder: fix an invalid matting result.
Previously, it ignored the matte when it was out of frames for the sake of optimization. However, this led to an incorrect matting result. It should make the scene invisible when the matting is invisible.
This commit is contained in:
parent
edb156f4fc
commit
5b8c66f5c8
1 changed files with 12 additions and 12 deletions
|
@ -799,29 +799,29 @@ static void _updateLayer(LottieLayer* root, LottieLayer* layer, int32_t frameNo)
|
|||
|
||||
_updateTransform(layer, frameNo);
|
||||
|
||||
//full transparent scene. no need to perform
|
||||
if (layer->type != LottieLayer::Null && layer->cache.opacity == 0) return;
|
||||
|
||||
//Prepare render data
|
||||
layer->scene = Scene::gen().release();
|
||||
|
||||
//FIXME: Ignore opacity when Null layer?
|
||||
if (layer->type != LottieLayer::Null) {
|
||||
if (layer->cache.opacity == 0 && !layer->matteSrc) {
|
||||
delete(layer->scene);
|
||||
layer->scene = nullptr;
|
||||
return;
|
||||
}
|
||||
layer->scene->opacity(layer->cache.opacity);
|
||||
}
|
||||
//ignore opacity when Null layer?
|
||||
if (layer->type != LottieLayer::Null) layer->scene->opacity(layer->cache.opacity);
|
||||
|
||||
layer->scene->transform(layer->cache.matrix);
|
||||
|
||||
if (layer->matte.target && layer->masks.count > 0) {
|
||||
TVGERR("LOTTIE", "FIXME: Matte + Masking??");
|
||||
}
|
||||
if (layer->matte.target && layer->masks.count > 0) TVGERR("LOTTIE", "FIXME: Matte + Masking??");
|
||||
|
||||
//matte masking layer
|
||||
if (layer->matte.target) {
|
||||
_updateLayer(root, layer->matte.target, frameNo);
|
||||
if (layer->matte.target->scene) layer->scene->composite(cast<Scene>(layer->matte.target->scene), layer->matte.type);
|
||||
else if (layer->matte.type == CompositeMethod::AlphaMask || layer->matte.type == CompositeMethod::LumaMask) {
|
||||
//matte target is not exist. alpha blending definitely bring an invisible result
|
||||
delete(layer->scene);
|
||||
layer->scene = nullptr;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_updateMaskings(layer, frameNo);
|
||||
|
|
Loading…
Add table
Reference in a new issue