From aa99eda0f7e81f37e33c754a91c83988ca9ef0e8 Mon Sep 17 00:00:00 2001 From: subhransu mohanty Date: Thu, 15 Nov 2018 11:45:57 +0900 Subject: [PATCH] lottie/parser: support parsing auto orient property of layer. Change-Id: Ib7d757d43633d601fd76e8c3393219f7682c9112 --- src/lottie/lottiemodel.h | 2 ++ src/lottie/lottieparser.cpp | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lottie/lottiemodel.h b/src/lottie/lottiemodel.h index b3dba60..385091f 100644 --- a/src/lottie/lottiemodel.h +++ b/src/lottie/lottiemodel.h @@ -300,6 +300,7 @@ public: int solidWidth() const noexcept{return mSolidLayer.mWidth;} int solidHeight() const noexcept{return mSolidLayer.mHeight;} LottieColor solidColor() const noexcept{return mSolidLayer.mColor;} + bool autoOrient() const noexcept{return mAutoOrient;} int timeRemap(int frameNo) const; public: struct SolidLayer { @@ -326,6 +327,7 @@ public: bool mHasRepeater{false}; bool mHasGradient{false}; bool mRoot{false}; + bool mAutoOrient{false}; std::vector> mMasks; LOTCompositionData *mCompRef; }; diff --git a/src/lottie/lottieparser.cpp b/src/lottie/lottieparser.cpp index 30cf7c8..18e576b 100644 --- a/src/lottie/lottieparser.cpp +++ b/src/lottie/lottieparser.cpp @@ -791,6 +791,8 @@ std::shared_ptr LottieParserImpl::parseLayer() layer->mHasMask = GetBool(); } else if (0 == strcmp(key, "masksProperties")) { parseMaskProperty(layer); + } else if (0 == strcmp(key, "ao")) { + layer->mAutoOrient = GetInt(); } else { #ifdef DEBUG_PARSER vWarning << "Layer Attribute Skipped : " << key; @@ -1206,7 +1208,7 @@ std::shared_ptr LottieParserImpl::parseTransformObject() parseProperty(obj->mSkewAxis); } else if (0 == strcmp(key, "o")) { parseProperty(obj->mOpacity); - } else if (0 == strcmp(key, "hd")) { + } else if (0 == strcmp(key, "hd")) { obj->mHidden = GetBool(); } else { Skip(key); @@ -1916,6 +1918,7 @@ public: << ", outFm:" << obj->mOutFrame << ", stFm:" << obj->mStartFrame << ", ts:" << obj->mTimeStreatch + << ", ao:" << obj->autoOrient() << "\n"; visitChildren(static_cast(obj), level); vDebug << level -- 2.7.4