aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-03-22 22:27:01 -0700
committerFuwn <[email protected]>2022-03-22 22:27:01 -0700
commitcc58e503599218693e5755b1c4f39cf41a743488 (patch)
treee84c0a12b07a7f1feea61016a5a8e785e960ef05
parent9982d6888fc1cfae938c6bf93baebe863d80eccc (diff)
downloadpara-cc58e503599218693e5755b1c4f39cf41a743488.tar.xz
para-cc58e503599218693e5755b1c4f39cf41a743488.zip
refactor(ppm): pass line types by reference
-rw-r--r--src/ppm.rs4
-rw-r--r--test.gifbin0 -> 371200 bytes
2 files changed, 2 insertions, 2 deletions
diff --git a/src/ppm.rs b/src/ppm.rs
index 06f696e..07d69b8 100644
--- a/src/ppm.rs
+++ b/src/ppm.rs
@@ -317,7 +317,7 @@ impl PPMParser {
self.stream.read_uint::<LittleEndian>(1).unwrap() >> 7 & 0x1 != 0
}
- fn read_line_types(line_types: Vec<u8>) -> impl Generator<Yield = (usize, u8), Return = ()> {
+ fn read_line_types(line_types: &Vec<u8>) -> impl Generator<Yield = (usize, u8), Return = ()> + '_ {
move || {
for index in 0..192 {
let line_type = line_types.get(index / 4).unwrap() >> ((index % 4) * 2) & 0x03;
@@ -370,7 +370,7 @@ impl PPMParser {
let bitmap = &mut self.layers[layer];
{
- let mut generator = Self::read_line_types(line_types[layer].clone());
+ let mut generator = Self::read_line_types(&line_types[layer]);
while let std::ops::GeneratorState::Yielded((line, line_type)) =
std::pin::Pin::new(&mut generator).resume(())
{
diff --git a/test.gif b/test.gif
new file mode 100644
index 0000000..164bfb0
--- /dev/null
+++ b/test.gif
Binary files differ