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.

media: the halvings' loop reads its last level without a closure (dupes)

shinyobjectzfcd6e12c0396
diff --git a/runtime/js/src/media_html.rs b/runtime/js/src/media_html.rs
index 188fa922..35190eb6 100644
--- a/runtime/js/src/media_html.rs
+++ b/runtime/js/src/media_html.rs
@@ -34,7 +34,10 @@ pub mod stream {
pub fn halvings(w: u32, h: u32, rgba: &[u8], n: u8) -> Halvings {
let mut out: Halvings = Vec::new();
for _ in 0..n {
- let (sw, sh, src) = out.last().map_or((w, h, rgba), |(w, h, px)| (*w, *h, px.as_slice()));
+ let (sw, sh, src) = match out.last() {
+ Some(last) => (last.0, last.1, last.2.as_slice()),
+ None => (w, h, rgba),
+ };
if sw < 2 || sh < 2 {
break;
}