Correct way of converting logical sizes into u32
This commit is contained in:
parent
02182af019
commit
c6c26f7201
|
@ -223,23 +223,25 @@ impl Renderer {
|
||||||
/// Returns a RgbaImageData of the corresponding frame.
|
/// Returns a RgbaImageData of the corresponding frame.
|
||||||
pub fn capture_rgba_image_data(&self, dimensions: LogicalSize) -> RgbaImageData {
|
pub fn capture_rgba_image_data(&self, dimensions: LogicalSize) -> RgbaImageData {
|
||||||
|
|
||||||
|
let dimensions: (u32, u32) = dimensions.into();
|
||||||
|
|
||||||
let rect = Rect {
|
let rect = Rect {
|
||||||
left: 0,
|
left: 0,
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
width: dimensions.width as u32,
|
width: dimensions.0,
|
||||||
height: dimensions.height as u32,
|
height: dimensions.1,
|
||||||
};
|
};
|
||||||
|
|
||||||
let blit_target = BlitTarget {
|
let blit_target = BlitTarget {
|
||||||
left: 0,
|
left: 0,
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
width: dimensions.width as i32,
|
width: dimensions.0 as i32,
|
||||||
height: dimensions.height as i32,
|
height: dimensions.1 as i32,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create temporary texture and blit the front buffer to it
|
// Create temporary texture and blit the front buffer to it
|
||||||
let texture = SrgbTexture2d::empty(
|
let texture = SrgbTexture2d::empty(
|
||||||
&self.display, dimensions.width as u32, dimensions.height as u32)
|
&self.display, dimensions.0, dimensions.1)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let framebuffer = SimpleFrameBuffer::new(&self.display, &texture)
|
let framebuffer = SimpleFrameBuffer::new(&self.display, &texture)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
Loading…
Reference in New Issue