@@ -129,6 +129,11 @@ namespace MDWMBlurGlassExt
129129 {
130130 clipApplied = true ;
131131 }
132+ // If clipRound is configured, always apply clipping
133+ if (g_configData.clipRound > 0 )
134+ {
135+ clipApplied = true ;
136+ }
132137 if (m_clipApplied2 != clipApplied)
133138 {
134139 m_rootVisual.Clip (clipApplied ? m_dcompDevice.as <wuc::Compositor>().CreateGeometricClip (m_pathGeometry) : nullptr );
@@ -149,7 +154,43 @@ namespace MDWMBlurGlassExt
149154 m_compositedRgn.get ()
150155 )
151156 };
152- m_pathGeometry.Path (wuc::CompositionPath{ canvasGeometry.as <wg::IGeometrySource2D>() });
157+
158+ // Apply rounded rectangle clipping
159+ if (g_configData.clipRound > 0 )
160+ {
161+ winrt::com_ptr<ID2D1RoundedRectangleGeometry> roundedRectGeometry{ nullptr };
162+ D2D1_ROUNDED_RECT roundedRect = D2D1::RoundedRect (
163+ D2D1::RectF (0 .f , 0 .f , static_cast <float >(wil::rect_width (regionBox)), static_cast <float >(wil::rect_height (regionBox))),
164+ static_cast <float >(g_configData.clipRound ),
165+ static_cast <float >(g_configData.clipRound )
166+ );
167+ THROW_IF_FAILED (factory->CreateRoundedRectangleGeometry (roundedRect, roundedRectGeometry.put ()));
168+
169+ winrt::com_ptr<ID2D1PathGeometry> clippedGeometry{ nullptr };
170+ THROW_IF_FAILED (factory->CreatePathGeometry (clippedGeometry.put ()));
171+ winrt::com_ptr<ID2D1GeometrySink> sink{ nullptr };
172+ THROW_IF_FAILED (clippedGeometry->Open (sink.put ()));
173+
174+ winrt::com_ptr<ID2D1Geometry> baseGeometry{ nullptr };
175+ canvasGeometry->GetGeometry (baseGeometry.put ());
176+ THROW_IF_FAILED (
177+ baseGeometry->CombineWithGeometry (
178+ roundedRectGeometry.get (),
179+ D2D1_COMBINE_MODE_INTERSECT,
180+ nullptr ,
181+ sink.get ()
182+ )
183+ );
184+ THROW_IF_FAILED (sink->Close ());
185+
186+ auto clippedCanvasGeometry{ winrt::make_self<Geometry::CanvasGeometry>() };
187+ clippedCanvasGeometry->SetGeometry (clippedGeometry.get ());
188+ m_pathGeometry.Path (wuc::CompositionPath{ clippedCanvasGeometry.as <wg::IGeometrySource2D>() });
189+ }
190+ else
191+ {
192+ m_pathGeometry.Path (wuc::CompositionPath{ canvasGeometry.as <wg::IGeometrySource2D>() });
193+ }
153194 }
154195
155196 void CCompositedBackdropVisual::OnBackdropBrushUpdated ()
0 commit comments