Hello,everyone. My English is not good. I use English translation tools to translate. If there is any inappropriate translation, please forgive me.
Recently I encountered a problem when using lvgl8.3.4 NXP vg lite GPU to reduce the size of the image. I found that when using NXP vg lite GPU to shrink the image, a bug will appear, which is shown as follows:
The reduced image is not in the center, but in the lower right corner;
After the picture is reduced, the lower right corner of the picture is cut off.
However, when I turn off the NXP vg lite GPU, the image zooms out normally: the image zooms out in the center without any cropping.
I want to ask:
Only I have encountered this bug, and have other guys ever encountered this bug?
Hi @michalsusen, thank you for your message reply,and I will reply to your question below.
The lvgl version in my SDK is 8.3.4. The lvgl settings for the vglite GPU have not changed much.
The MCU used in my development board is not NXP, but the GPU in my MCU is vglite, which is the same as the vglite GPU in NXP. In addition, I can be sure that my vglite GPU is normal and has no problems.
Last week, I found the lvgl vglite GPU image rendering function: lv_gpu_nxp.c > lv_draw_nxp_img_decoded. The code causing the bug was found in the lv_draw_nxp_img_decoded function. The code posted below is the code that causes the bug.
static void lv_draw_nxp_img_decoded(lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * dsc,const lv_area_t * coords, const uint8_t * map_p, lv_img_cf_t cf)
{
...
lv_area_t blend_area;
/*Let's get the blend area which is the intersection of the area to fill and the clip area.*/
if(!_lv_area_intersect(&blend_area, coords, draw_ctx->clip_area))
return; /*Fully clipped, nothing to do*/
....
}
Finally, I added some code to the lv_draw_nxp_img_decoded function to solve the bug of image zooming, but I am not sure whether the modified code will cause other bugs in complex application scenarios. The following is my modified code:
static void lv_draw_nxp_img_decoded(lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * dsc,const lv_area_t * coords, const uint8_t * map_p, lv_img_cf_t cf)
{
...
lv_area_t blend_area;
/*Let's get the blend area which is the intersection of the area to fill and the clip area.*/
if(!_lv_area_intersect(&blend_area, coords, draw_ctx->clip_area))
return; /*Fully clipped, nothing to do*/
if(dsc->zoom < LV_IMG_ZOOM_NONE)
lv_area_copy(&blend_area, coords);
....
}