From 292519649c4244adb6672488efe7c2e906726c58 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Wed, 8 Mar 2023 21:26:35 +0100 Subject: about to implement huff --- lvc/src/impls.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lvc/src/impls.rs') diff --git a/lvc/src/impls.rs b/lvc/src/impls.rs index 04699c6..098db39 100644 --- a/lvc/src/impls.rs +++ b/lvc/src/impls.rs @@ -1,5 +1,5 @@ use crate::{Frame, Pixel, Ref, View, P2}; -use std::ops::{Add, Index, IndexMut, Sub}; +use std::ops::{Add, AddAssign, Index, IndexMut, Sub}; impl Frame { pub fn export(&self, view: View) -> Vec { @@ -18,6 +18,7 @@ impl Frame { source = &source[1..]; } } + assert_eq!(source.len(), 0) } pub fn new(size: P2) -> Self { Self { @@ -39,6 +40,12 @@ impl Pixel { pub const GREEN: Pixel = Pixel { r: 0, g: 255, b: 0 }; pub const BLUE: Pixel = Pixel { r: 0, g: 0, b: 255 }; } +impl AddAssign for P2 { + fn add_assign(&mut self, rhs: Self) { + self.x += rhs.x; + self.y += rhs.y; + } +} impl Add for Pixel { type Output = Pixel; #[inline] -- cgit v1.2.3-70-g09d2