The visualizer seat masks what it declares, and floors nothing
Browse files at this commit9ab653db26b6af3ae970ba431f94adde6acc9cfcParent: a78d43d- fix
- the visualizer seat masks what it declares, and floors nothing
1 changed file +17 -11
- crates/engine/src/decode.rs +17 -11
crates/engine/src/decode.rsmodified+17 -11
| @@ -650,15 +650,18 @@ impl DecodeSession { | |||
| 650 | // the picture *is* the canvas, and whatever transform the clip | 650 | // the picture *is* the canvas, and whatever transform the clip |
| 651 | // carries still reaches it through the render below. | 651 | // carries still reaches it through the render below. |
| 652 | // | 652 | // |
| 653 | - // Masked to even dimensions first, and floored at two: that is what the | 653 | + // Masked to even dimensions first: that is what the painter does to the |
| 654 | - // painter does to the planes it hands back, so a canvas it cannot divide | 654 | + // planes it hands back, so a canvas it cannot divide evenly (an odd |
| 655 | - // evenly (an odd `resolution 1921 1081` line, or a one-pixel-high one) | 655 | + // `resolution 1921 1081` line, or a one-pixel-high one) used to be |
| 656 | - // used to be *declared* at a size the picture never had -- and the | 656 | + // *declared* at a size the picture never had -- and the conversion below |
| 657 | - // conversion below then indexes a chroma plane that is not there | 657 | + // then indexes a chroma plane that is not there (`index out of bounds` |
| 658 | - // (`index out of bounds` on a zero-length slice, in this worker, where | 658 | + // on a zero-length slice, in this worker, where no frame ever arrives |
| 659 | - // no frame ever arrives and nothing catches it). | 659 | + // and nothing catches it). No floor under the mask: a canvas with no |
| 660 | + // size is asked for no picture, and the painter answers that with empty | ||
| 661 | + // planes ([`visualizer_window_i420`]), which the declared size now | ||
| 662 | + // matches. | ||
| 660 | let (canvas_w, canvas_h) = canvas.dims(); | 663 | let (canvas_w, canvas_h) = canvas.dims(); |
| 661 | - let (width, height) = ((canvas_w & !1).max(2), (canvas_h & !1).max(2)); | 664 | + let (width, height) = (canvas_w & !1, canvas_h & !1); |
| 662 | let worker_cancel = Arc::clone(&cancel); | 665 | let worker_cancel = Arc::clone(&cancel); |
| 663 | let path = path.to_path_buf(); | 666 | let path = path.to_path_buf(); |
| 664 | let handle = thread::Builder::new() | 667 | let handle = thread::Builder::new() |
| @@ -2883,9 +2886,12 @@ mod tests { | |||
| 2883 | 0, | 2886 | 0, |
| 2884 | ) | 2887 | ) |
| 2885 | .unwrap_or_else(|e| panic!("open the visualizer at {w}x{h}: {e}")); | 2888 | .unwrap_or_else(|e| panic!("open the visualizer at {w}x{h}: {e}")); |
| 2886 | - let frame = stream.frames.recv_timeout(Duration::from_secs(30)).unwrap_or_else(|e| { | 2889 | + let frame = stream |
| 2887 | - panic!("a picture for a {w}x{h} canvas, not a worker that died instead: {e}") | 2890 | + .frames |
| 2888 | - }); | 2891 | + .recv_timeout(Duration::from_secs(30)) |
| 2892 | + .unwrap_or_else(|e| { | ||
| 2893 | + panic!("a picture for a {w}x{h} canvas, not a worker that died instead: {e}") | ||
| 2894 | + }); | ||
| 2889 | assert_eq!( | 2895 | assert_eq!( |
| 2890 | (frame.width, frame.height), | 2896 | (frame.width, frame.height), |
| 2891 | (w, h), | 2897 | (w, h), |