From: sub.mohanty@samsung.com Date: Sat, 3 Aug 2019 06:34:46 +0000 (+0900) Subject: rlottie: change the name() api signature to return const char* X-Git-Tag: accepted/tizen/unified/20190818.221648~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=af4dd06748c36ac5cf2fc5925936987356ca5752;p=platform%2Fcore%2Fuifw%2Flottie-player.git rlottie: change the name() api signature to return const char* this patch is a preparation for the optimization patch which will manage the memory for name string itself instead of using std::string. --- diff --git a/src/lottie/lottieitem.cpp b/src/lottie/lottieitem.cpp index 95e8d36..011f9fa 100644 --- a/src/lottie/lottieitem.cpp +++ b/src/lottie/lottieitem.cpp @@ -227,7 +227,7 @@ void LOTLayerItem::buildLayerNode() mLayerCNode->mClipPath.elmPtr = nullptr; mLayerCNode->mClipPath.ptCount = 0; mLayerCNode->mClipPath.elmCount = 0; - mLayerCNode->keypath = name().c_str(); + mLayerCNode->keypath = name(); } if (complexContent()) mLayerCNode->mAlpha = uchar(combinedAlpha() * 255.f); mLayerCNode->mVisible = visible(); diff --git a/src/lottie/lottieitem.h b/src/lottie/lottieitem.h index b3165ef..8d51afe 100644 --- a/src/lottie/lottieitem.h +++ b/src/lottie/lottieitem.h @@ -118,7 +118,7 @@ public: bool visible() const; virtual void buildLayerNode(); LOTLayerNode * layerNode() const {return mLayerCNode.get();} - const std::string & name() const {return mLayerData->name();} + const char* name() const {return mLayerData->name();} virtual bool resolveKeyPath(LOTKeyPath &keyPath, uint depth, LOTVariant &value); VBitmap& bitmap() {return mRenderBuffer;} protected: @@ -289,9 +289,9 @@ public: void processPaintItems(std::vector &list); void renderList(std::vector &list) override; const VMatrix & matrix() const { return mMatrix;} - const std::string & name() const + const char* name() const { - static const std::string TAG = "__"; + static const char* TAG = "__"; return mData ? mData->name() : TAG; } bool resolveKeyPath(LOTKeyPath &keyPath, uint depth, LOTVariant &value) override; diff --git a/src/lottie/lottiemodel.h b/src/lottie/lottiemodel.h index 6186dd1..c8d38bb 100644 --- a/src/lottie/lottiemodel.h +++ b/src/lottie/lottiemodel.h @@ -379,7 +379,7 @@ public: bool hidden() const {return mHidden;} void setHidden(bool value) {mHidden = value;} void setName(const char *str) {mName = str;} - const std::string& name() const{ return mName;} + const char* name() const{ return mName.c_str();} private: std::string mName; bool mStatic{true}; diff --git a/src/lottie/lottieproxymodel.h b/src/lottie/lottieproxymodel.h index 1debf7a..ec4e5fd 100644 --- a/src/lottie/lottieproxymodel.h +++ b/src/lottie/lottieproxymodel.h @@ -272,7 +272,7 @@ class LOTProxyModel public: LOTProxyModel(T *model): _modelData(model) {} LOTFilter& filter() {return mFilter;} - const std::string & name() const {return _modelData->name();} + const char* name() const {return _modelData->name();} LottieColor color(int frame) const { if (mFilter.hasFilter(rlottie::Property::StrokeColor)) { @@ -313,7 +313,7 @@ class LOTProxyModel public: LOTProxyModel(LOTFillData *model): _modelData(model) {} LOTFilter& filter() {return mFilter;} - const std::string & name() const {return _modelData->name();} + const char* name() const {return _modelData->name();} LottieColor color(int frame) const { if (mFilter.hasFilter(rlottie::Property::FillColor)) {