@@ -23,7 +23,7 @@ void MainWindowView::initBackground() noexcept
2323
2424 auto createAlignedRect = [this ](auto _aligmentType, lv_style_t * _style) {
2525 lv_obj_t * pObject{nullptr };
26- auto parent = lv_scr_act ();
26+ auto parent = m_pWindowRoot. get ();
2727
2828 pObject = lv_obj_create (parent);
2929 lv_obj_set_size (pObject, MainWindowView::Width, MainWindowView::Height / 2 );
@@ -55,7 +55,7 @@ void MainWindowView::initBackground() noexcept
5555 m_pYan.reset (createAlignedRect (LV_ALIGN_TOP_MID, &m_yanStyle));
5656
5757 auto createAlignedCircle = [this ](auto _aligmentType, lv_style_t * _style) {
58- auto parent = lv_scr_act ();
58+ auto parent = m_pWindowRoot. get ();
5959 lv_obj_t * pCircle = lv_obj_create (parent);
6060
6161 lv_obj_set_size (pCircle, MainWindowView::Width / 2 , MainWindowView::Height / 2 );
@@ -95,9 +95,23 @@ void MainWindowView::resetBackgroundStyle() noexcept
9595
9696void MainWindowView::initMask () noexcept
9797{
98- constexpr std::uint8_t RoundedArea = 240 ;
99- lv_draw_mask_radius_init (&radiusParam, &maskArea, RoundedArea, false );
100- m_maskId = lv_draw_mask_add (&radiusParam, nullptr );
98+ m_pWindowRoot.reset (lv_obj_create (lv_scr_act ()));
99+ auto container = m_pWindowRoot.get ();
100+ lv_obj_set_size (container, MainWindowView::Width, MainWindowView::Height);
101+ lv_obj_center (container);
102+ lv_obj_set_style_radius (container, LV_RADIUS_CIRCLE, LV_PART_MAIN);
103+ lv_obj_set_scrollbar_mode (container,LV_SCROLLBAR_MODE_OFF);
104+ lv_obj_set_style_pad_all (container,0 ,LV_PART_MAIN);
105+ lv_obj_set_style_clip_corner (container,true ,LV_PART_MAIN);
106+ lv_obj_set_style_border_width (container,0 ,LV_PART_MAIN);
107+
108+ // The drawing mask implementation causes the crash with the access violation.
109+ // For the current LVGL 8.0 latest version the solution hasn't been found
110+ // The best we can do now is an attempt to use the container for all of the widgtes with the given set of styles
111+
112+ // constexpr std::uint8_t RoundedArea = 240;
113+ // lv_draw_mask_radius_init(&radiusParam, &maskArea, RoundedArea, false);
114+ // m_maskId = lv_draw_mask_add(&radiusParam, nullptr);
101115
102116 // m_pObjMask.reset( lv_objmask_create( lv_disp_get_scr_act( nullptr ), nullptr ) );
103117
0 commit comments