lottie: fix repeater order

Assigning numbers 1 or 2 to a bool always
resulted in true. Now fixed and repeated
shapes are drawn in the proper order.
If the repeater had no elements, iterating
shapes from the end would result in a segf.
This issue is now fixed.
This commit is contained in:
Mira Grudzinska 2024-06-18 16:54:19 +02:00 committed by Hermet Park
parent 6f33a2bcbb
commit d7ab592fb9
2 changed files with 2 additions and 2 deletions

View file

@ -437,7 +437,7 @@ static void _repeat(LottieGroup* parent, unique_ptr<Shape> path, RenderContext*
parent->scene->push(cast(*shape));
propagators.push(*shape);
}
} else {
} else if (!shapes.empty()) {
for (auto shape = shapes.end() - 1; shape >= shapes.begin(); --shape) {
parent->scene->push(cast(*shape));
propagators.push(*shape);

View file

@ -828,7 +828,7 @@ LottieRepeater* LottieParser::parseRepeater()
if (parseCommon(repeater, key)) continue;
else if (KEY_AS("c")) parseProperty<LottieProperty::Type::Float>(repeater->copies);
else if (KEY_AS("o")) parseProperty<LottieProperty::Type::Float>(repeater->offset);
else if (KEY_AS("m")) repeater->inorder = getInt();
else if (KEY_AS("m")) repeater->inorder = getInt() == 2;
else if (KEY_AS("tr"))
{
enterObject();