Correct way of converting logical sizes into u32

This commit is contained in:
Thomas Forgione 2018-10-11 15:11:02 +02:00
parent 02182af019
commit c6c26f7201
No known key found for this signature in database
GPG Key ID: 203DAEA747F48F41
1 changed files with 7 additions and 5 deletions

View File

@ -223,23 +223,25 @@ impl Renderer {
/// Returns a RgbaImageData of the corresponding frame.
pub fn capture_rgba_image_data(&self, dimensions: LogicalSize) -> RgbaImageData {
let dimensions: (u32, u32) = dimensions.into();
let rect = Rect {
left: 0,
bottom: 0,
width: dimensions.width as u32,
height: dimensions.height as u32,
width: dimensions.0,
height: dimensions.1,
};
let blit_target = BlitTarget {
left: 0,
bottom: 0,
width: dimensions.width as i32,
height: dimensions.height as i32,
width: dimensions.0 as i32,
height: dimensions.1 as i32,
};
// Create temporary texture and blit the front buffer to it
let texture = SrgbTexture2d::empty(
&self.display, dimensions.width as u32, dimensions.height as u32)
&self.display, dimensions.0, dimensions.1)
.unwrap();
let framebuffer = SimpleFrameBuffer::new(&self.display, &texture)
.unwrap();