Skip to content

lv_obj_set_style_clip_corner(true) fails to clip the bottom edge when parent has border_width=0 and pad_all=0 #9030

@hiennguyenle

Description

@hiennguyenle

LVGL version

9.3.0

Platform

Vscode simulator.

What happened?

Hi,
When a circular parent has clip_corner enabled and a square child fills the parent (100% x 100%), the child is clipped at the top but not at the bottom if the parent’s border_width and pad_all are both set to 0.
If either padding or border is non-zero, the clipping works on all sides.

Image

How to reproduce?

    lv_obj_t *scr = lv_screen_active();

    // Parent: circular container with clip_corner enabled
    lv_obj_t *parent = lv_obj_create(scr);
    lv_obj_set_size(parent, 160, 160);
    lv_obj_center(parent);

    lv_obj_set_style_radius(parent, LV_RADIUS_CIRCLE, 0);
    lv_obj_set_style_clip_corner(parent, true, 0);

    // 🔴 Trigger condition: both 0
    lv_obj_set_style_border_width(parent, 0, 0);
    lv_obj_set_style_pad_all(parent, 0, 0);

    // Visualize parent
    lv_obj_set_style_bg_color(parent, lv_color_hex(0x224488), 0);
    lv_obj_set_style_bg_opa(parent, LV_OPA_40, 0);
    lv_obj_set_style_border_color(parent, lv_color_hex(0x224488), 0);

    // Child: full-size square
    lv_obj_t *child = lv_obj_create(parent);
    lv_obj_set_size(child, LV_PCT(100), LV_PCT(100));
    lv_obj_align(child, LV_ALIGN_CENTER, 0, 0);

    lv_obj_set_style_radius(child, 0, 0);
    lv_obj_set_style_bg_color(child, lv_color_hex(0xFF4444), 0);
    lv_obj_set_style_bg_opa(child, LV_OPA_COVER, 0);
}```

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions