Conversation
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stacked on #1. Extends the analytic blurred rounded rect paint from scalar per-corner radii to per-corner elliptical radii (CSS
border-radiuswith/syntax), acrossvello_common,vello_cpu, andvello_hybrid.New public type in
vello_common::blurred_rounded_rect(kurbo'sRoundedRectRadiican't express elliptical corners):fill_blurred_rounded_rectonvello_cpu::RenderContextandvello_hybrid::Scenenow takesCornerRadii(breaking, follows on from #1's change).Field math
The isotropic superellipse corner term is replaced by an anisotropic one. Per corner we encode blur-adjusted axis radii
r1_x = hypot(rx, 2σ),r1_y = hypot(ry, 2σ), an exponent derived from the corner's geometric mean radius (which reduces to #1's exponent for circular corners), plus precomputed weightsw_x = r1_x^-p,w_y = r1_y^-p. In the fine shader (same code invello_cpuSIMD andrender.wesl):r_effis the radius of the anisotropic superellipse in the direction of the sample point — it interpolates betweenr1_x(on the horizontal midline) andr1_y(vertical), so the Gaussian falloff tracks the local corner curvature instead of assuming a circle. Whenr1_x == r1_ythe shader selectsr1_xdirectly, so circular corners take exactly the same value path as before — all existing uniform and non-uniform snapshots pass byte-identical, on both CPU and hybrid.GpuBlurredRoundedRectgrows from 6 to 9 texels (r1_x,r1_y,exponent,w_x,w_ycorner vectors).Caveats
This remains an approximation: the anisotropic field's iso-contours are not uniformly spaced Euclidean offsets, so blur falloff around highly eccentric corners is heuristic rather than exact. It is well-behaved for moderate eccentricity and improves as σ grows; the fully-elliptical pill snapshot (40×25 radii) renders correctly.
Testing
New snapshot tests (CPU + hybrid/wgpu):
blurred_rounded_rect_elliptical_radii,..._elliptical_radii_std_dev,..._elliptical_pill,inverse_blurred_rounded_rect_elliptical_radii. An elliptical example was added to theblurred_rounded_rectexample scene.cargo fmt/clippy --workspace --all-targetsclean; fullblurred_rounded_rectfilter: 192 passed, 0 failed.Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/f0e29f278fc544ebb7a91bfeed0bcc85
Requested by: @nicoburns