lvgl / lv_drivers

TFT and touch pad drivers for LVGL embedded GUI library
https://docs.lvgl.io/master/porting/index.html
MIT License
291 stars 310 forks source link

Drivers flush(...) should use physical resolution instead of display resolution when flushing #224

Closed Viatorus closed 2 years ago

Viatorus commented 2 years ago

If someone (like we) is using the same output window for multiple LVGL drivers, the SDL driver implementation should use the physical_hor_res/physical_ver_res instead of hor_res/ver_res when flushing.

https://github.com/lvgl/lv_drivers/blob/07a1d87d3c41b34de28c95d8443e9db53cce928f/sdl/sdl.c#L145-L148

Otherwise, the flush will not work probably.

Our current workaround is:

void sdl_display_flush_main_display(lv_disp_drv_t* disp_drv, const lv_area_t* area, lv_color_t* color_p) {
  disp_drv->hor_res = SDL_HOR_RES;
  disp_drv->ver_res = SDL_VER_RES;
  sdl_display_flush(disp_drv, area, color_p);
  disp_drv->hor_res = MainDisplayHorRes;
  disp_drv->ver_res = MainDisplayVerRes;
}

Which work, but doesn't feels right.

kisvegabor commented 2 years ago

the SDL driver implementation should use the physical_hor_res/physical_ver_res instead of hor_res/ver_res when flushing.

Makes sense. disp_drv.offset_x/y should be considered as well. Could you send a Pull request with the fix?