From 1694a347ee43f3691463e5042bb9decb03c20ba3 Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Tue, 28 May 2019 11:46:56 +0900 Subject: [PATCH] example: update image object pixels properly. image object requests the updated pixels in its own designed interface. --- example/lottieviewer.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/example/lottieviewer.cpp b/example/lottieviewer.cpp index 88d07ac..1439d4a 100644 --- a/example/lottieviewer.cpp +++ b/example/lottieviewer.cpp @@ -94,8 +94,7 @@ _animator_cb(void *data) float pos = info->view->getPos(); _update_frame_info(info, pos); elm_slider_value_set(info->slider, (double)pos); - info->view->render(); - + evas_object_image_pixels_dirty_set(info->view->getImage(), EINA_TRUE); if (pos >= 1.0) _toggle_start_button(info); } @@ -113,7 +112,7 @@ _slider_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) if (!info->autoPlaying) { info->view->seek(val); - info->view->render(); + evas_object_image_pixels_dirty_set(info->view->getImage(), EINA_TRUE); } } @@ -125,6 +124,13 @@ _button_clicked_cb(void *data, Evas_Object */*obj*/, void */*event_info*/) _toggle_start_button(info); } +static void +_image_update_cb(void *data, Evas_Object *obj EINA_UNUSED) +{ + AppInfo *info = (AppInfo *)data; + info->view->render(); +} + Evas_Object * create_layout(Evas_Object *parent, const char *file) { @@ -151,6 +157,7 @@ create_layout(Evas_Object *parent, const char *file) //IMAGE from LOTTIEVIEW image = view->getImage(); evas_object_show(image); + evas_object_image_pixels_get_callback_set(image, _image_update_cb, info); elm_object_part_content_set(layout, "lottie", image); //SLIDER -- 2.7.4