lottie: Fix the issue of assuming the startframe of composition is always zero. 21/192221/1
authorsubhransu mohanty <sub.mohanty@samsung.com>
Thu, 1 Nov 2018 01:18:02 +0000 (10:18 +0900)
committersubhransu mohanty <sub.mohanty@samsung.com>
Thu, 1 Nov 2018 01:18:02 +0000 (10:18 +0900)
        use the start and end frame instead.

Change-Id: I16cee8b8fbf651faa8c736d979bab51a07dbfa4d

src/lottie/lottieanimation.cpp
src/lottie/lottiemodel.h

index 86edc964043d881ed168faf19636563ae326ac4b..f0086a6c2ae60b4baf1303b9d106b2c1565127a0 100644 (file)
@@ -39,8 +39,11 @@ const std::vector<LOTNode *> &AnimationImpl::renderList(size_t frameNo, const VS
 
 bool AnimationImpl::update(size_t frameNo, const VSize &size)
 {
-   if (frameNo > mModel->frameDuration())
-       frameNo = mModel->frameDuration();
+   if (frameNo > mModel->endFrame())
+       frameNo = mModel->endFrame();
+
+   if (frameNo < mModel->startFrame())
+       frameNo = mModel->startFrame();
 
    mCompItem->resize(size);
    return mCompItem->update(frameNo);
index 34c49954894be9821715839bfea7b0201b9332e4..d0a2e4cdd3c29de1c185361869ef60b5de73eae3 100644 (file)
@@ -664,6 +664,7 @@ public:
    size_t frameDuration() const {return mRoot->frameDuration();}
    size_t frameRate() const {return mRoot->frameRate();}
    size_t startFrame() const {return mRoot->startFrame();}
+   size_t endFrame() const {return mRoot->endFrame();}
    size_t frameAtPos(double pos) const {return mRoot->frameAtPos(pos);}
 public:
     std::shared_ptr<LOTCompositionData> mRoot;