Repository navigation
feat(gpui): clip a layer to its element's rounded corners - #84
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 46 minutes. View limit details
Summary
Merge Risk:
|
| Corners_ScaledPixels corners = params->corners; | ||
| if (corners.top_left > 0.0 || corners.top_right > 0.0 || corners.bottom_right > 0.0 || | ||
| corners.bottom_left > 0.0) { | ||
| fade *= saturate(0.5 - quad_sdf(source_point, params->clip, corners, 0.0) * params->scale); |
There was a problem hiding this comment.
Use the element's corner smoothing in the clip.
When corner_smoothing > 0, the element's background and border use a smoothed corner. The style paint path preserves that smoothing, but the layer parameters omit it. This call then forces a circular corner with 0.0. An opaque child can therefore remain visible outside the smoothed silhouette. Carry the smoothing through the filter parameters and use it here and in the WGPU and DirectX mask paths. Keep 0.0 for unsmoothed elements. (raw.githubusercontent.com)
Summary
clip_corners(), which clips an element and everything inside it to the element's rounded corners through an offscreen layer, so pictures and blurs follow the curve rather than a rectangular content mask