-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
fix(draw): use image area to check if decoded image usable #4948
Conversation
0528328
to
4393793
Compare
It depends on #4833, right? |
Yes. Only with 4393793#diff-242f305692436f289db7b3cdda6298157b9ab35835506b88b28a86b1524051abR266-R274 |
Can you send a code snippet in which the are to draw is really larger than the image area? |
The barcode could be used to reproduce it. Do change Comment out this line 274 4393793#diff-242f305692436f289db7b3cdda6298157b9ab35835506b88b28a86b1524051abR274 void test_barcode_normal(void)
{
lv_obj_t * barcode = lv_barcode_create(lv_scr_act());
lv_obj_center(barcode);
lv_color_t dark_color = lv_color_black();
lv_color_t light_color = lv_color_white();
uint16_t scale = 2;
lv_barcode_set_dark_color(barcode, dark_color);
lv_barcode_set_light_color(barcode, light_color);
lv_barcode_set_scale(barcode, scale);
lv_result_t res;
lv_image_dsc_t * image_dsc;
lv_barcode_set_direction(barcode, LV_DIR_HOR);
res = lv_barcode_update(barcode, "https://lvgl.io");
image_dsc = lv_canvas_get_image(barcode);
lv_obj_set_size(barcode, image_dsc->header.w, 50);
lv_barcode_set_direction(barcode, LV_DIR_VER);
res = lv_barcode_update(barcode, "https://lvgl.io");
image_dsc = lv_canvas_get_image(barcode);
lv_obj_set_size(barcode, 50, image_dsc->header.h);
} |
Could you try with |
4393793
to
0a12e65
Compare
It works well on my end too. |
Hi Gabor, |
0a12e65
to
c10fe8d
Compare
That's really interesting. I'm not sure which commit has fixed it. However, now with online latest code + this PR, I can now reproduce the issue steadily with [Warn] (0.020, +20) lv_image_set_src: failed to get image info: 0x60e000000a50 lv_image.c:174
[User] (0.021, +1) img_decode_and_draw: area not ready lv_draw_sw_img.c:285
[User] (0.021, +0) img_decode_and_draw: area not ready lv_draw_sw_img.c:285
[User] (0.021, +0) img_decode_and_draw: area not ready lv_draw_sw_img.c:285
[User] (0.021, +0) img_decode_and_draw: area not ready lv_draw_sw_img.c:285
[User] (0.021, +0) img_decode_and_draw: area not ready lv_draw_sw_img.c:285 |
I've tested it an I think this is what happens: Let's we have a 100x1 image, which is tiled to get a 100x20 image. For the sake of simplicity lets say the image is at 0;0. Now we invalidate the (50;10)(60;15) area. So we need to decode x=50..60 and draw it 6 times (y=10..15). In the first run it's correctly detected that the image is not decoded yet, so that 11 pixel (x=50..60) are decoded. However in the next run here it's assumed that the whole image was decoded which is not true. So we need to keep |
We need some feedback on this pull request. Now we mark this as "stale" because there was no activity here for 14 days. Remove the "stale" label or comment else this will be closed in 7 days. |
Is it already resolved by some other PRs? |
It's still ongoing. Will go back too it in following days. |
We need some feedback on this pull request. Now we mark this as "stale" because there was no activity here for 14 days. Remove the "stale" label or comment else this will be closed in 7 days. |
Shall we pin this issue? |
No need, I shall dig into it right now. |
c10fe8d
to
534c4e1
Compare
Fix lvgl#4838 Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
534c4e1
to
8c1e843
Compare
Hi @kisvegabor |
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.
I think that's what we needed!
Cool. |
I've opened #5396 to discuss what kind of test configs are required. |
Description of the feature or fix
Fix #4838
When using get_area_cb, need to detect if the decoded image is ready to be used again(normally no).
Now I have firstly intersect areas with full image, and then check if area to draw is inside decoded image area.
Checkpoints
code-format.py
from the scripts folder. astyle needs to be installed.lv_conf_template.h
run lv_conf_internal_gen.py and update Kconfig.Be sure the following conventions are followed:
enum
s instead of macros. If inevitable to usedefine
s export them withLV_EXPORT_CONST_INT(defined_value)
right after thedefine
.type name[]
declaration for array parameters instead oftype * name
void *
pointersmalloc
into a static or global variables. Instead declare the variable inlv_global_t
structure inlv_global.h
and mark the variable with(LV_GLOBAL_DEFAULT()->variable)
when it's used. See a detailed description here.lv_<widget_name>_create(lv_obj_t * parent)
pattern.lv_<module_name>
and should receivelv_obj_t *
as first argument which is a pointer to widget object itself.struct
s should be used via an API and not modified directly via their elements.struct
APIs should follow the widgets' conventions. That is to receive a pointer to thestruct
as the first argument, and the prefix of thestruct
name should be used as the prefix of the function name too (e.g.lv_disp_set_default(lv_disp_t * disp)
)struct
s which are not part of the public API must begin with underscore in order to mark them as "private".struct
as the first argument. Thestruct
must containvoid * user_data
field.void * user_data
and the sameuser_data
needs to be passed as the last argument of the callback.xcb_t
.