mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-09 14:13:43 +00:00
loader/lottie: do not draw zero size content
skip rendering by setting opacity zero, if the scale factor is zero.
This commit is contained in:
parent
46d831ead7
commit
3752ad93b3
1 changed files with 6 additions and 4 deletions
|
@ -125,7 +125,9 @@ static bool _updateTransform(LottieTransform* transform, int32_t frameNo, bool a
|
|||
auto anchor = transform->anchor(frameNo);
|
||||
mathTranslateR(&matrix, -anchor.x, -anchor.y);
|
||||
|
||||
opacity = transform->opacity(frameNo);
|
||||
//invisible just in case.
|
||||
if (scale.x == 0.0f || scale.y == 0.0f) opacity = 0;
|
||||
else opacity = transform->opacity(frameNo);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -779,20 +781,20 @@ static void _updateLayer(LottieLayer* root, LottieLayer* layer, int32_t frameNo)
|
|||
{
|
||||
//visibility
|
||||
if (frameNo < layer->inFrame || frameNo > layer->outFrame) return;
|
||||
auto opacity = layer->opacity(frameNo);
|
||||
if (opacity == 0) return;
|
||||
|
||||
_updateTransform(layer, frameNo);
|
||||
|
||||
//Prepare render data
|
||||
layer->scene = Scene::gen().release();
|
||||
layer->scene->transform(layer->cache.matrix);
|
||||
|
||||
//FIXME: Ignore opacity when Null layer?
|
||||
if (layer->type != LottieLayer::Null) {
|
||||
layer->scene->opacity(layer->cache.opacity);
|
||||
if (layer->cache.opacity == 0) return;
|
||||
}
|
||||
|
||||
layer->scene->transform(layer->cache.matrix);
|
||||
|
||||
auto rFrameNo = layer->remap(frameNo);
|
||||
|
||||
switch (layer->type) {
|
||||
|
|
Loading…
Add table
Reference in a new issue