Skip to content

[NanoVG] clip corner not working #10429

Description

@ajax-prykhodko-a

LVGL version

9.6.0

Platform

SDL with NanoVG

What happened?

Expected:

Image

Actual:

Image

How to reproduce?

  lv_obj_t* section = lv_obj_create(lv_screen_active());
  lv_obj_remove_style_all(section);
  lv_obj_set_size(section, LV_PCT(95), LV_SIZE_CONTENT);
  lv_obj_set_flex_flow(section, LV_FLEX_FLOW_COLUMN);
  lv_obj_set_style_radius(section, LV_DPX(40), 0);
  lv_obj_set_style_pad_gap(section, LV_DPX(1), 0);
  lv_obj_set_style_clip_corner(section, true, 0);

  for (size_t i = 0; i < 4; i++) {
      lv_obj_t* obj = lv_obj_create(section);
      lv_obj_remove_style_all(obj);
      lv_obj_set_size(obj, LV_PCT(100), lv_dpx(50));
      lv_obj_set_style_bg_opa(obj, LV_OPA_COVER, 0);
      if (i % 2 == 0) {
          lv_obj_set_style_bg_color(obj, lv_color_make(0xff, 0x00, 0x00), 0);
      } else {
          lv_obj_set_style_bg_color(obj, lv_color_make(0x0, 0xff, 0x00), 0);
      }
  }

  lv_obj_center(section);

Looking at code it seems that problem is in lv_draw_nanovg_mask_rect

{
....

    /* Use NVG_DESTINATION_IN (Sa * D) blending mode to make the corners transparent */
    lv_nanovg_fill(
        u->vg,
        NVG_CCW, // <--- NVG_CW should be
        NVG_DESTINATION_IN,
        nvgRGBA(0, 0, 0, 0));

    LV_PROFILER_DRAW_END;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions