blob: e6fa91896010c768b7c3ca70c6d7e0a8130e82fa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
use crate::{block::Block, frame::Frame, view::View};
pub fn decode_block(block: &Block, mut target: View<&mut Frame>, prev: View<&Frame>) {
match &block {
Block::Literal(pixels) => target.set_pixels(pixels),
Block::Split(box [a, b]) => {
let [at, bt] = target.split_mut_unsafe();
let [ap, bp] = prev.split();
decode_block(a, at, ap);
decode_block(b, bt, bp);
}
Block::Reference { translation } => target.copy_from(&prev.offset(*translation)),
}
}
|