From a512e710fa1f5ced9316bb6d1ef3af2b08f601d0 Mon Sep 17 00:00:00 2001 From: devdesk Date: Mon, 19 Feb 2024 22:38:58 +0200 Subject: [PATCH] correct for both 4 bytes per pixel and 2 bytes --- examples/live.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/live.rs b/examples/live.rs index 8341a4c..dfa374c 100644 --- a/examples/live.rs +++ b/examples/live.rs @@ -126,7 +126,7 @@ fn main() -> anyhow::Result<()> { }; let g = frame[i * 2]; let b = frame[i * 2 + 1]; - let out_i = (y + x * HEIGHT) * 2; + let out_i = ((HEIGHT - 1 - y) + (WIDTH - 1 - x) * HEIGHT) * 4; swapped[out_i..out_i + 4].copy_from_slice(&[0, r, g, b]); } }