Skip to content

Commit

Permalink
lottie: rectified scene building Logic
Browse files Browse the repository at this point in the history
resolved a corner case where assets were being attached
multiple times during scene building. This issue was causing
a significant performence drop in image animation
in certain scenarios.
  • Loading branch information
hermet committed Jan 24, 2024
1 parent be809b2 commit 823b945
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/examples/resources/11555.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion src/examples/resources/loading_siri.json

This file was deleted.

2 changes: 2 additions & 0 deletions src/loaders/lottie/tvgLottieBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1091,6 +1091,8 @@ static void _attachFont(LottieComposition* comp, LottieLayer* parent)
static bool _buildComposition(LottieComposition* comp, LottieGroup* parent)
{
if (parent->children.count == 0) return false;
if (parent->buildDone) return true;
parent->buildDone = true;

for (auto c = parent->children.data; c < parent->children.end(); ++c) {
auto child = static_cast<LottieLayer*>(*c);
Expand Down
1 change: 1 addition & 0 deletions src/loaders/lottie/tvgLottieModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ struct LottieGroup : LottieObject
Array<LottieObject*> children;

bool reqFragment = false; //requirment to fragment the render context
bool buildDone = false; //completed in building the composition.
};


Expand Down
8 changes: 4 additions & 4 deletions src/renderer/sw_engine/tvgSwRasterTexmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -528,8 +528,8 @@ static void _rasterPolygonImageSegment(SwSurface* surface, const SwImage* image,
vv = (int) v;
if (vv >= sh) continue;

ar = (int)(255 * (1 - modff(u, &iptr)));
ab = (int)(255 * (1 - modff(v, &iptr)));
ar = (int)(255.0f * (1.0f - modff(u, &iptr)));
ab = (int)(255.0f * (1.0f - modff(v, &iptr)));
iru = uu + 1;
irv = vv + 1;

Expand Down Expand Up @@ -576,8 +576,8 @@ static void _rasterPolygonImageSegment(SwSurface* surface, const SwImage* image,
uu = (int) u;
vv = (int) v;

ar = (int)(255 * (1 - modff(u, &iptr)));
ab = (int)(255 * (1 - modff(v, &iptr)));
ar = (int)(255.0f * (1.0f - modff(u, &iptr)));
ab = (int)(255.0f * (1.0f - modff(v, &iptr)));
iru = uu + 1;
irv = vv + 1;

Expand Down

0 comments on commit 823b945

Please sign in to comment.