mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-10 06:34:01 +00:00
lottie: rectified scene building Logic
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.
This commit is contained in:
parent
be809b2103
commit
823b945666
5 changed files with 8 additions and 5 deletions
1
src/examples/resources/11555.json
Normal file
1
src/examples/resources/11555.json
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -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);
|
||||
|
|
|
@ -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.
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue