glutin: Use existing routines for rounding physical/logical sizes.

This commit is contained in:
Josh Matthews 2019-11-18 13:36:49 -05:00
parent e6ae93f66e
commit 68b832db27

View file

@ -540,13 +540,15 @@ impl webxr::glwindow::GlWindow for Window {
fn size(&self) -> UntypedSize2D<gl::GLsizei> { fn size(&self) -> UntypedSize2D<gl::GLsizei> {
let dpr = self.device_hidpi_factor().get() as f64; let dpr = self.device_hidpi_factor().get() as f64;
let LogicalSize { width, height } = self let size = self
.gl_context .gl_context
.borrow() .borrow()
.window() .window()
.get_inner_size() .get_inner_size()
.expect("Failed to get window inner size."); .expect("Failed to get window inner size.");
Size2D::new(width * dpr, height *dpr).to_i32() let size = size.to_physical(dpr);
let (w, h): (u32, u32) = size.into();
Size2D::new(w as i32, h as i32)
} }
fn get_rotation(&self) -> Rotation3D<f32, UnknownUnit, UnknownUnit> { fn get_rotation(&self) -> Rotation3D<f32, UnknownUnit, UnknownUnit> {