Problem about NXP vg lite GPU zoom out the circular picture

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:

  1. The reduced image is not in the center, but in the lower right corner;
  2. 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:

  1. Only I have encountered this bug, and have other guys ever encountered this bug?

  2. Is there any solution?

My test code and video are attached below:

static void anim_size_cb(void * var, int32_t v)
{
	lv_img_set_zoom(var, 256-v);
}

{
    /* create a lv_img to show rgb565 image */
    lv_obj_t *rgb565_img_obj = lv_img_create(root);
    lv_obj_align(rgb565_img_obj, LV_ALIGN_CENTER, 0, 0);
    lv_obj_add_flag(rgb565_img_obj, LV_OBJ_FLAG_CLICKABLE);
    lv_img_set_src(rgb565_img_obj, &rgb565_img);
    
    lv_anim_t a;
    lv_anim_init(&a);
    lv_anim_set_var(&a, rgb565_img_obj);
    lv_anim_set_values(&a, 10, 50);
    lv_anim_set_time(&a, 1000);
    lv_anim_set_playback_delay(&a, 100);
    lv_anim_set_playback_time(&a, 300);
    lv_anim_set_repeat_delay(&a, 500);
    lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);
    lv_anim_set_path_cb(&a, lv_anim_path_ease_in_out);

    lv_anim_set_exec_cb(&a, anim_size_cb);
    lv_anim_set_values(&a, 10, 240);
    lv_anim_start(&a);
}  

You are welcome to answer this question. If you use NXP vg lite, you are more welcome to test it.

Please open an issue on GitHub and I’ll tag the developers from NXP.

Hi @gump

Can you more specify your setup? Target device, SDK version, etc.?

Thanks

Mike

Hi kisvegabor, thank you for your message reply.

I will find time to feed back the bugs I encounter on the issue on GitHub these two days.

When I replied to another netizen, I replied about the latest progress of this bug. You can also check it.

Thanks
Gump

Hi @michalsusen, thank you for your message reply,and I will reply to your question below.

  1. The lvgl version in my SDK is 8.3.4. The lvgl settings for the vglite GPU have not changed much.
  2. 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);
    
    ....

}

Thanks

Gump

Hi @gump

download our latest SDK 2.13. There are a lot of VGlite issues fixed so please take inspiration from there.

Mike