Skip to content

Commit d719b19

Browse files
committed
cleanup
1 parent a904088 commit d719b19

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ fn main() {
3232
```
3333

3434
## Requirements
35-
This crate compiles only with rust >= 1.40.
35+
This crate compiles only with rust >= 1.36.

examples/decode.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
extern crate jpeg_decoder as jpeg;
22
extern crate png;
3-
extern crate core;
43

54
use std::env;
65
use std::fs::File;

src/decoder.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ impl<R: Read> Decoder<R> {
495495
compute_image_lossless(&frame, planes_u16)
496496
}
497497
else{
498-
compute_image(&frame, planes, self.is_jfif, self.color_transform)
498+
compute_image(&frame.components, planes, frame.output_size, self.is_jfif, self.color_transform)
499499
}
500500
}
501501

@@ -955,15 +955,14 @@ fn refine_non_zeroes<R: Read>(reader: &mut R,
955955
Ok(last)
956956
}
957957

958-
fn compute_image(frame: &FrameInfo,
958+
fn compute_image(components: &[Component],
959959
mut data: Vec<Vec<u8>>,
960+
output_size: Dimensions,
960961
is_jfif: bool,
961962
color_transform: Option<AdobeColorTransform>) -> Result<Vec<u8>> {
962963
if data.is_empty() || data.iter().any(Vec::is_empty) {
963964
return Err(Error::Format("not all components have data".to_owned()));
964965
}
965-
let output_size = frame.output_size;
966-
let components = &frame.components;
967966

968967
if components.len() == 1 {
969968
let component = &components[0];
@@ -976,7 +975,7 @@ fn compute_image(frame: &FrameInfo,
976975

977976
// if the image width is a multiple of the block size,
978977
// then we don't have to move bytes in the decoded data
979-
if frame.coding_process != CodingProcess::Lossless && usize::from(output_size.width) != line_stride {
978+
if usize::from(output_size.width) != line_stride {
980979
let mut buffer = vec![0u8; width];
981980
// The first line already starts at index 0, so we need to move only lines 1..height
982981
for y in 1..height {

0 commit comments

Comments
 (0)