From: subhransu mohanty Date: Wed, 12 Sep 2018 06:59:39 +0000 (+0900) Subject: lottie/parser: update the lottie tree dump method. X-Git-Tag: submit/tizen/20180917.042405~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3756e7cb93edf28fa283040469c3f0bd30b12e4d;p=platform%2Fcore%2Fuifw%2Flottie-player.git lottie/parser: update the lottie tree dump method. Change-Id: Ie126e11a20493517df69fdd2a03a091bc802a733 --- diff --git a/src/lottie/lottieparser.cpp b/src/lottie/lottieparser.cpp index 93e5b95..5aa6158 100644 --- a/src/lottie/lottieparser.cpp +++ b/src/lottie/lottieparser.cpp @@ -1,7 +1,10 @@ #include "lottieparser.h" -#define DEBUG_PARSER + +//#define DEBUG_PARSER + +#define DEBUG_PRINT_TREE // This parser implements JSON token-by-token parsing with an API that is // more direct; we don't have to create handler object and @@ -1856,97 +1859,104 @@ void LottieParserImpl::parseProperty(LOTAnimatable &obj) } } -#ifdef DEBUG_PARSER +#ifdef DEBUG_PRINT_TREE class LOTDataInspector { public: - void visit(LOTCompositionData *obj) + void visit(LOTCompositionData *obj, std::string level) { - vDebug << "[COMP_START:: static:" << obj->isStatic() - << " v:" << obj->mVersion << " [{ stFm endFm fmRate } { " - << obj->mStartFrame << " " << obj->mEndFrame << " }]\n"; - visit(obj->mRootLayer.get()); - vDebug << "[COMP End ]\n"; - } - void visit(LOTLayerData *obj) + vDebug <<" { " + <isStatic() + << ", v: " << obj->mVersion + << ", stFm: "<< obj->startFrame() + << ", endFm: "<< obj->endFrame()<<"\n"; + level.append("\t"); + visit(obj->mRootLayer.get(), level); + level.erase(level.end() -1 , level.end()); + vDebug << " } " <mLayerType) - << " id:" << obj->mId << " Pid:" << obj->mParentId - << " static:" << obj->isStatic() - << "[{ stFm endFm stTm tmStrch } { " << obj->mInFrame << " " - << obj->mOutFrame << " " << obj->mStartFrame << " " - << obj->mTimeStreatch << " }]"; - - visitChildren(static_cast(obj)); - - vDebug << "[LAYER_END:: type:" - << layerType(obj->mLayerType).c_str() - << " id:" << obj->mId << "\n"; - } - void visitChildren(LOTGroupData *obj) + vDebug << level + <<"{ " + <mLayerType) + << ", id:" << obj->mId << " Pid:" << obj->mParentId + << ", a:" << !obj->isStatic() + << ", inFm:" << obj->mInFrame + << ", outFm:" << obj->mOutFrame + <<"\n"; + visitChildren(static_cast(obj), level); + vDebug << level + <<"} " + <mLayerType).c_str() + << ", id: " << obj->mId << "\n"; + } + void visitChildren(LOTGroupData *obj, std::string level) { - for (const auto& child : obj->mChildren) visit(child.get()); + level.append("\t"); + for (const auto& child : obj->mChildren) visit(child.get(), level); } - void visit(LOTData *obj) { + void visit(LOTData *obj, std::string level) { switch (obj->mType) { case LOTData::Type::Repeater: { - vDebug << "[REPEATER_START]"; - visitChildren(static_cast(obj)); - vDebug << "[REPEATER_END]"; + vDebug << level<<"{ Repeater:"; + visitChildren(static_cast(obj), level); + vDebug << level<<"} Repeater"; break; } case LOTData::Type::ShapeGroup: { - vDebug << "[GROUP_START:: static:" << obj->isStatic() << "]"; - visitChildren(static_cast(obj)); - vDebug << "[GROUP_END]"; + vDebug << level <<"{ ShapeGroup: a:" << !obj->isStatic(); + visitChildren(static_cast(obj), level); + vDebug << level <<"} ShapeGroup"; break; } case LOTData::Type::Layer:{ - visit(static_cast(obj)); + visit(static_cast(obj), level); break; } case LOTData::Type::Trim:{ - vDebug << "[TRIM: static: " << obj->isStatic() << " ]"; + vDebug << level<<"{ Trim: a:" << !obj->isStatic() << " }"; break; } case LOTData::Type::Rect:{ - vDebug << "[RECT: static:" << obj->isStatic() << "]"; + vDebug <isStatic() << " }"; break; } case LOTData::Type::Ellipse:{ - vDebug << "[RECT: static:" << obj->isStatic() << "]"; + vDebug << level<<"{ Ellipse: a:" << !obj->isStatic() << " }"; break; } case LOTData::Type::Shape:{ - vDebug << "[SHAPE: static:" << obj->isStatic() << "]"; + vDebug << level<<"{ Shape: a:" << !obj->isStatic() << " }"; break; } case LOTData::Type::Polystar:{ - vDebug << "[POLYSTAR: static:" << obj->isStatic() << "]"; + vDebug << level<<"{ Polystar: a:" << !obj->isStatic() << " }"; break; } case LOTData::Type::Transform:{ - vDebug << "[TRANSFORM: static: " << obj->isStatic() << " ]"; + vDebug << level<<"{ Transform: a: " << !obj->isStatic() << " }"; break; } case LOTData::Type::Stroke:{ - vDebug << "[SHAPE: static:" << obj->isStatic() << "]"; + vDebug << level<<"{ Stroke: a:" << !obj->isStatic() << " }"; break; } case LOTData::Type::GStroke:{ - vDebug << "[TRANSFORM: static: " << obj->isStatic() << " ]"; + vDebug << level<<"{ GStroke: a:" << !obj->isStatic() << " }"; break; } case LOTData::Type::Fill:{ - vDebug << "[FILL: static:" << obj->isStatic() << "]"; + vDebug << level<<"{ Fill: a:" << !obj->isStatic() << " }"; break; } case LOTData::Type::GFill:{ auto f = static_cast(obj); - vDebug << "[GFILL: static:" << f->isStatic() - << " ty:" << f->mGradientType << " s:" << f->mStartPoint.value(0) - << " e:" << f->mEndPoint.value(0) << "]"; + vDebug << level<<"{ GFill: a:" << !f->isStatic() + << ", ty:" << f->mGradientType << ", s:" << f->mStartPoint.value(0) + << ", e:" << f->mEndPoint.value(0) << " }"; break; } default: @@ -1958,25 +1968,25 @@ public: { switch (type) { case LayerType::Precomp: - return "Precomp"; + return "Layer::Precomp"; break; case LayerType::Null: - return "Null"; + return "Layer::Null"; break; case LayerType::Shape: - return "Shape"; + return "Layer::Shape"; break; case LayerType::Solid: - return "Solid"; + return "Layer::Solid"; break; case LayerType::Image: - return "Image"; + return "Layer::Image"; break; case LayerType::Text: - return "Text"; + return "Layer::Text"; break; default: - return "Unknow"; + return "Layer::Unknown"; break; } } @@ -2000,9 +2010,9 @@ std::shared_ptr LottieParser::model() model->mRoot = d->composition(); model->mRoot->processRepeaterObjects(); -#ifdef DEBUG_PARSER +#ifdef DEBUG_PRINT_TREE LOTDataInspector inspector; - inspector.visit(model->mRoot.get()); + inspector.visit(model->mRoot.get(),""); #endif return model; diff --git a/src/vector/vdebug.cpp b/src/vector/vdebug.cpp index 2d8b3a8..faa74b1 100644 --- a/src/vector/vdebug.cpp +++ b/src/vector/vdebug.cpp @@ -104,7 +104,7 @@ VDebug::VDebug(LogLevel level, char const* file, char const* function, encode(line); encode(level); if (level == LogLevel::INFO) { - m_logAll = true; + m_logAll = false; } else { m_logAll = true; }