Conversation
…rmRoundedRect and shape-preserving recordings
|
I'll fix CI failures and address comments from users with write access that start with 'Devin'.
|
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
Breaking change to
PaintScene::draw_box_shadow. AnyRender now takes the box casting the shadow plus the CSS parameters, and computes the shadow geometry itself. This works with the currently released vello 0.11 / vello_cpu 0.3 / vello_gpu 0.3. Switching the Vello backends to linebender/vello#1718's*_blurred_rounded_rect_in+invertis left to a follow-up (#113), which also removes the inset-shadow layers.New
anyrender::NonUniformRoundedRect(rect+NonUniformRoundedRectRadii { top_left, top_right, bottom_right, bottom_left: Vec2 }) is akurbo::Shapefor CSS-style boxes with elliptical per-corner radii.as_rect()returnsSomewhen every corner is sharp, andas_rounded_rect()when every corner is circular and within kurbo's clamping, so backends can use their rect / rounded-rect fast paths.path_elementsis a non-allocating iterator.perimeteris computed analytically.spread(s)follows the CSS spread rules:r' = max(r - s, 0).r' = r + s, except that a radiusr < sgrows bys * (1 + (r/s - 1)^3)instead.scale_overlapping_radii().From<Rect>andFrom<RoundedRect>.BoxShadowGeometry::new(box_shape, offset, spread, std_dev, kind)is shared by all backends. It computes:shadow: the box spread by±spreadand translated byoffset. For inset shadows this is the unshadowed hole.area: the non-zero region to paint.clip_to_box.Backends:
std_dev == 0push_clip_path(area)+fill_path(unblurred_path()). It's a single fill, so the non-isolated clip is safedraw_unblurred(clip layer + fill)push_clip_path(area)(if clipped) +fill_blurred_rounded_rectdraw_blurred_rounded_rect_in(area, ..)draw_inset_with_layers: clip layer filled withbrush, then aDestOutlayer containing the blurred holeaverage_radius()), because the blurred rounded rect only supports one radius.clip_rrect(box, Difference / Intersect)and then a blurredRRect/DRRect, with no layer.Recording / serialization:
enum RecordedShape { Rect(Rect), RoundedRect(RoundedRect), Path(BezPath) }, chosen viaas_rect()/as_rounded_rect(). Replayed scenes keep the fast paths.BoxShadowCommand: stores the new parameters.ResourceManifest::CURRENT_VERSIONis now 2, so version 1 archives won't deserialize.Testing
cargo clippy --workspace --all-targets -D warnings,cargo test --workspace(plus--all-featuresfor anyrender / anyrender_serialize, and vello_cpu with and withoutmultithreading), and a wasm32webglclippy ofanyrender_vello_hybrid.BoxShadowGeometryareas.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