Skip to content

Commit

Permalink
size sent to wgpu should only apply window scale but not app scale
Browse files Browse the repository at this point in the history
  • Loading branch information
dzhou121 committed Sep 2, 2023
1 parent 11ed15c commit 064912c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 2 additions & 5 deletions src/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,12 @@ impl Renderer {
where
W: raw_window_handle::HasRawDisplayHandle + raw_window_handle::HasRawWindowHandle,
{
let size = Size::new(
(size.width * scale).max(1.0),
(size.height * scale).max(1.0),
);
let size = Size::new(size.width.max(1.0), size.height.max(1.0));
Self::Vger(VgerRenderer::new(window, size.width as u32, size.height as u32, scale).unwrap())
}

pub fn resize(&mut self, scale: f64, size: Size) {
let size = Size::new(size.width * scale, size.height * scale);
let size = Size::new(size.width.max(1.0), size.height.max(1.0));
match self {
Renderer::Vger(r) => r.resize(size.width as u32, size.height as u32, scale),
}
Expand Down
4 changes: 2 additions & 2 deletions src/window_handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl WindowHandle {
let scale = window.scale_factor();
let size: LogicalSize<f64> = window.inner_size().to_logical(scale);
let size = Size::new(size.width, size.height);
let paint_state = PaintState::new(&window, scale, size);
let paint_state = PaintState::new(&window, scale, size * scale);
let mut window_handle = Self {
window: Some(window),
scope: Scope::new(),
Expand Down Expand Up @@ -264,7 +264,7 @@ impl WindowHandle {
self.app_state.update_screen_size_bp(size);
self.event(Event::WindowResized(size));
let scale = self.scale * self.app_state.scale;
self.paint_state.resize(scale, size);
self.paint_state.resize(scale, size * self.scale);
self.app_state.set_root_size(size);
self.layout();
self.process_update();
Expand Down

0 comments on commit 064912c

Please sign in to comment.