diff options
Diffstat (limited to 'mtree-test/src/decode.rs')
-rw-r--r-- | mtree-test/src/decode.rs | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/mtree-test/src/decode.rs b/mtree-test/src/decode.rs index 9c29717..97557da 100644 --- a/mtree-test/src/decode.rs +++ b/mtree-test/src/decode.rs @@ -1,10 +1,10 @@ use crate::{BLOCK_SIZE, Frame, LastFrames, frame_to_frame_rect_copy}; use framework::BitstreamFilter; -use glam::{I16Vec2, i16vec2}; +use glam::{IVec2, ivec2}; use std::collections::VecDeque; pub struct Dec { - res: I16Vec2, + res: IVec2, last: LastFrames, } impl BitstreamFilter for Dec { @@ -13,7 +13,7 @@ impl BitstreamFilter for Dec { fn new(width: u32, height: u32) -> Self { Self { - res: i16vec2(width as i16, height as i16), + res: ivec2(width as i32, height as i32), last: LastFrames { frame_offset: 0, frames: VecDeque::new(), @@ -26,12 +26,11 @@ impl BitstreamFilter for Dec { for bx in 0..self.res.x / BLOCK_SIZE { for by in 0..self.res.y / BLOCK_SIZE { - let boff = i16vec2(bx * BLOCK_SIZE, by * BLOCK_SIZE); - let brect = boff..boff + I16Vec2::splat(BLOCK_SIZE); + let boff = ivec2(bx * BLOCK_SIZE, by * BLOCK_SIZE); let kind = a[0]; a = &a[1..]; if kind == 0 { - let size = frame.import_rect(self.res, brect, &a); + let size = frame.import_rect(boff, IVec2::splat(BLOCK_SIZE), &a); a = &a[size..]; } else { let rframeindex = @@ -44,12 +43,11 @@ impl BitstreamFilter for Dec { let rframe = &self.last.frames[(rframeindex - self.last.frame_offset) as usize]; frame_to_frame_rect_copy( - self.res, - &mut frame, rframe, - I16Vec2::splat(BLOCK_SIZE), + &mut frame, + IVec2::splat(BLOCK_SIZE), + ivec2(offx as i32, offy as i32), boff, - i16vec2(offx, offy), ); } } @@ -57,6 +55,6 @@ impl BitstreamFilter for Dec { self.last.frames.push_back(frame.clone()); - frame.0 + frame.data } } |