Integrate upstream changes

This commit is contained in:
R.Chavignat committed 2018-06-17 16:44:51 +02:00
1 parent ec72f33dbc
commit 9c098c4bee
5 files changed
+9 -19

No files matched your search

+1 -1
View File
@@ -13,6 +13,6 @@ authors = [
[dependencies] [dependencies]
byteorder = "1.2.*" byteorder = "1.2.*"
enum_primitive = "0.1.*"
lzw = "0.10.*" lzw = "0.10.*"
num-derive = "0.2.*"
num-traits = "0.2.*" num-traits = "0.2.*"
+1 -3
View File
@@ -75,8 +75,7 @@ tags!{
Predictor 317; Predictor 317;
} }
enum_from_primitive! { #[derive(Clone, Copy, Debug, FromPrimitive)]
#[derive(Clone, Copy, Debug)]
pub enum Type { pub enum Type {
BYTE = 1, BYTE = 1,
ASCII = 2, ASCII = 2,
@@ -84,7 +83,6 @@ pub enum Type {
LONG = 4, LONG = 4,
RATIONAL = 5, RATIONAL = 5,
} }
}
#[allow(unused_qualifications)] #[allow(unused_qualifications)]
+5 -13
View File
@@ -35,8 +35,7 @@ enum DecodingBuffer<'a> {
U16(&'a mut [u16]) U16(&'a mut [u16])
} }
enum_from_primitive! { #[derive(Clone, Copy, Debug, PartialEq, FromPrimitive)]
#[derive(Clone, Copy, Debug, PartialEq)]
enum PhotometricInterpretation { enum PhotometricInterpretation {
WhiteIsZero = 0, WhiteIsZero = 0,
BlackIsZero = 1, BlackIsZero = 1,
@@ -47,10 +46,8 @@ enum PhotometricInterpretation {
YCbCr = 6, YCbCr = 6,
CIELab = 8, CIELab = 8,
} }
}
enum_from_primitive! { #[derive(Clone, Copy, Debug, FromPrimitive)]
#[derive(Clone, Copy, Debug)]
enum CompressionMethod { enum CompressionMethod {
None = 1, None = 1,
Huffman = 2, Huffman = 2,
@@ -60,23 +57,18 @@ enum CompressionMethod {
JPEG = 6, JPEG = 6,
PackBits = 0x8005 PackBits = 0x8005
} }
}
enum_from_primitive! { #[derive(Clone, Copy, Debug, FromPrimitive)]
#[derive(Clone, Copy, Debug)]
enum PlanarConfiguration { enum PlanarConfiguration {
Chunky = 1, Chunky = 1,
Planar = 2 Planar = 2
} }
}
enum_from_primitive! { #[derive(Clone, Copy, Debug, FromPrimitive)]
#[derive(Clone, Copy, Debug)]
enum Predictor { enum Predictor {
None = 1, None = 1,
Horizontal = 2 Horizontal = 2
} }
}
/// The representation of a TIFF decoder /// The representation of a TIFF decoder
/// ///
@@ -179,7 +171,7 @@ impl<R: Read + Seek> Decoder<R> {
if self.bits_per_sample.len() == 1 => Ok(ColorType::Gray(self.bits_per_sample[0])), if self.bits_per_sample.len() == 1 => Ok(ColorType::Gray(self.bits_per_sample[0])),
_ => Err(TiffError::UnsupportedError(format!( _ => Err(TiffError::UnsupportedError(format!(
"{:?} with {:?} bits per sample is unsupported", self.bits_per_sample, self.photometric_interpretation "{:?} with {:?} bits per sample is unsupported", self.photometric_interpretation, self.bits_per_sample
))) // TODO: this is bad we should not fail at this point} ))) // TODO: this is bad we should not fail at this point}
} }
} }
+1 -1
View File
@@ -8,8 +8,8 @@
extern crate byteorder; extern crate byteorder;
extern crate lzw; extern crate lzw;
#[macro_use] extern crate num_derive;
extern crate num_traits; extern crate num_traits;
#[macro_use] extern crate enum_primitive;
pub mod decoder; pub mod decoder;
mod error; mod error;
+1 -1
View File
@@ -54,4 +54,4 @@ fn test_rgb_u16()
//assert_eq!(decoder.colortype().unwrap(), ColorType::GrayA(8)); //assert_eq!(decoder.colortype().unwrap(), ColorType::GrayA(8));
//let img_res = decoder.read_image(); //let img_res = decoder.read_image();
//assert!(img_res.is_ok()); //assert!(img_res.is_ok());
} //}