-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(lottie): add lottie widget #6081
Conversation
@FASTSHIFT With the updated ThorVG the cogwheel has some artifacts here. Do you have any idea why could it happen? |
I think it's better to put |
I was thinking the same way, however it's really like a widget from every aspect: has a class, widget-like API, treated as an I'm also afraid that in the others folders it will be less visible for the users. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Gabor,
How do you managed to upgrade the ThorVG lib? Is it done manually or there's script for help?
Is #if LV_USE_THORVG_INTERNAL
needed for newly introduced source files?
This PR alone will fail on finding rlottie_capi.h
.
I've did it manually. This script helps to add the
How |
I have enabled the wrong config ninja: Entering directory `build'
[660/661] cd /home/neo/projects/lvgl/lv_port_pc_eclipse/build && /home/neo/projects/lvgl/lv_port_pc_eclipse/bin/main
AddressSanitizer:DEADLYSIGNAL
=================================================================
==547919==ERROR: AddressSanitizer: SEGV on unknown address 0x57e26ea1d003 (pc 0x57e26e91e2a8 bp 0x7fffb05433b0 sp 0x7fffb0543360 T0)
==547919==The signal is caused by a READ memory access.
#0 0x57e26e91e2a8 in argb8888_image_blend /home/neo/projects/lvgl/lv_port_pc_eclipse/lvgl/src/draw/sw/blend/lv_draw_sw_blend_to_rgb888.c:498
#1 0x57e26e91d660 in lv_draw_sw_blend_image_to_rgb888 /home/neo/projects/lvgl/lv_port_pc_eclipse/lvgl/src/draw/sw/blend/lv_draw_sw_blend_to_rgb888.c:271
#2 0x57e26e918f73 in lv_draw_sw_blend /home/neo/projects/lvgl/lv_port_pc_eclipse/lvgl/src/draw/sw/blend/lv_draw_sw_blend.c:143
#3 0x57e26e9064ba in img_draw_core /home/neo/projects/lvgl/lv_port_pc_eclipse/lvgl/src/draw/sw/lv_draw_sw_img.c:235
#4 0x57e26e8a4e0c in img_decode_and_draw /home/neo/projects/lvgl/lv_port_pc_eclipse/lvgl/src/draw/lv_draw_image.c:266
#5 0x57e26e8a4850 in _lv_draw_image_normal_helper /home/neo/projects/lvgl/lv_port_pc_eclipse/lvgl/src/draw/lv_draw_image.c:165
#6 0x57e26e9060ca in lv_draw_sw_image /home/neo/projects/lvgl/lv_port_pc_eclipse/lvgl/src/draw/sw/lv_draw_sw_img.c:164
#7 0x57e26e900537 in execute_drawing /home/neo/projects/lvgl/lv_port_pc_eclipse/lvgl/src/draw/sw/lv_draw_sw.c:380
#8 0x57e26e900254 in execute_drawing_unit /home/neo/projects/lvgl/lv_port_pc_eclipse/lvgl/src/draw/sw/lv_draw_sw.c:245
#9 0x57e26e900432 in dispatch /home/neo/projects/lvgl/lv_port_pc_eclipse/lvgl/src/draw/sw/lv_draw_sw.c:325
#10 0x57e26e8a200e in lv_draw_dispatch_layer /home/neo/projects/lvgl/lv_port_pc_eclipse/lvgl/src/draw/lv_draw.c:255
#11 0x57e26e8a1cf7 in lv_draw_dispatch /home/neo/projects/lvgl/lv_port_pc_eclipse/lvgl/src/draw/lv_draw.c:161
#12 0x57e26e8a1c5a in lv_draw_finalize_task_creation /home/neo/projects/lvgl/lv_port_pc_eclipse/lvgl/src/draw/lv_draw.c:138
#13 0x57e26e8a457f in lv_draw_image /home/neo/projects/lvgl/lv_port_pc_eclipse/lvgl/src/draw/lv_draw_image.c:109
#14 0x57e26e8e3bb7 in draw_image /home/neo/projects/lvgl/lv_port_pc_eclipse/lvgl/src/widgets/image/lv_image.c:764
#15 0x57e26e8e354a in lv_image_event /home/neo/projects/lvgl/lv_port_pc_eclipse/lvgl/src/widgets/image/lv_image.c:664
#16 0x57e26e88dcde in lv_obj_event_base /home/neo/projects/lvgl/lv_port_pc_eclipse/lvgl/src/core/lv_obj_event.c:86
#17 0x57e26e88e89e in event_send_core /home/neo/projects/lvgl/lv_port_pc_eclipse/lvgl/src/core/lv_obj_event.c:359
#18 0x57e26e88dc18 in lv_obj_send_event /home/neo/projects/lvgl/lv_port_pc_eclipse/lvgl/src/core/lv_obj_event.c:64
#19 0x57e26e89bf6b in lv_obj_redraw /home/neo/projects/lvgl/lv_port_pc_eclipse/lvgl/src/core/lv_refr.c:110
#20 0x57e26e89e042 in refr_obj /home/neo/projects/lvgl/lv_port_pc_eclipse/lvgl/src/core/lv_refr.c:892
#21 0x57e26e89c163 in lv_obj_redraw /home/neo/projects/lvgl/lv_port_pc_eclipse/lvgl/src/core/lv_refr.c:161
#22 0x57e26e89e042 in refr_obj /home/neo/projects/lvgl/lv_port_pc_eclipse/lvgl/src/core/lv_refr.c:892
#23 0x57e26e89dc62 in refr_obj_and_children /home/neo/projects/lvgl/lv_port_pc_eclipse/lvgl/src/core/lv_refr.c:790
#24 0x57e26e89da56 in refr_area_part /home/neo/projects/lvgl/lv_port_pc_eclipse/lvgl/src/core/lv_refr.c:723
#25 0x57e26e89d5e3 in refr_area /home/neo/projects/lvgl/lv_port_pc_eclipse/lvgl/src/core/lv_refr.c:619
#26 0x57e26e89d389 in refr_invalid_areas /home/neo/projects/lvgl/lv_port_pc_eclipse/lvgl/src/core/lv_refr.c:566
#27 0x57e26e89cba8 in _lv_display_refr_timer /home/neo/projects/lvgl/lv_port_pc_eclipse/lvgl/src/core/lv_refr.c:374
#28 0x57e26e8c46c4 in lv_timer_exec /home/neo/projects/lvgl/lv_port_pc_eclipse/lvgl/src/misc/lv_timer.c:300
#29 0x57e26e8c3e48 in lv_timer_handler /home/neo/projects/lvgl/lv_port_pc_eclipse/lvgl/src/misc/lv_timer.c:105
#30 0x57e26e882691 in main /home/neo/projects/lvgl/lv_port_pc_eclipse/main.c:1041
#31 0x7519b5c29d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
#32 0x7519b5c29e3f in __libc_start_main_impl ../csu/libc-start.c:392
#33 0x57e26e8802e4 in _start (/home/neo/projects/lvgl/lv_port_pc_eclipse/bin/main+0x122e4) (BuildId: 0cafb16ea873a52e22f08cd80a0b972eff635038)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /home/neo/projects/lvgl/lv_port_pc_eclipse/lvgl/src/draw/sw/blend/lv_draw_sw_blend_to_rgb888.c:498 in argb8888_image_blend
==547919==ABORTING
FAILED: CMakeFiles/run /home/neo/projects/lvgl/lv_port_pc_eclipse/build/CMakeFiles/run
cd /home/neo/projects/lvgl/lv_port_pc_eclipse/build && /home/neo/projects/lvgl/lv_port_pc_eclipse/bin/main
ninja: build stopped: subcommand failed. |
Do you use |
Yes, I use |
OK, I'll try to investigate. |
I have figured it out: diff --git a/examples/widgets/lottie/lv_example_lottie_1.c b/examples/widgets/lottie/lv_example_lottie_1.c
index 5e805f9f9..2d8cb4785 100644
--- a/examples/widgets/lottie/lv_example_lottie_1.c
+++ b/examples/widgets/lottie/lv_example_lottie_1.c
@@ -9,15 +9,16 @@ void lv_example_lottie_1(void)
{
extern const uint8_t lv_example_lottie_approve[];
extern const size_t lv_example_lottie_approve_size;
- static uint32_t buf[100 * 100];
lv_obj_t * lottie = lv_lottie_create(lv_screen_active());
- lv_lottie_set_buffer(lottie, 100, 100, buf);
+ lv_draw_buf_t * draw_buf = lv_draw_buf_create(100, 100, LV_COLOR_FORMAT_ARGB8888, LV_STRIDE_AUTO);
+ lv_lottie_set_draw_buf(lottie, draw_buf);
// lv_lottie_set_src_data(lottie, lv_example_lottie_approve, lv_example_lottie_approve_size);
lv_obj_center(lottie);
static uint32_t buf2[100 * 100];
+ lv_draw_buf_t * draw_buf2 = lv_draw_buf_create(100, 100, LV_COLOR_FORMAT_ARGB8888, LV_STRIDE_AUTO);
lottie = lv_lottie_create(lv_screen_active());
- lv_lottie_set_buffer(lottie, 100, 100, buf2);
+ lv_lottie_set_draw_buf(lottie, draw_buf2);
lv_lottie_set_src_data(lottie, lv_example_lottie_approve, lv_example_lottie_approve_size);
}
diff --git a/src/widgets/lottie/lv_lottie.c b/src/widgets/lottie/lv_lottie.c
index 024bf7edd..2f3d59017 100644
--- a/src/widgets/lottie/lv_lottie.c
+++ b/src/widgets/lottie/lv_lottie.c
@@ -85,7 +85,7 @@ void lv_lottie_set_draw_buf(lv_obj_t * obj, lv_draw_buf_t * draw_buf)
}
lv_lottie_t * lottie = (lv_lottie_t *)obj;
- tvg_swcanvas_set_target(lottie->tvg_canvas, (void *)draw_buf->data, draw_buf->header.w, draw_buf->header.stride / 4,
+ tvg_swcanvas_set_target(lottie->tvg_canvas, (void *)draw_buf->data, draw_buf->header.stride / 4, draw_buf->header.w,
draw_buf->header.h, TVG_COLORSPACE_ARGB8888);
tvg_canvas_push(lottie->tvg_canvas, lottie->tvg_paint);
lv_canvas_set_draw_buf(obj, draw_buf); |
I would like to use |
From #6101,
|
@kisvegabor Hello, thank you for your efforts. I think Team LottieFiles could announce this news through its marketing channels. I'm wondering if you would like this idea and if you could provide a real working demo video (lottie animation on a real device with LVGL) us for the promotional post. I believe this is good for LVGL and Lottie Animation promotion! Thanks. |
I was thinking about it too, but I found it a little bit obscure. I think in the example we should clearly show that it's just a simple array. However, if you wish I can add an example for
That would be amazing! I'll share video when this PR is merged. Do you have a preferred vendor or board? @FASTSHIFT Could you take look at the regression in image rendering? |
@kisvegabor I'm not considering any specific device in mind. I think a small device/screen would be good such as them: (if you can share the both sizes, it will be nice!) Also, it would be helpful if we could have an approximate date for when we can share the demo video with the Team LottieFiles to push forward. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super cool graphics format! Everything seems okay on Windows. Please update the Kconfig.
@hermet As soon as this rendering issue is resolved we can merge this PR. However in the meantime I can prepare the videos. I can record them on Thursday. |
@kisvegabor @MichaelDu9226 Hello, I'm a bit suspicious that the ThorVG canvas size is set correctly. Could you please double-check the what values(w, h, stride) did you set for the canvas size?
Your plan is great. I suggest you the test-resources with these but you can choose any others as well. By the way, just for your information, when you encounter an issue with ThorVG, you can test the resource at |
Yes, all there are set to 200. In www.thorvg.org/viewer all works well. It's a little bit complicated to update ThorVG in LVGL so I'd try if it could be an issue in ThorVG. |
@kisvegabor To make it sure, so in this image, you set 200x200 tvg canvas. What is the actual content size on the screen? 130x130? or 200x200 with clipped? |
Sorry, it was me. The |
I've update the CI with 32 bit build option and now all passes. Please review. |
@W-Mai CI has reported the |
I can't reproduce it either on Linux. Interestingly it was passing here: Rerunning just for out of curiosity. Do you see the ASAN error on Mac if you copy past the test code to a normal app? |
It's passing on the second try (I've also squashed your fixes to my commit), however the span issue is shown in this PR too #6221. It seems it's related to FreeType. My guess is the follwing:
So how does the cache of FreeType knows that a character is drawn (draw_buf is used) when releasing something from its cache. cc @W-Mai |
Add |
Great!
You're right, I overlooked the impact of multithreading and forgot to it has already turn on the USE_OS configuration. 😅 |
I will try to fix this problem. |
Thank you, @W-Mai! |
Merging! 🎉🎉🎉 |
Fix warning during build with lvgl lvgl/lvgl#6081 error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
Fix warning during build with lvgl lvgl/lvgl#6081 error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
Fix warning during build with lvgl lvgl/lvgl#6081 error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
Fix warning during build with lvgl lvgl/lvgl#6081 error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
Fix warning during build with lvgl lvgl/lvgl#6081 error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
Description of the feature or fix
closes #6021
Overview
TODO:
malloc
s in ThorVG withlv_malloc
lv_image_dsc_t
orpath
inlv_lottile_set_src
instead of havong 2 functions for data and pathNotes
lv_conf_template.h
run lv_conf_internal_gen.py and update Kconfig.scripts/code-format.py
(astyle version v3.4.12 needs to be installed) and follow the Code Conventions.