Add comments

This commit is contained in:
Benoît du Garreau 2022-05-28 23:32:16 +02:00
parent 8488c7b25e
commit ca2ef3e813

View File

@ -175,7 +175,10 @@ impl TakeScreenshot {
let image = match self.tex_format {
wgpu::TextureFormat::Bgra8UnormSrgb => {
let (pixels, rest) = pixel_bytes.as_chunks_mut();
// Always valid because each pixel should use four bytes.
assert!(rest.is_empty());
// Swap blue and red components to get a RGBA texture.
for [b, _g, r, _a] in pixels {
std::mem::swap(b, r);
}