Skip to content

Commit

Permalink
Merge pull request #1700 from linkmauve/direct-rgba
Browse files Browse the repository at this point in the history
avif-decoder: Convert directly to RGBA
  • Loading branch information
HeroicKatora committed Apr 14, 2022
2 parents 8860c3d + 3862f76 commit 5fe5764
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/codecs/avif/decoder.rs
Expand Up @@ -112,7 +112,7 @@ impl<'a, R: 'a + Read> ImageDecoder<'a> for AvifDecoder<R> {
num_planes: 3,
};
let dst_format = dcp::ImageFormat {
pixel_format: dcp::PixelFormat::Bgra,
pixel_format: dcp::PixelFormat::Rgba,
color_space: dcp::ColorSpace::Lrgb,
num_planes: 1,
};
Expand Down Expand Up @@ -160,11 +160,6 @@ impl<'a, R: 'a + Read> ImageDecoder<'a> for AvifDecoder<R> {
}
}

// Convert Bgra to Rgba
for chunk in buf.chunks_exact_mut(4) {
chunk.swap(0, 2);
}

Ok(())
}
}

0 comments on commit 5fe5764

Please sign in to comment.