MCPcopy Create free account
hub / github.com/Samsung/rlottie / parsePolystarObject

Method parsePolystarObject

src/lottie/lottieparser.cpp:1342–1386  ·  view source on GitHub ↗

* https://github.com/airbnb/lottie-web/blob/master/docs/json/shapes/star.json */

Source from the content-addressed store, hash-verified

1340 * https://github.com/airbnb/lottie-web/blob/master/docs/json/shapes/star.json
1341 */
1342model::Polystar *LottieParserImpl::parsePolystarObject()
1343{
1344 auto obj = allocator().make<model::Polystar>();
1345
1346 while (const char *key = NextObjectKey()) {
1347 if (0 == strcmp(key, "nm")) {
1348 obj->setName(GetString());
1349 } else if (0 == strcmp(key, "p")) {
1350 parseProperty(obj->mPos);
1351 } else if (0 == strcmp(key, "pt")) {
1352 parseProperty(obj->mPointCount);
1353 } else if (0 == strcmp(key, "ir")) {
1354 parseProperty(obj->mInnerRadius);
1355 } else if (0 == strcmp(key, "is")) {
1356 parseProperty(obj->mInnerRoundness);
1357 } else if (0 == strcmp(key, "or")) {
1358 parseProperty(obj->mOuterRadius);
1359 } else if (0 == strcmp(key, "os")) {
1360 parseProperty(obj->mOuterRoundness);
1361 } else if (0 == strcmp(key, "r")) {
1362 parseProperty(obj->mRotation);
1363 } else if (0 == strcmp(key, "sy")) {
1364 int starType = GetInt();
1365 if (starType == 1) obj->mPolyType = model::Polystar::PolyType::Star;
1366 if (starType == 2)
1367 obj->mPolyType = model::Polystar::PolyType::Polygon;
1368 } else if (0 == strcmp(key, "d")) {
1369 obj->mDirection = GetInt();
1370 } else if (0 == strcmp(key, "hd")) {
1371 obj->setHidden(GetBool());
1372 } else {
1373#ifdef DEBUG_PARSER
1374 vDebug << "Polystar property ignored :" << key;
1375#endif
1376 Skip(key);
1377 }
1378 }
1379 obj->setStatic(
1380 obj->mPos.isStatic() && obj->mPointCount.isStatic() &&
1381 obj->mInnerRadius.isStatic() && obj->mInnerRoundness.isStatic() &&
1382 obj->mOuterRadius.isStatic() && obj->mOuterRoundness.isStatic() &&
1383 obj->mRotation.isStatic());
1384
1385 return obj;
1386}
1387
1388model::Trim::TrimType LottieParserImpl::getTrimType()
1389{

Callers

nothing calls this directly

Calls 7

GetIntFunction · 0.85
GetBoolFunction · 0.85
setHiddenMethod · 0.80
GetStringFunction · 0.50
setNameMethod · 0.45
setStaticMethod · 0.45
isStaticMethod · 0.45

Tested by

no test coverage detected