Add QoiDecoder, handle padding properly + refactor
This commit is contained in:
parent
acdd29060c
commit
0eb8a7ade7
4 changed files with 87 additions and 45 deletions
|
|
@ -16,6 +16,7 @@ pub enum Error {
|
|||
InvalidMagic { magic: u32 },
|
||||
UnexpectedBufferEnd,
|
||||
InvalidColorSpace { colorspace: u8 },
|
||||
InvalidPadding,
|
||||
}
|
||||
|
||||
pub type Result<T> = StdResult<T, Error>;
|
||||
|
|
@ -51,6 +52,9 @@ impl Display for Error {
|
|||
Self::InvalidColorSpace { colorspace } => {
|
||||
write!(f, "invalid color space: {} (expected 0 or 1)", colorspace)
|
||||
}
|
||||
Self::InvalidPadding => {
|
||||
write!(f, "invalid padding (stream end marker)")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue