aboutsummaryrefslogtreecommitdiff
path: root/evc/src
diff options
context:
space:
mode:
Diffstat (limited to 'evc/src')
-rw-r--r--evc/src/block.rs16
-rw-r--r--evc/src/view.rs2
2 files changed, 12 insertions, 6 deletions
diff --git a/evc/src/block.rs b/evc/src/block.rs
index 98e3b54..a3d040d 100644
--- a/evc/src/block.rs
+++ b/evc/src/block.rs
@@ -30,7 +30,7 @@ impl Block {
a.write(sink)?;
b.write(sink)?;
}
- BlockInner::Reference { translation } => {
+ BlockInner::Reference { translation: _ } => {
sink.put(2u8)?;
// sink.put(*translation)?;
}
@@ -42,14 +42,20 @@ impl Block {
let inner = match source.get::<u8>()? {
0 => BlockInner::Literal(source.get()?),
1 => BlockInner::Split(Box::new({
- let subsize_left = if size.0 > size.1 {
+ let vert = size.0 > size.1;
+ let asize = if vert {
(size.0 / 2, size.1)
} else {
(size.0, size.1 / 2)
};
- let subsize_right = (size.0 - subsize_left.0, size.1 - subsize_left.1);
- let a = Block::read(source, subsize_left)?;
- let b = Block::read(source, subsize_right)?;
+ let bsize = if vert {
+ (size.0 - size.0 / 2, size.1)
+ } else {
+ (size.0, size.1 - size.1 / 2)
+ };
+
+ let a = Block::read(source, asize)?;
+ let b = Block::read(source, bsize)?;
[a, b]
})),
2 => BlockInner::Reference {
diff --git a/evc/src/view.rs b/evc/src/view.rs
index f37e57c..9c4778b 100644
--- a/evc/src/view.rs
+++ b/evc/src/view.rs
@@ -112,7 +112,7 @@ impl View<&mut Frame> {
pub fn set_pixels(&mut self, pixels: &Vec<Pixel>) {
for x in 0..self.size.0 {
for y in 0..self.size.1 {
- self[(x, y)] = pixels[x + y * self.size.0]
+ self[(x, y)] = pixels[x * self.size.1 + y]
}
}
}