I am try to implement the 1 bit color renderer using lvgl 9 with lv_micropython port for eink display.
to reduce memory usage, I choose color format LV_COLOR_FORMAT_I1, and I want to know if lvgl have treat this format correctly, so I dive into the source.
I found the function lv_color_format_get_size use uint8_t to storage the result.
it maybe right in some circumstance, but the accuracy result should 0.125 byte.
in lib/lv_bindings/lvgl/src/draw/lv_draw_buf.c
function lv_draw_buf_goto_xy use it to calculate the target data.
return data + x * lv_color_format_get_size(buf->header.cf);
will result wrong target data.
for example, x is 7 , it should +0’s byte instead of +7’s byte
maybe it should invoke the underlay function to calculate the correct index
return data + (( x * lv_color_format_get_bpp(buf->header.cf) + 7) >> 3)
I know nothing about the implement of the lvgl, just found this issue by accident.
I don’t know which logic will call lv_color_format_get_size to calculate the byte index again, for color format LV_COLOR_FORMAT_I1, it will get wrong result.
if lv_color_format_get_size can return 0.125 then everything is right, I know it is impossible, float is inflate for mcu.