Mouse cursor slow down when moved over png image

Hi,

I’m using lvgl library on beaglebone (framebuffer device). I add big image 1024x768 using:

    lv_img_set_src(img, str.str().c_str());
    lv_obj_center(img);
    lv_obj_align(img, LV_ALIGN_TOP_MID, 0, 0);
    lv_obj_set_width( img, LV_SIZE_CONTENT);  /// 1
    lv_obj_set_height( img, 779);   /// 1

and when I display cursor using:

/*Set a cursor for the mouse*/
    LV_IMG_DECLARE(mouse_cursor_icon)
    lv_obj_t * cursor_obj = lv_img_create(lv_scr_act()); /*Create an image object for the cursor */
    lv_img_set_src(cursor_obj, &mouse_cursor_icon);           /*Set the image source*/
    lv_indev_set_cursor(mouse_indev, cursor_obj);             /*Connect the image  object to the driver*/

I’m experimenting mouse lagging when moving over image but when outside of image it works smoothly. Am I doing something wrong?

Thanks.

Welcome,

I suspect it has to do with redrawing parts of an image being much more intensive than redrawing parts outside of an image that may be much simpler. When your cursor moves over the image, a small part of it gets hidden and then shown again when the cursor is gone from that point.
Don’t think you are doing something wrong here.

images caching can help prevent png from constantly being opened/decoded when accessed frequently. if you use cache png can be opened and decoded only once, save decoded image in cache and then access image in cache

Thanks that did the trick. :+1: