Skip to content

armgit / raea

Public Imported from GitHub
0

Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.

Page paint: a filter of opacity() functions alone is drawn as the layer's alpha, not as an atlas image (#96)

shinyobjectzbe220a6064b0
diff --git a/vendor/blitz-paint/src/render.rs b/vendor/blitz-paint/src/render.rs
index 3e9fb3b4..1d37ee1a 100644
--- a/vendor/blitz-paint/src/render.rs
+++ b/vendor/blitz-paint/src/render.rs
@@ -1200,6 +1200,18 @@ impl<'dom, 'a> BlitzDomPainter<'dom, 'a> {
None if has_url => None,
None => convert_filters(&effects.filter.0).map(Arc::new),
};
+ // raea: a filter of opacity() functions alone is the group's alpha, as the `opacity` property is (Filter
+ // Effects 1 §10.9 scales the result's alpha), so it's drawn as the layer's alpha, not as a filter: a
+ // filtered element is an image the size of its box in Vello's atlas (8192 px a side), and twelve
+ // full-frame `filter: opacity()` layers at 2160x3840 (a motion blur of <Freeze> samples) outgrew it,
+ // so the frame was drawn without them (#96)
+ let only_opacity = !has_url && !effects.filter.0.is_empty() && effects.filter.0.iter().all(|f| matches!(f, crate::filters::StyloFilter::Opacity(_)));
+ let (filter, opacity) = if only_opacity {
+ (None, opacity * effects.filter.0.iter().map(|f| if let crate::filters::StyloFilter::Opacity(a) = f { a.0 } else { 1.0 }).product::<f32>())
+ } else {
+ (filter, opacity)
+ };
+ let has_opacity = has_opacity || opacity < 1.0;
// raea: backdrop-filter's url()s the same way, the backdrop clipped to the border box as its other
// filters are; a url() to no <filter> leaves the backdrop unfiltered
let has_backdrop_url = effects.backdrop_filter.0.iter().any(|f| matches!(f, crate::filters::StyloFilter::Url(_)));
diff --git a/vendor/vendor.toml b/vendor/vendor.toml
index cc7c46a3..55b181e0 100644
--- a/vendor/vendor.toml
+++ b/vendor/vendor.toml
@@ -63,7 +63,7 @@ exit = "a bevy_ui_widgets release on parley 0.12"
path = "vendor/blitz-paint"
upstream = "crates.io:0.3.0-beta.4"
kind = "patch"
-reason = "angled tile gradients, many-tile gradient layers as one brush, text-shadow, ellipsis, inline-box opacity, box-shadow blur as Chrome's; filters by GPU passes (B4a/B4b); z-index boxes clipped by the overflow between them and their stacking context; a range input's thumb; what an element paints at an offset of its own (background position and tiles, box and text shadows, scroll, inline SVG) placed in its own axes under a rotated ancestor (#18); background-clip: text, its background masked by the text of the element and everything in it (#37) as Chrome does, unscrolled; inline text in a scroller scrolled once, not twice (#46); a rounded corner where one side has no width (a left-only border on a rounded box), which drew nothing; a bevy_ui node's box shadow (data-raea-bevy-shadow, its BoxShadowSamples) drawn as bevy_ui draws it: spread by its width and its height and corners by the same ratio, then blurred as box_shadow.wesl blurs it, from a CPU bitmap (render/bevy_shadow.rs); a stacking context's out-of-flow boxes from containing blocks above it kept in its layer and not culled (raea #39); a filter's layer over the boxes the element and its descendants draw (up to the overflow clips in their way), not its border box alone"
+reason = "angled tile gradients, many-tile gradient layers as one brush, text-shadow, ellipsis, inline-box opacity, box-shadow blur as Chrome's; filters by GPU passes (B4a/B4b); z-index boxes clipped by the overflow between them and their stacking context; a range input's thumb; what an element paints at an offset of its own (background position and tiles, box and text shadows, scroll, inline SVG) placed in its own axes under a rotated ancestor (#18); background-clip: text, its background masked by the text of the element and everything in it (#37) as Chrome does, unscrolled; inline text in a scroller scrolled once, not twice (#46); a rounded corner where one side has no width (a left-only border on a rounded box), which drew nothing; a bevy_ui node's box shadow (data-raea-bevy-shadow, its BoxShadowSamples) drawn as bevy_ui draws it: spread by its width and its height and corners by the same ratio, then blurred as box_shadow.wesl blurs it, from a CPU bitmap (render/bevy_shadow.rs); a stacking context's out-of-flow boxes from containing blocks above it kept in its layer and not culled (raea #39); a filter's layer over the boxes the element and its descendants draw (up to the overflow clips in their way), not its border box alone; a filter of opacity() functions alone drawn as the layer's alpha, not as an atlas image (raea #96)"
exit = "a Blitz release that draws these"
[blitz-dom]