summaryrefslogtreecommitdiffstats
path: root/winit/src/application
diff options
context:
space:
mode:
Diffstat (limited to 'winit/src/application')
-rw-r--r--winit/src/application/state.rs16
1 files changed, 6 insertions, 10 deletions
diff --git a/winit/src/application/state.rs b/winit/src/application/state.rs
index 5525cbd5..9c539548 100644
--- a/winit/src/application/state.rs
+++ b/winit/src/application/state.rs
@@ -3,7 +3,6 @@ use crate::conversion;
use crate::{Application, Color, Debug, Point, Size, Viewport};
use std::marker::PhantomData;
-use winit::dpi::PhysicalSize;
use winit::event::{Touch, WindowEvent};
use winit::window::Window;
@@ -193,18 +192,15 @@ where
// Update scale factor and size
let new_scale_factor = application.scale_factor();
- let Size { width, height } = self.viewport.physical_size();
- let PhysicalSize {
- width: w_width,
- height: w_height,
- } = window.inner_size();
+ let new_size = window.inner_size();
+ let current_size = self.viewport.physical_size();
+
if self.scale_factor != new_scale_factor
- || (width, height) != (w_width, w_height)
+ || (current_size.width, current_size.height)
+ != (new_size.width, new_size.height)
{
- let size = window.inner_size();
-
self.viewport = Viewport::with_physical_size(
- Size::new(size.width, size.height),
+ Size::new(new_size.width, new_size.height),
window.scale_factor() * new_scale_factor,
);
self.viewport_version = self.viewport_version.wrapping_add(1);