Update benches to latest glium display setup api
[mandelwow.git] / lib.rs
diff --git a/lib.rs b/lib.rs
index 98797f372eb1af0485144d2c6d2395b978bc70c3..3ec2b55117d9850a3dae3a59f122ceba6a32202e 100644 (file)
--- a/lib.rs
+++ b/lib.rs
@@ -26,9 +26,10 @@ pub use shaded_cube::ShadedCube;
 pub fn screenshot(display : &glium::Display) {
     let image: glium::texture::RawImage2d<u8> = display.read_front_buffer();
     let image = image::ImageBuffer::from_raw(image.width, image.height, image.data.into_owned()).unwrap();
-    let image = image::DynamicImage::ImageRgba8(image).flipv();
+    let image = image::DynamicImage::ImageRgba8(image).flipv().to_rgb();
+    let image = image::DynamicImage::ImageRgb8(image);
     let mut output = std::fs::File::create(&std::path::Path::new("screenshot.png")).unwrap();
-    image.save(&mut output, image::ImageFormat::PNG).unwrap();
+    image.write_to(&mut output, image::ImageFormat::PNG).unwrap();
 }
 
 #[cfg(not(feature = "image"))]