In the bench suite, check for 3/4 channels
This commit is contained in:
parent
5b0d420200
commit
6019791c3b
1 changed files with 3 additions and 6 deletions
|
@ -91,12 +91,9 @@ fn read_png(filename: &Path) -> Result<Image> {
|
||||||
let mut buf = vec![0; reader.output_buffer_size()];
|
let mut buf = vec![0; reader.output_buffer_size()];
|
||||||
let info = reader.next_frame(&mut buf)?;
|
let info = reader.next_frame(&mut buf)?;
|
||||||
let bytes = &buf[..info.buffer_size()];
|
let bytes = &buf[..info.buffer_size()];
|
||||||
Ok(Image {
|
let channels = info.color_type.samples() as u8;
|
||||||
width: info.width,
|
ensure!(channels == 3 || channels == 4, "invalid channels: {}", channels);
|
||||||
height: info.height,
|
Ok(Image { width: info.width, height: info.height, channels, data: bytes.to_vec() })
|
||||||
channels: info.color_type.samples() as u8,
|
|
||||||
data: bytes.to_vec(),
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
trait Codec {
|
trait Codec {
|
||||||
|
|
Loading…
Reference in a new issue