lvgl icon indicating copy to clipboard operation
lvgl copied to clipboard

docs: fix 'my_disp_flush' in quick-overview

Open Narukara opened this issue 1 year ago • 1 comments

Fix 'my_disp_flush' in quick-overview. In parallel rendering architecture, lv_color_t* in lv_display_flush_cb_t has been changed to uint8_t*.

Related code:

https://github.com/lvgl/lvgl/blob/a853a1289ae40898122d83be1842d0b61c56b15d/src/display/lv_display.h#L81

https://github.com/lvgl/lvgl/blob/a853a1289ae40898122d83be1842d0b61c56b15d/examples/porting/lv_port_disp_template.c#L124-L138

Narukara avatar Oct 03 '24 16:10 Narukara

Thank you for pointing this out 👍

  uint16_t * px_map_16 = (uint16_t*) px_map;
  for(y = area->y1; y <= area->y2; y++) {
             for(x = area->x1; x <= area->x2; x++) {
                 put_px(x, y, *px_map_16);
                 px_map_16++;   /*Go to the next pixel*/

Does this code mean the display has 16 bit color format? If my understanding is correct, in display_flush_cb, the pointer px_map needs to be converted to the appropriate color format?

If that's the case, I have two suggestions:

  1. Add more explanation and example code about this to quick-overview.
  2. Why not change the type of px_map in lv_display_flush_cb_t to void*? px_map is not actually a pointer to uint8_t. It points to some unknown type, which is what void* is for.

Narukara avatar Oct 10 '24 02:10 Narukara

I noticed that the documentation has been reorganized #7136. That's pretty cool. I think I can close this PR.

  1. Why not change the type of px_map in lv_display_flush_cb_t to void*? px_map is not actually a pointer to uint8_t. It points to some unknown type, which is what void* is for.

Actually I still have doubts about this. Maybe I will submit an issue later?

Narukara avatar Oct 24 '24 15:10 Narukara

Why not change the type of px_map in lv_display_flush_cb_t to void*? px_map is not actually a pointer to uint8_t. It points to some unknown type, which is what void* is for.

Actually I don't exactly remember why I used uint8_t *. Probably I wanted to emphasize that the buffer is in bytes and not pixels. Anyway, changing it now would be an API break. :slightly_frowning_face:

kisvegabor avatar Oct 25 '24 19:10 kisvegabor