Draw box shadows via AnyRender's box-based draw_box_shadow; pass CSS boxes as NonUniformRoundedRect - #1024
Draft
nicoburns wants to merge 11 commits into
Draft
Draw box shadows via AnyRender's box-based draw_box_shadow; pass CSS boxes as NonUniformRoundedRect#1024nicoburns wants to merge 11 commits into
nicoburns wants to merge 11 commits into
Conversation
Replaces the layer + DestOut implementation of inset box shadows with a single draw_box_shadow call, and passes the shadow clip as the shape for outset shadows instead of pushing a clip layer. Temporarily patches anyrender to a local checkout and vello to the linebender/vello#1718 branch, and updates to wgpu 30 / vello 0.11.
Contributor
|
I'll fix CI failures and address comments from users with write access that start with 'Devin'.
|
…t-box-shadow # Conflicts: # Cargo.lock # Cargo.toml # examples/paint_bench.rs # packages/blitz-paint/src/render/box_shadow.rs
This branch has not been deployed
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
Uses the new
draw_box_shadow(transform, box_shape, offset, spread, std_dev, brush, kind)andNonUniformRoundedRectfrom DioxusLabs/anyrender#117, which works with the released vello 0.11 / vello_cpu 0.3. Blitz no longer computes any shadow geometry. Inset shadows lose their layers once DioxusLabs/anyrender#113 (vello#1718) lands; Blitz needs no further changes for that.max_shadow_rect,CssBox::shadow_clip*,NonUniformRoundedRectRadii::average, theblur == 0 && spread == 0special case and its clip layer, and the insetDestOutlayers. AnyRender now computes the CSS spread radii and handles unblurred shadows exactly.clip_to_box: this isopacity < 1 || background not opaque, the same condition as the old clip layer.self.scale.returninstead ofcontinue.CssBox::{border,padding,content}_box_shape()return ananyrender::NonUniformRoundedRect. Backgrounds, background clips, overflow clips, masks and shadows use these instead of*_box_path(), so sharp-cornered boxes reachfill_rect/push_clip_rectand Skia'sdraw_rect/clip_rrect. Compound shapes (outlines, border rings) stayBezPath.Do not merge yet:
[patch.crates-io]points anyrender at the anyrender#117 branch. It can be removed once that's released.Testing
cargo clippy --workspaceandcargo test -p blitz-paintpass. I rendered a test page of inset and outset shadows, covering blur, spread, offset, radius and translucent backgrounds, at 1x and 2x on vello_cpu, vello classic (llvmpipe) and Skia raster:Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/45dbc6c083354777aaa43442ce8ef8ab
Open in Devin Desktop: https://dioxus.staging.devinenterprise.com/desktop/session/45dbc6c083354777aaa43442ce8ef8ab?variant=devin-insiders
Requested by: @nicoburns
WPT results
Subtests: 8 newly passing, 0 newly failing (net +8).
Full diff (8 changed tests)
Generated by the WPT workflow.