Drop_shadow artefacts

What do you want to achieve?

Trying to use drop_shadow, following the example for 9.5, and while it works, there are drawing artefacts left behind. Interestingly the example at Examples - LVGL 9.6 documentation exhibits exactly the same behaviour.

However, if I run the example in the lv_port_pc_vscode simulator it works just fine without the artefacts - this may be because it’s using full refresh for each frame (if I configure my display driver to use full refresh the artefacts disappear, but that’s obviously not an acceptable solution.)

What have you tried so far?

Replicated the example (lvgl/examples/styles/lv_example_style_10.c)

Code to reproduce

/*You code here*/
  new(drop) lv_style_t();
  lv_style_init(drop);
  lv_style_set_drop_shadow_color(drop, lv_color_make(255, 0, 0));
  lv_style_set_drop_shadow_offset_x(drop, 5);
  lv_style_set_drop_shadow_offset_y(drop, 10);
  lv_style_set_drop_shadow_opa(drop, static_cast<uint8_t>(255.0f));
  lv_style_set_drop_shadow_radius(drop, 16);
  #line 46 "host-test.yaml"
   lv_arc_t_id = lv_arc_create(lvgl_lvglcomponent_id->get_screen_active());
  lv_obj_set_style_align(lv_arc_t_id, LV_ALIGN_CENTER, LV_PART_MAIN);
  lv_obj_add_style(lv_arc_t_id, drop, (lv_state_t)(LV_PART_INDICATOR));

For comparison, here is the example code:

/**
 * Using the drop shadow style properties
 */
void lv_example_style_10(void)
{
    static lv_style_t style;
    lv_style_init(&style);

    lv_style_set_drop_shadow_color(&style, lv_palette_main(LV_PALETTE_RED));
    lv_style_set_drop_shadow_radius(&style, 16);
    lv_style_set_drop_shadow_opa(&style, 255);
    lv_style_set_drop_shadow_offset_x(&style, 5);
    lv_style_set_drop_shadow_offset_y(&style, 10);

    /*Create an object with the new style*/
    lv_obj_t * obj = lv_arc_create(lv_screen_active());
    lv_obj_add_style(obj, &style, LV_PART_INDICATOR);
    lv_obj_center(obj);
}

Screenshot and/or video

Screenshot 2026-03-31 at 12.38.19 PM

Environment

  • MCU/MPU/Board: MacOS using SDL2
  • LVGL version: 9.5.0

It looks fairly clear to me that the problem is that the area being invalidated is not taking into account the shadow.

Hi @clydeps,

Thank you for reporting it. I’ve just sent a PR to fix it. Could you check it?

1 Like

Yes, that’s a fix, thanks.

1 Like