1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
use crate::{
block::{Block, BlockInner},
frame::Frame,
view::View,
};
pub fn decode_block(block: &Block, mut target: View<&mut Frame>, prev: View<&Frame>) {
match &block.inner {
BlockInner::Literal(pixels) => target.set_pixels(pixels),
BlockInner::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);
}
BlockInner::Reference { translation: _ } => target.copy_from(&prev),
}
}
|