From ae90a9f18ba2ee00e3937e3f1ae28f2dacd4a358 Mon Sep 17 00:00:00 2001 From: Mira Grudzinska Date: Thu, 30 May 2024 11:39:20 +0200 Subject: [PATCH] lottie: parsing obj property inside this obj Shape's property 'direction' should be parsed together with other properties specific for the shape. This solves the issue with direction- it wasn't working. --- src/loaders/lottie/tvgLottieParser.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/loaders/lottie/tvgLottieParser.cpp b/src/loaders/lottie/tvgLottieParser.cpp index df34bcfc..2920f786 100644 --- a/src/loaders/lottie/tvgLottieParser.cpp +++ b/src/loaders/lottie/tvgLottieParser.cpp @@ -533,8 +533,9 @@ LottieRect* LottieParser::parseRect() while (auto key = nextObjectKey()) { if (parseCommon(rect, key)) continue; else if (KEY_AS("s")) parseProperty(rect->size); - else if (KEY_AS("p"))parseProperty(rect->position); + else if (KEY_AS("p")) parseProperty(rect->position); else if (KEY_AS("r")) parseProperty(rect->radius); + else if (KEY_AS("d")) rect->direction = getDirection(); else skip(key); } rect->prepare(); @@ -552,6 +553,7 @@ LottieEllipse* LottieParser::parseEllipse() if (parseCommon(ellipse, key)) continue; else if (KEY_AS("p")) parseProperty(ellipse->position); else if (KEY_AS("s")) parseProperty(ellipse->size); + else if (KEY_AS("d")) ellipse->direction = getDirection(); else skip(key); } ellipse->prepare(); @@ -688,6 +690,7 @@ LottiePath* LottieParser::parsePath() while (auto key = nextObjectKey()) { if (parseCommon(path, key)) continue; else if (KEY_AS("ks")) getPathSet(path->pathset); + else if (KEY_AS("d")) path->direction = getDirection(); else skip(key); } path->prepare(); @@ -711,6 +714,7 @@ LottiePolyStar* LottieParser::parsePolyStar() else if (KEY_AS("os")) parseProperty(star->outerRoundness); else if (KEY_AS("r")) parseProperty(star->rotation); else if (KEY_AS("sy")) star->type = (LottiePolyStar::Type) getInt(); + else if (KEY_AS("d")) star->direction = getDirection(); else skip(key); } star->prepare(); @@ -1079,23 +1083,17 @@ uint8_t LottieParser::getDirection() void LottieParser::parseShapes(Array& parent) { - uint8_t direction; - enterArray(); while (nextArrayValue()) { - direction = 0; enterObject(); while (auto key = nextObjectKey()) { if (KEY_AS("it")) { enterArray(); while (nextArrayValue()) parseObject(parent); - } else if (KEY_AS("d")) { - direction = getDirection(); } else if (KEY_AS("ty")) { if (auto child = parseObject()) { if (child->hidden) delete(child); else parent.push(child); - if (direction > 0) static_cast(child)->direction = direction; } } else skip(key); }