diff --git a/external/rlottie/example/lottieview.cpp b/external/rlottie/example/lottieview.cpp index d1fc9f26e..7fdf903bd 100644 --- a/external/rlottie/example/lottieview.cpp +++ b/external/rlottie/example/lottieview.cpp @@ -109,7 +109,6 @@ void LottieView::seek(float pos) { if (!mRenderDelegate) return; - mPos = mapProgress(pos); // check if the pos maps to the current frame diff --git a/external/rlottie/example/lottieviewer.cpp b/external/rlottie/example/lottieviewer.cpp index 8a09ea76f..d3d86f35b 100644 --- a/external/rlottie/example/lottieviewer.cpp +++ b/external/rlottie/example/lottieviewer.cpp @@ -62,12 +62,13 @@ _layout_del_cb(void *data, Evas *, Evas_Object *, void *) } static void -_update_frame_info(AppInfo *info, double pos) +_update_frame_info(AppInfo *info) { - int frameNo = pos * info->view->getTotalFrame(); - char buf[64]; + long currFrameNo = info->view->mCurFrame; + long totalFrameNo = info->view->getTotalFrame(); - sprintf(buf, "%d / %ld", frameNo, info->view->getTotalFrame()); + char buf[64]; + sprintf(buf, "%ld (total: %ld)", currFrameNo, totalFrameNo); elm_object_part_text_set(info->layout, "text", buf); } @@ -96,7 +97,7 @@ _animator_cb(void *data) if (info && info->autoPlaying && info->view) { float pos = info->view->getPos(); - _update_frame_info(info, pos); + _update_frame_info(info); elm_slider_value_set(info->slider, (double)pos); evas_object_image_pixels_dirty_set(info->view->getImage(), EINA_TRUE); if (pos >= 1.0) @@ -111,20 +112,20 @@ _slider_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) double val = elm_slider_value_get(obj); AppInfo *info = (AppInfo *)data; - _update_frame_info(info, val); - if (!info->autoPlaying) { info->view->seek(val); evas_object_image_pixels_dirty_set(info->view->getImage(), EINA_TRUE); } + + _update_frame_info(info); } static void _button_clicked_cb(void *data, Evas_Object */*obj*/, void */*event_info*/) { AppInfo *info = (AppInfo *)data; - + if (info->view->getPos() >= 1.0f) info->view->mPos = 0.0f; _toggle_start_button(info); } @@ -133,7 +134,6 @@ create_layout(Evas_Object *parent, const char *file) { Evas_Object *layout, *slider, *image, *button; Ecore_Animator *animator; - char buf[64]; AppInfo *info = (AppInfo *)calloc(sizeof(AppInfo), 1); //LAYOUT @@ -176,10 +176,9 @@ create_layout(Evas_Object *parent, const char *file) info->animator = animator; evas_object_event_callback_add(layout, EVAS_CALLBACK_DEL, _layout_del_cb, (void *)info); - sprintf(buf, "%d / %ld", 0, view->getTotalFrame()); - elm_object_part_text_set(layout, "text", buf); - view->seek(0.0); + _update_frame_info(info); + return layout; } diff --git a/external/rlottie/src/binding/.lottieplayer.cpp.swp b/external/rlottie/src/binding/.lottieplayer.cpp.swp deleted file mode 100644 index e312a378e..000000000 Binary files a/external/rlottie/src/binding/.lottieplayer.cpp.swp and /dev/null differ diff --git a/external/rlottie/src/lottie/lottieitem.cpp b/external/rlottie/src/lottie/lottieitem.cpp index cb1bc2cdd..4cd22e4c5 100644 --- a/external/rlottie/src/lottie/lottieitem.cpp +++ b/external/rlottie/src/lottie/lottieitem.cpp @@ -443,7 +443,7 @@ VMatrix renderer::Layer::matrix(int frameNo) const bool renderer::Layer::visible() const { return (frameNo() >= mLayerData->inFrame() && - frameNo() < mLayerData->outFrame()); + frameNo() <= mLayerData->outFrame()); } void renderer::Layer::preprocess(const VRect &clip) diff --git a/external/rlottie/src/lottie/lottiemodel.h b/external/rlottie/src/lottie/lottiemodel.h index 3e0430853..745571e2c 100644 --- a/external/rlottie/src/lottie/lottiemodel.h +++ b/external/rlottie/src/lottie/lottiemodel.h @@ -539,8 +539,8 @@ public: { return long(frameAtPos(timeInSec / duration())); } - size_t totalFrame() const { return mEndFrame - mStartFrame; } - long frameDuration() const { return mEndFrame - mStartFrame - 1; } + size_t totalFrame() const { return mEndFrame - mStartFrame + 1; } + long frameDuration() const { return mEndFrame - mStartFrame; } float frameRate() const { return mFrameRate; } size_t startFrame() const { return mStartFrame; } size_t endFrame() const { return mEndFrame; } diff --git a/external/rlottie/src/lottie/lottieparser.cpp b/external/rlottie/src/lottie/lottieparser.cpp index 83be17e39..e14fd5c1c 100644 --- a/external/rlottie/src/lottie/lottieparser.cpp +++ b/external/rlottie/src/lottie/lottieparser.cpp @@ -665,9 +665,9 @@ void LottieParserImpl::parseComposition() } else if (0 == strcmp(key, "h")) { comp->mSize.setHeight(GetInt()); } else if (0 == strcmp(key, "ip")) { - comp->mStartFrame = GetDouble(); + comp->mStartFrame = std::lround(GetDouble()); } else if (0 == strcmp(key, "op")) { - comp->mEndFrame = GetDouble(); + comp->mEndFrame = std::lround(GetDouble()); } else if (0 == strcmp(key, "fr")) { comp->mFrameRate = GetDouble(); } else if (0 == strcmp(key, "assets")) {