summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsubhransu mohanty <sub.mohanty@samsung.com>2017-12-20 13:51:46 +0900
committersubhransu mohanty <sub.mohanty@samsung.com>2018-04-12 13:51:52 +0900
commit7fc9a6060c71b6781f948a3d4e3f9c378cdd4062 (patch)
tree00aa226c217e5ac4b910a28effb9a688641269c0
parent1a021f700c63315955d65eb87a6170e920a1f5f7 (diff)
lottie: make all lotti node as shared node
-rw-r--r--ssg/src/lottie/lottiemodel.cpp16
-rw-r--r--ssg/src/lottie/lottiemodel.h17
-rw-r--r--ssg/src/lottie/lottieparser.cpp146
3 files changed, 105 insertions, 74 deletions
diff --git a/ssg/src/lottie/lottiemodel.cpp b/ssg/src/lottie/lottiemodel.cpp
index 0a3dffe30b..3e5c7bd62d 100644
--- a/ssg/src/lottie/lottiemodel.cpp
+++ b/ssg/src/lottie/lottiemodel.cpp
@@ -18,11 +18,12 @@ public:
18 void visit(LottieStrokeObject *) {} 18 void visit(LottieStrokeObject *) {}
19 void visitChildren(LottieGroupObject *obj) { 19 void visitChildren(LottieGroupObject *obj) {
20 for(auto child :obj->mChildren) { 20 for(auto child :obj->mChildren) {
21 child->accept(this); 21 child.get()->accept(this);
22 if (mRepeaterFound) { 22 if (mRepeaterFound) {
23 LottieRepeaterObject *repeater = static_cast<LottieRepeaterObject *>(child); 23 LottieRepeaterObject *repeater = static_cast<LottieRepeaterObject *>(child.get());
24 LottieShapeGroup *shapeGroup = new LottieShapeGroup(); 24 std::shared_ptr<LottieShapeGroup> sharedShapeGroup= std::make_shared<LottieShapeGroup>();
25 repeater->mChildren.push_back(shapeGroup); 25 LottieShapeGroup *shapeGroup = sharedShapeGroup.get();
26 repeater->mChildren.push_back(sharedShapeGroup);
26 // copy all the child of the object till repeater and 27 // copy all the child of the object till repeater and
27 // move that in to a group and then add that group to 28 // move that in to a group and then add that group to
28 // the repeater object. 29 // the repeater object.
@@ -31,9 +32,9 @@ public:
31 break; 32 break;
32 // we shouldn't copy the trim as trim operation is 33 // we shouldn't copy the trim as trim operation is
33 // already applied to the objects. 34 // already applied to the objects.
34 if (cpChild->type() == LottieObject::Type::Trim) 35 if (cpChild.get()->type() == LottieObject::Type::Trim)
35 continue; 36 continue;
36 shapeGroup->mChildren.push_back(cpChild->copy()); 37 shapeGroup->mChildren.push_back(cpChild);
37 } 38 }
38 mRepeaterFound = false; 39 mRepeaterFound = false;
39 } 40 }
@@ -56,8 +57,9 @@ void LottieComposition::processRepeaterObjects()
56 */ 57 */
57LottieGroupObject::LottieGroupObject(const LottieGroupObject &other):LottieObject(other.mType) 58LottieGroupObject::LottieGroupObject(const LottieGroupObject &other):LottieObject(other.mType)
58{ 59{
60 sgDebug<<"We Shouldn't come here ************************";
59 for(auto child: other.mChildren) { 61 for(auto child: other.mChildren) {
60 mChildren.push_back(child->copy()); 62 mChildren.push_back(child);
61 } 63 }
62} 64}
63 65
diff --git a/ssg/src/lottie/lottiemodel.h b/ssg/src/lottie/lottiemodel.h
index 52fd1e30a7..29e8fbe65b 100644
--- a/ssg/src/lottie/lottiemodel.h
+++ b/ssg/src/lottie/lottiemodel.h
@@ -147,12 +147,12 @@ class LottieGroupObject: public LottieObject
147public: 147public:
148 LottieGroupObject(LottieObject::Type type):LottieObject(type){} 148 LottieGroupObject(LottieObject::Type type):LottieObject(type){}
149 LottieGroupObject(const LottieGroupObject &other); 149 LottieGroupObject(const LottieGroupObject &other);
150 ~LottieGroupObject() { 150// ~LottieGroupObject() {
151 for(auto child : mChildren) 151// for(auto child : mChildren)
152 delete child; 152// delete child;
153 } 153// }
154public: 154public:
155 std::vector<LottieObject *> mChildren; 155 std::vector<std::shared_ptr<LottieObject>> mChildren;
156}; 156};
157 157
158class LottieShapeGroup : public LottieGroupObject 158class LottieShapeGroup : public LottieGroupObject
@@ -204,7 +204,7 @@ public:
204 long mStartTime; 204 long mStartTime;
205 LottieBlendMode mBlendMode; 205 LottieBlendMode mBlendMode;
206 float mTimeStreatch; 206 float mTimeStreatch;
207 LottieTransform *mTransform; 207 std::shared_ptr<LottieObject> mTransform;
208}; 208};
209 209
210class LottieTransform : public LottieObject 210class LottieTransform : public LottieObject
@@ -351,13 +351,12 @@ public:
351 {visitor->visit(this); visitor->visitChildren(this);} 351 {visitor->visit(this); visitor->visitChildren(this);}
352 LottieRepeaterObject():LottieGroupObject(LottieObject::Type::Repeater), 352 LottieRepeaterObject():LottieGroupObject(LottieObject::Type::Repeater),
353 mCopies(0), 353 mCopies(0),
354 mOffset(0), 354 mOffset(0){}
355 mTransform(nullptr){}
356 LottieObject *copy() {return new LottieRepeaterObject(*this);} 355 LottieObject *copy() {return new LottieRepeaterObject(*this);}
357public: 356public:
358 LottieAnimatable<float> mCopies; 357 LottieAnimatable<float> mCopies;
359 LottieAnimatable<float> mOffset; 358 LottieAnimatable<float> mOffset;
360 LottieTransform *mTransform; 359 std::shared_ptr<LottieObject> mTransform;
361}; 360};
362 361
363 362
diff --git a/ssg/src/lottie/lottieparser.cpp b/ssg/src/lottie/lottieparser.cpp
index 0335babcd3..725d9b88ff 100644
--- a/ssg/src/lottie/lottieparser.cpp
+++ b/ssg/src/lottie/lottieparser.cpp
@@ -135,24 +135,24 @@ public:
135 JoinStyle getLineJoin(); 135 JoinStyle getLineJoin();
136 LottieTrimObject::TrimType getTrimType(); 136 LottieTrimObject::TrimType getTrimType();
137 137
138 LottieComposition *parseComposition(); 138 std::shared_ptr<LottieComposition> parseComposition();
139 void parseLayers(LottieComposition *comp); 139 void parseLayers(LottieComposition *comp);
140 LottieLayer *parseLayer(); 140 std::shared_ptr<LottieObject> parseLayer();
141 void parseShapesAttr(LottieLayer *layer); 141 void parseShapesAttr(LottieLayer *layer);
142 void parseObject(LottieGroupObject *parent); 142 void parseObject(LottieGroupObject *parent);
143 LottieObject* parseObjectTypeAttr(); 143 std::shared_ptr<LottieObject> parseObjectTypeAttr();
144 LottieObject *parseGroupObject(); 144 std::shared_ptr<LottieObject> parseGroupObject();
145 LottieObject *parseRectObject(); 145 std::shared_ptr<LottieObject> parseRectObject();
146 LottieObject *parseEllipseObject(); 146 std::shared_ptr<LottieObject> parseEllipseObject();
147 LottieObject *parseShapeObject(); 147 std::shared_ptr<LottieObject> parseShapeObject();
148 148
149 LottieTransform *parseTransformObject(); 149 std::shared_ptr<LottieObject> parseTransformObject();
150 LottieObject *parseFillObject(); 150 std::shared_ptr<LottieObject> parseFillObject();
151 LottieObject *parseGradientFillObject(); 151 std::shared_ptr<LottieObject> parseGradientFillObject();
152 LottieObject *parseStrokeObject(); 152 std::shared_ptr<LottieObject> parseStrokeObject();
153 LottieObject *parseGradientStrokeObject(); 153 std::shared_ptr<LottieObject> parseGradientStrokeObject();
154 LottieObject *parseTrimObject(); 154 std::shared_ptr<LottieObject> parseTrimObject();
155 LottieObject *parseReapeaterObject(); 155 std::shared_ptr<LottieObject> parseReapeaterObject();
156 156
157 SGPointF parseInperpolatorPoint(); 157 SGPointF parseInperpolatorPoint();
158 void parseArrayValue(SGPointF &pt); 158 void parseArrayValue(SGPointF &pt);
@@ -425,11 +425,13 @@ SGRect LottieParser::getRect()
425 return r; 425 return r;
426} 426}
427 427
428LottieComposition *LottieParser::parseComposition() 428std::shared_ptr<LottieComposition>
429LottieParser::parseComposition()
429{ 430{
430 RAPIDJSON_ASSERT(PeekType() == kObjectType); 431 RAPIDJSON_ASSERT(PeekType() == kObjectType);
431 EnterObject(); 432 EnterObject();
432 LottieComposition *comp = new LottieComposition(); 433 std::shared_ptr<LottieComposition> sharedComposition = std::make_shared<LottieComposition>();
434 LottieComposition *comp = sharedComposition.get();
433 compRef = comp; 435 compRef = comp;
434 while (const char* key = NextObjectKey()) { 436 while (const char* key = NextObjectKey()) {
435 if (0 == strcmp(key, "w")) { 437 if (0 == strcmp(key, "w")) {
@@ -459,10 +461,11 @@ LottieComposition *LottieParser::parseComposition()
459 // update the static property of Composition 461 // update the static property of Composition
460 bool staticFlag = true; 462 bool staticFlag = true;
461 for (auto child : comp->mChildren) { 463 for (auto child : comp->mChildren) {
462 staticFlag &= child->isStatic(); 464 staticFlag &= child.get()->isStatic();
463 } 465 }
464 comp->setStatic(staticFlag); 466 comp->setStatic(staticFlag);
465 return comp; 467
468 return sharedComposition;
466} 469}
467 470
468void LottieParser::parseLayers(LottieComposition *composition) 471void LottieParser::parseLayers(LottieComposition *composition)
@@ -470,7 +473,7 @@ void LottieParser::parseLayers(LottieComposition *composition)
470 RAPIDJSON_ASSERT(PeekType() == kArrayType); 473 RAPIDJSON_ASSERT(PeekType() == kArrayType);
471 EnterArray(); 474 EnterArray();
472 while (NextArrayValue()) { 475 while (NextArrayValue()) {
473 auto layer = parseLayer(); 476 std::shared_ptr<LottieObject> layer = parseLayer();
474 composition->mChildren.push_back(layer); 477 composition->mChildren.push_back(layer);
475 } 478 }
476} 479}
@@ -479,10 +482,12 @@ void LottieParser::parseLayers(LottieComposition *composition)
479 * https://github.com/airbnb/lottie-web/blob/master/docs/json/layers/shape.json 482 * https://github.com/airbnb/lottie-web/blob/master/docs/json/layers/shape.json
480 * 483 *
481 */ 484 */
482LottieLayer * LottieParser::parseLayer() 485std::shared_ptr<LottieObject>
486LottieParser::parseLayer()
483{ 487{
484 RAPIDJSON_ASSERT(PeekType() == kObjectType); 488 RAPIDJSON_ASSERT(PeekType() == kObjectType);
485 LottieLayer *layer = new LottieLayer(); 489 std::shared_ptr<LottieLayer> sharedLayer = std::make_shared<LottieLayer>();
490 LottieLayer *layer = sharedLayer.get();
486 EnterObject(); 491 EnterObject();
487 while (const char* key = NextObjectKey()) { 492 while (const char* key = NextObjectKey()) {
488 if (0 == strcmp(key, "ty")) { /* Type of layer: Shape. Value 4.*/ 493 if (0 == strcmp(key, "ty")) { /* Type of layer: Shape. Value 4.*/
@@ -526,13 +531,13 @@ LottieLayer * LottieParser::parseLayer()
526 // update the static property of layer 531 // update the static property of layer
527 bool staticFlag = true; 532 bool staticFlag = true;
528 for (auto child : layer->mChildren) { 533 for (auto child : layer->mChildren) {
529 staticFlag &= child->isStatic(); 534 staticFlag &= child.get()->isStatic();
530 } 535 }
531 536
532 layer->setStatic(staticFlag && 537 layer->setStatic(staticFlag &&
533 layer->mTransform->isStatic()); 538 layer->mTransform->isStatic());
534 539
535 return layer; 540 return sharedLayer;
536} 541}
537 542
538void LottieParser::parseShapesAttr(LottieLayer *layer) 543void LottieParser::parseShapesAttr(LottieLayer *layer)
@@ -544,7 +549,7 @@ void LottieParser::parseShapesAttr(LottieLayer *layer)
544 } 549 }
545} 550}
546 551
547LottieObject* 552std::shared_ptr<LottieObject>
548LottieParser::parseObjectTypeAttr() 553LottieParser::parseObjectTypeAttr()
549{ 554{
550 RAPIDJSON_ASSERT(PeekType() == kStringType); 555 RAPIDJSON_ASSERT(PeekType() == kStringType);
@@ -591,10 +596,12 @@ LottieParser::parseObject(LottieGroupObject *parent)
591 } 596 }
592} 597}
593 598
594LottieObject * 599std::shared_ptr<LottieObject>
595LottieParser::parseGroupObject() 600LottieParser::parseGroupObject()
596{ 601{
597 LottieShapeGroup *group = new LottieShapeGroup(); 602 std::shared_ptr<LottieShapeGroup> sharedGroup = std::make_shared<LottieShapeGroup>();
603
604 LottieShapeGroup *group = sharedGroup.get();
598 while (const char* key = NextObjectKey()) { 605 while (const char* key = NextObjectKey()) {
599 if (0 == strcmp(key, "it")) { 606 if (0 == strcmp(key, "it")) {
600 RAPIDJSON_ASSERT(PeekType() == kArrayType); 607 RAPIDJSON_ASSERT(PeekType() == kArrayType);
@@ -609,19 +616,22 @@ LottieParser::parseGroupObject()
609 } 616 }
610 bool staticFlag = true; 617 bool staticFlag = true;
611 for (auto child : group->mChildren) { 618 for (auto child : group->mChildren) {
612 staticFlag &= child->isStatic(); 619 staticFlag &= child.get()->isStatic();
613 } 620 }
614 group->setStatic(staticFlag); 621 group->setStatic(staticFlag);
615 return group; 622
623 return sharedGroup;
616} 624}
617 625
618/* 626/*
619 * https://github.com/airbnb/lottie-web/blob/master/docs/json/shapes/rect.json 627 * https://github.com/airbnb/lottie-web/blob/master/docs/json/shapes/rect.json
620 */ 628 */
621LottieObject * 629std::shared_ptr<LottieObject>
622LottieParser::parseRectObject() 630LottieParser::parseRectObject()
623{ 631{
624 LottieRectObject *obj = new LottieRectObject(); 632 std::shared_ptr<LottieRectObject> sharedRect = std::make_shared<LottieRectObject>();
633 LottieRectObject *obj = sharedRect.get();
634
625 while (const char* key = NextObjectKey()) { 635 while (const char* key = NextObjectKey()) {
626 if (0 == strcmp(key, "p")) { 636 if (0 == strcmp(key, "p")) {
627 parseProperty(obj->mPos); 637 parseProperty(obj->mPos);
@@ -638,16 +648,18 @@ LottieParser::parseRectObject()
638 obj->setStatic(obj->mPos.isStatic() && 648 obj->setStatic(obj->mPos.isStatic() &&
639 obj->mSize.isStatic() && 649 obj->mSize.isStatic() &&
640 obj->mRound.isStatic()); 650 obj->mRound.isStatic());
641 return obj; 651 return sharedRect;
642} 652}
643 653
644/* 654/*
645 * https://github.com/airbnb/lottie-web/blob/master/docs/json/shapes/ellipse.json 655 * https://github.com/airbnb/lottie-web/blob/master/docs/json/shapes/ellipse.json
646 */ 656 */
647LottieObject * 657std::shared_ptr<LottieObject>
648LottieParser::parseEllipseObject() 658LottieParser::parseEllipseObject()
649{ 659{
650 LottieEllipseObject *obj = new LottieEllipseObject(); 660 std::shared_ptr<LottieEllipseObject> sharedEllipse = std::make_shared<LottieEllipseObject>();
661 LottieEllipseObject *obj = sharedEllipse.get();
662
651 while (const char* key = NextObjectKey()) { 663 while (const char* key = NextObjectKey()) {
652 if (0 == strcmp(key, "p")) { 664 if (0 == strcmp(key, "p")) {
653 parseProperty(obj->mPos); 665 parseProperty(obj->mPos);
@@ -659,16 +671,18 @@ LottieParser::parseEllipseObject()
659 } 671 }
660 obj->setStatic(obj->mPos.isStatic() && 672 obj->setStatic(obj->mPos.isStatic() &&
661 obj->mSize.isStatic()); 673 obj->mSize.isStatic());
662 return obj; 674 return sharedEllipse;
663} 675}
664 676
665/* 677/*
666 * https://github.com/airbnb/lottie-web/blob/master/docs/json/properties/shape.json 678 * https://github.com/airbnb/lottie-web/blob/master/docs/json/properties/shape.json
667 */ 679 */
668LottieObject * 680std::shared_ptr<LottieObject>
669LottieParser::parseShapeObject() 681LottieParser::parseShapeObject()
670{ 682{
671 LottieShapeObject *obj = new LottieShapeObject(); 683 std::shared_ptr<LottieShapeObject> sharedShape = std::make_shared<LottieShapeObject>();
684 LottieShapeObject *obj = sharedShape.get();
685
672 while (const char* key = NextObjectKey()) { 686 while (const char* key = NextObjectKey()) {
673 if (0 == strcmp(key, "ks")) { 687 if (0 == strcmp(key, "ks")) {
674 parseShapeProperty(obj->mShape); 688 parseShapeProperty(obj->mShape);
@@ -683,7 +697,8 @@ LottieParser::parseShapeObject()
683 } 697 }
684 obj->process(); 698 obj->process();
685 obj->setStatic(obj->mShape.isStatic()); 699 obj->setStatic(obj->mShape.isStatic());
686 return obj; 700
701 return sharedShape;
687} 702}
688 703
689LottieTrimObject::TrimType 704LottieTrimObject::TrimType
@@ -706,10 +721,12 @@ LottieParser::getTrimType()
706/* 721/*
707 * https://github.com/airbnb/lottie-web/blob/master/docs/json/shapes/trim.json 722 * https://github.com/airbnb/lottie-web/blob/master/docs/json/shapes/trim.json
708 */ 723 */
709LottieObject * 724std::shared_ptr<LottieObject>
710LottieParser::parseTrimObject() 725LottieParser::parseTrimObject()
711{ 726{
712 LottieTrimObject *obj = new LottieTrimObject(); 727 std::shared_ptr<LottieTrimObject> sharedTrim = std::make_shared<LottieTrimObject>();
728 LottieTrimObject *obj = sharedTrim.get();
729
713 while (const char* key = NextObjectKey()) { 730 while (const char* key = NextObjectKey()) {
714 if (0 == strcmp(key, "s")) { 731 if (0 == strcmp(key, "s")) {
715 parseProperty(obj->mStart); 732 parseProperty(obj->mStart);
@@ -729,13 +746,16 @@ LottieParser::parseTrimObject()
729 obj->setStatic(obj->mStart.isStatic() && 746 obj->setStatic(obj->mStart.isStatic() &&
730 obj->mEnd.isStatic() && 747 obj->mEnd.isStatic() &&
731 obj->mOffset.isStatic()); 748 obj->mOffset.isStatic());
732 return obj; 749
750 return sharedTrim;
733} 751}
734 752
735LottieObject * 753std::shared_ptr<LottieObject>
736LottieParser::parseReapeaterObject() 754LottieParser::parseReapeaterObject()
737{ 755{
738 LottieRepeaterObject *obj = new LottieRepeaterObject(); 756 std::shared_ptr<LottieRepeaterObject> sharedRepeater = std::make_shared<LottieRepeaterObject>();
757 LottieRepeaterObject *obj = sharedRepeater.get();
758
739 while (const char* key = NextObjectKey()) { 759 while (const char* key = NextObjectKey()) {
740 if (0 == strcmp(key, "c")) { 760 if (0 == strcmp(key, "c")) {
741 parseProperty(obj->mCopies); 761 parseProperty(obj->mCopies);
@@ -753,17 +773,20 @@ LottieParser::parseReapeaterObject()
753 obj->setStatic(obj->mCopies.isStatic() && 773 obj->setStatic(obj->mCopies.isStatic() &&
754 obj->mOffset.isStatic() && 774 obj->mOffset.isStatic() &&
755 obj->mTransform->isStatic()); 775 obj->mTransform->isStatic());
756 return obj; 776
777 return sharedRepeater;
757} 778}
758 779
759 780
760/* 781/*
761 * https://github.com/airbnb/lottie-web/blob/master/docs/json/shapes/transform.json 782 * https://github.com/airbnb/lottie-web/blob/master/docs/json/shapes/transform.json
762 */ 783 */
763LottieTransform * 784std::shared_ptr<LottieObject>
764LottieParser::parseTransformObject() 785LottieParser::parseTransformObject()
765{ 786{
766 LottieTransform *obj = new LottieTransform(); 787 std::shared_ptr<LottieTransform> sharedTransform = std::make_shared<LottieTransform>();
788 LottieTransform *obj = sharedTransform.get();
789
767 while (const char* key = NextObjectKey()) { 790 while (const char* key = NextObjectKey()) {
768 if (0 == strcmp(key, "a")) { 791 if (0 == strcmp(key, "a")) {
769 parseProperty(obj->mAnchor); 792 parseProperty(obj->mAnchor);
@@ -790,16 +813,19 @@ LottieParser::parseTransformObject()
790 obj->mSkew.isStatic() && 813 obj->mSkew.isStatic() &&
791 obj->mSkewAxis.isStatic() && 814 obj->mSkewAxis.isStatic() &&
792 obj->mOpacity.isStatic() ); 815 obj->mOpacity.isStatic() );
793 return obj; 816
817 return sharedTransform;
794} 818}
795 819
796/* 820/*
797 * https://github.com/airbnb/lottie-web/blob/master/docs/json/shapes/fill.json 821 * https://github.com/airbnb/lottie-web/blob/master/docs/json/shapes/fill.json
798 */ 822 */
799LottieObject * 823std::shared_ptr<LottieObject>
800LottieParser::parseFillObject() 824LottieParser::parseFillObject()
801{ 825{
802 LottieFillObject *obj = new LottieFillObject(); 826 std::shared_ptr<LottieFillObject> sharedFill = std::make_shared<LottieFillObject>();
827 LottieFillObject *obj = sharedFill.get();
828
803 while (const char* key = NextObjectKey()) { 829 while (const char* key = NextObjectKey()) {
804 if (0 == strcmp(key, "c")) { 830 if (0 == strcmp(key, "c")) {
805 parseProperty(obj->mColor); 831 parseProperty(obj->mColor);
@@ -816,7 +842,8 @@ LottieParser::parseFillObject()
816 } 842 }
817 obj->setStatic(obj->mColor.isStatic() && 843 obj->setStatic(obj->mColor.isStatic() &&
818 obj->mOpacity.isStatic()); 844 obj->mOpacity.isStatic());
819 return obj; 845
846 return sharedFill;
820} 847}
821 848
822/* 849/*
@@ -860,10 +887,12 @@ JoinStyle LottieParser::getLineJoin()
860/* 887/*
861 * https://github.com/airbnb/lottie-web/blob/master/docs/json/shapes/stroke.json 888 * https://github.com/airbnb/lottie-web/blob/master/docs/json/shapes/stroke.json
862 */ 889 */
863LottieObject * 890std::shared_ptr<LottieObject>
864LottieParser::parseStrokeObject() 891LottieParser::parseStrokeObject()
865{ 892{
866 LottieStrokeObject *obj = new LottieStrokeObject(); 893 std::shared_ptr<LottieStrokeObject> sharedStroke = std::make_shared<LottieStrokeObject>();
894 LottieStrokeObject *obj = sharedStroke.get();
895
867 while (const char* key = NextObjectKey()) { 896 while (const char* key = NextObjectKey()) {
868 if (0 == strcmp(key, "c")) { 897 if (0 == strcmp(key, "c")) {
869 parseProperty(obj->mColor); 898 parseProperty(obj->mColor);
@@ -890,7 +919,8 @@ LottieParser::parseStrokeObject()
890 obj->setStatic(obj->mColor.isStatic() && 919 obj->setStatic(obj->mColor.isStatic() &&
891 obj->mOpacity.isStatic() && 920 obj->mOpacity.isStatic() &&
892 obj->mWidth.isStatic()); 921 obj->mWidth.isStatic());
893 return obj; 922
923 return sharedStroke;
894} 924}
895 925
896void LottieParser::parseArrayValue(LottieColor &color) 926void LottieParser::parseArrayValue(LottieColor &color)
@@ -1240,7 +1270,7 @@ public:
1240 } 1270 }
1241 void visitChildren(LottieGroupObject *obj) { 1271 void visitChildren(LottieGroupObject *obj) {
1242 for(auto child :obj->mChildren) 1272 for(auto child :obj->mChildren)
1243 child->accept(this); 1273 child.get()->accept(this);
1244 switch (obj->type()) { 1274 switch (obj->type()) {
1245 case LottieObject::Type::Layer: 1275 case LottieObject::Type::Layer:
1246 sgDebug<<"[LAYER End ]"; 1276 sgDebug<<"[LAYER End ]";
@@ -1266,15 +1296,15 @@ SGJson::SGJson(const char *data)
1266 t.start(); 1296 t.start();
1267 LottieParser r(const_cast<char *>(data)); 1297 LottieParser r(const_cast<char *>(data));
1268 1298
1269 LottieComposition *comp = r.parseComposition(); 1299 std::shared_ptr<LottieComposition> comp = r.parseComposition();
1270#ifdef DEBUG_PARSER 1300#ifdef DEBUG_PARSER
1271 LottieObjectInspector inspector; 1301 LottieObjectInspector inspector;
1272 comp->accept(&inspector); 1302 comp.get()->accept(&inspector);
1273#endif 1303#endif
1274 comp->processRepeaterObjects(); 1304 comp.get()->processRepeaterObjects();
1275#ifdef DEBUG_PARSER 1305#ifdef DEBUG_PARSER
1276 sgDebug<<"******** After Repeater Processing **********"; 1306 sgDebug<<"******** After Repeater Processing **********";
1277 comp->accept(&inspector); 1307 comp.get()->accept(&inspector);
1278#endif 1308#endif
1279 sgCritical<<"Parsing time = "<<t.elapsed()<<" ms"; 1309 sgCritical<<"Parsing time = "<<t.elapsed()<<" ms";
1280} 1310}